summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
commit993e1866df547532a05ab6db76c9ff5aefc9a3df (patch)
tree169d3bde0974235d3cde164786ef6f381a4749a7 /ext
parent1f589a2bd44ba835ad1b009a5d83abd453724829 (diff)
downloadphp-993e1866df547532a05ab6db76c9ff5aefc9a3df.tar.gz
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext')
-rw-r--r--ext/bcmath/bcmath.c4
-rw-r--r--ext/bcmath/php_bcmath.h4
-rw-r--r--ext/bz2/bz2.c4
-rw-r--r--ext/bz2/bz2_filter.c15
-rw-r--r--ext/bz2/php_bz2.h4
-rw-r--r--ext/calendar/cal_unix.c2
-rw-r--r--ext/calendar/calendar.c4
-rw-r--r--ext/calendar/easter.c2
-rw-r--r--ext/com_dotnet/com_com.c4
-rw-r--r--ext/com_dotnet/com_dotnet.c4
-rw-r--r--ext/com_dotnet/com_extension.c4
-rw-r--r--ext/com_dotnet/com_handlers.c4
-rw-r--r--ext/com_dotnet/com_iterator.c4
-rw-r--r--ext/com_dotnet/com_misc.c4
-rw-r--r--ext/com_dotnet/com_olechar.c4
-rwxr-xr-xext/com_dotnet/com_persist.c4
-rw-r--r--ext/com_dotnet/com_saproxy.c4
-rw-r--r--ext/com_dotnet/com_typeinfo.c4
-rw-r--r--ext/com_dotnet/com_variant.c4
-rw-r--r--ext/com_dotnet/com_wrapper.c4
-rw-r--r--ext/com_dotnet/php_com_dotnet.h4
-rw-r--r--ext/com_dotnet/php_com_dotnet_internal.h4
-rw-r--r--ext/ctype/ctype.c2
-rw-r--r--ext/ctype/php_ctype.h2
-rw-r--r--ext/ctype/tests/ctype_alnum_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_alnum_error.phpt43
-rw-r--r--ext/ctype/tests/ctype_alnum_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_alnum_variation2.phpt92
-rw-r--r--ext/ctype/tests/ctype_alnum_variation3.phpt127
-rw-r--r--ext/ctype/tests/ctype_alnum_variation4.phpt62
-rw-r--r--ext/ctype/tests/ctype_alpha_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_alpha_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_alpha_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_alpha_variation2.phpt82
-rw-r--r--ext/ctype/tests/ctype_alpha_variation3.phpt128
-rw-r--r--ext/ctype/tests/ctype_alpha_variation4.phpt62
-rw-r--r--ext/ctype/tests/ctype_cntrl_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_cntrl_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation1.phpt178
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation2.phpt63
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation3.phpt156
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation4.phpt61
-rw-r--r--ext/ctype/tests/ctype_digit_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_digit_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_digit_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_digit_variation2.phpt40
-rw-r--r--ext/ctype/tests/ctype_digit_variation3.phpt158
-rw-r--r--ext/ctype/tests/ctype_digit_variation4.phpt62
-rw-r--r--ext/ctype/tests/ctype_graph_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_graph_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_graph_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_graph_variation2.phpt124
-rw-r--r--ext/ctype/tests/ctype_graph_variation3.phpt146
-rw-r--r--ext/ctype/tests/ctype_graph_variation4.phpt62
-rw-r--r--ext/ctype/tests/ctype_lower_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_lower_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_lower_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_lower_variation2.phpt56
-rw-r--r--ext/ctype/tests/ctype_lower_variation3.phpt138
-rw-r--r--ext/ctype/tests/ctype_lower_variation4.phpt62
-rw-r--r--ext/ctype/tests/ctype_print_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_print_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_print_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_print_variation2.phpt125
-rw-r--r--ext/ctype/tests/ctype_print_variation3.phpt126
-rw-r--r--ext/ctype/tests/ctype_print_variation4.phpt61
-rw-r--r--ext/ctype/tests/ctype_punct_basic.phpt28
-rw-r--r--ext/ctype/tests/ctype_punct_error.phpt44
-rw-r--r--ext/ctype/tests/ctype_punct_variation1.phpt178
-rw-r--r--ext/ctype/tests/ctype_punct_variation2.phpt63
-rw-r--r--ext/ctype/tests/ctype_punct_variation3.phpt138
-rw-r--r--ext/ctype/tests/ctype_punct_variation4.phpt63
-rw-r--r--ext/ctype/tests/ctype_space_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_space_error.phpt43
-rw-r--r--ext/ctype/tests/ctype_space_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_space_variation2.phpt35
-rw-r--r--ext/ctype/tests/ctype_space_variation3.phpt138
-rw-r--r--ext/ctype/tests/ctype_space_variation4.phpt69
-rw-r--r--ext/ctype/tests/ctype_upper_basic.phpt27
-rw-r--r--ext/ctype/tests/ctype_upper_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_upper_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_upper_variation2.phpt55
-rw-r--r--ext/ctype/tests/ctype_upper_variation3.phpt137
-rw-r--r--ext/ctype/tests/ctype_upper_variation4.phpt61
-rw-r--r--ext/ctype/tests/ctype_xdigit_basic.phpt26
-rw-r--r--ext/ctype/tests/ctype_xdigit_error.phpt39
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation1.phpt177
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation2.phpt52
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation3.phpt138
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation4.phpt81
-rw-r--r--ext/curl/interface.c22
-rw-r--r--ext/curl/multi.c14
-rw-r--r--ext/curl/php_curl.h4
-rw-r--r--ext/curl/streams.c4
-rw-r--r--ext/date/lib/astro.c4
-rw-r--r--ext/date/lib/dow.c10
-rw-r--r--ext/date/lib/parse_date.c6
-rw-r--r--ext/date/lib/parse_date.c.orig6
-rw-r--r--ext/date/lib/parse_date.re4
-rw-r--r--ext/date/lib/parse_tz.c4
-rw-r--r--ext/date/lib/timelib.c4
-rw-r--r--ext/date/lib/timelib.h7
-rw-r--r--ext/date/lib/timelib_structs.h4
-rw-r--r--ext/date/lib/timezonedb.h1803
-rw-r--r--ext/date/lib/tm2unixtime.c6
-rw-r--r--ext/date/lib/unixtime2tm.c4
-rw-r--r--ext/date/php_date.c240
-rw-r--r--ext/date/php_date.h4
-rw-r--r--ext/date/tests/bug40743.phpt40
-rw-r--r--ext/date/tests/bug41523-64bit.phpt47
-rw-r--r--ext/date/tests/bug41523.phpt4
-rw-r--r--ext/date/tests/bug41599.phpt27
-rw-r--r--ext/date/tests/bug42910.phpt30
-rw-r--r--ext/date/tests/bug43003.phpt27
-rw-r--r--ext/date/tests/bug43527.phpt10
-rw-r--r--ext/date/tests/bug43808.phpt14
-rw-r--r--ext/date/tests/bug44742.phpt36
-rw-r--r--ext/date/tests/mktime-3-64bit.phpt56
-rw-r--r--ext/date/tests/mktime-3.phpt4
-rw-r--r--ext/date/tests/oo_002.phpt2
-rw-r--r--ext/date/tests/strtotime-mysql-64bit.phpt28
-rwxr-xr-xext/date/tests/strtotime-mysql.phpt4
-rw-r--r--ext/date/tests/strtotime3-64bit.phpt71
-rw-r--r--ext/date/tests/strtotime3.phpt4
-rw-r--r--ext/date/tests/timestamp-in-dst.phpt11
-rw-r--r--ext/dba/config.m411
-rw-r--r--ext/dba/dba.c4
-rw-r--r--ext/dba/dba_cdb.c4
-rwxr-xr-xext/dba/dba_db1.c4
-rw-r--r--ext/dba/dba_db2.c4
-rw-r--r--ext/dba/dba_db3.c4
-rw-r--r--ext/dba/dba_db4.c4
-rw-r--r--ext/dba/dba_dbm.c4
-rw-r--r--ext/dba/dba_flatfile.c4
-rw-r--r--ext/dba/dba_gdbm.c4
-rw-r--r--ext/dba/dba_inifile.c4
-rw-r--r--ext/dba/dba_ndbm.c4
-rwxr-xr-xext/dba/dba_qdbm.c4
-rw-r--r--ext/dba/libcdb/cdb.c6
-rw-r--r--ext/dba/libcdb/cdb.h4
-rw-r--r--ext/dba/libcdb/cdb_make.c6
-rw-r--r--ext/dba/libcdb/cdb_make.h4
-rw-r--r--ext/dba/libcdb/uint32.c4
-rw-r--r--ext/dba/libcdb/uint32.h4
-rw-r--r--ext/dba/libflatfile/flatfile.c6
-rw-r--r--ext/dba/libflatfile/flatfile.h4
-rw-r--r--ext/dba/libinifile/inifile.c6
-rw-r--r--ext/dba/libinifile/inifile.h4
-rw-r--r--ext/dba/php_dba.h4
-rw-r--r--ext/dbase/dbase.c4
-rw-r--r--ext/dbase/dbf_head.c9
-rw-r--r--ext/dbase/php_dbase.h4
-rw-r--r--ext/dom/attr.c20
-rw-r--r--ext/dom/cdatasection.c13
-rw-r--r--ext/dom/characterdata.c46
-rw-r--r--ext/dom/comment.c13
-rw-r--r--ext/dom/document.c250
-rw-r--r--ext/dom/documentfragment.c19
-rw-r--r--ext/dom/documenttype.c4
-rw-r--r--ext/dom/dom_ce.h4
-rw-r--r--ext/dom/dom_fe.h4
-rw-r--r--ext/dom/dom_iterators.c4
-rw-r--r--ext/dom/dom_properties.h4
-rw-r--r--ext/dom/domconfiguration.c29
-rw-r--r--ext/dom/domerror.c4
-rw-r--r--ext/dom/domerrorhandler.c13
-rw-r--r--ext/dom/domexception.c4
-rw-r--r--ext/dom/domimplementation.c38
-rw-r--r--ext/dom/domimplementationlist.c13
-rw-r--r--ext/dom/domimplementationsource.c20
-rw-r--r--ext/dom/domlocator.c4
-rw-r--r--ext/dom/domstringlist.c13
-rw-r--r--ext/dom/element.c153
-rw-r--r--ext/dom/entity.c4
-rw-r--r--ext/dom/entityreference.c13
-rw-r--r--ext/dom/namednodemap.c57
-rw-r--r--ext/dom/namelist.c20
-rw-r--r--ext/dom/node.c162
-rw-r--r--ext/dom/nodelist.c13
-rw-r--r--ext/dom/notation.c4
-rw-r--r--ext/dom/php_dom.c4
-rw-r--r--ext/dom/php_dom.h4
-rw-r--r--ext/dom/processinginstruction.c14
-rw-r--r--ext/dom/string_extend.c20
-rw-r--r--ext/dom/tests/bug36756.phpt2
-rw-r--r--ext/dom/tests/bug38474.phpt7
-rw-r--r--ext/dom/tests/bug43364.phpt40
-rw-r--r--ext/dom/text.c35
-rw-r--r--ext/dom/typeinfo.c4
-rw-r--r--ext/dom/userdatahandler.c4
-rw-r--r--ext/dom/xml_common.h4
-rw-r--r--ext/dom/xpath.c37
-rw-r--r--ext/exif/exif.c23
-rw-r--r--ext/exif/php_exif.h4
-rw-r--r--ext/fbsql/php_fbsql.c4
-rw-r--r--ext/fbsql/php_fbsql.h4
-rw-r--r--ext/fdf/fdf.c4
-rw-r--r--ext/fdf/php_fdf.h4
-rw-r--r--ext/filter/callback_filter.c4
-rw-r--r--ext/filter/filter.c27
-rw-r--r--ext/filter/filter_private.h4
-rw-r--r--ext/filter/logical_filters.c6
-rw-r--r--ext/filter/php_filter.h4
-rw-r--r--ext/filter/sanitizing_filters.c4
-rw-r--r--ext/filter/tests/052.phpt73
-rw-r--r--ext/filter/tests/053.phpt15
-rw-r--r--ext/filter/tests/bug44445.phpt12
-rw-r--r--ext/ftp/ftp.c4
-rw-r--r--ext/ftp/ftp.h4
-rw-r--r--ext/ftp/php_ftp.c4
-rw-r--r--ext/ftp/php_ftp.h4
-rw-r--r--ext/gd/gd.c6
-rw-r--r--ext/gd/gd_ctx.c4
-rw-r--r--ext/gd/libgd/gdft.c3
-rw-r--r--ext/gd/libgd/xbm.c4
-rw-r--r--ext/gd/php_gd.h4
-rw-r--r--ext/gd/tests/gd_info_basic.phpt29
-rw-r--r--ext/gd/tests/image_type_to_mime_type_basic.phpt64
-rw-r--r--ext/gd/tests/imagecopyresampled_basic.phpt71
-rw-r--r--ext/gd/tests/imagedashedline_basic.phpt78
-rw-r--r--ext/gd/tests/imagefilledpolygon_basic.phpt102
-rw-r--r--ext/gd/tests/imagepolygon_basic.phpt80
-rw-r--r--ext/gettext/gettext.c4
-rw-r--r--ext/gettext/php_gettext.h4
-rw-r--r--ext/gmp/gmp.c2
-rw-r--r--ext/gmp/php_gmp.h2
-rw-r--r--ext/hash/hash.c4
-rw-r--r--ext/hash/hash_adler32.c4
-rw-r--r--ext/hash/hash_crc32.c4
-rw-r--r--ext/hash/hash_gost.c4
-rw-r--r--ext/hash/hash_haval.c4
-rw-r--r--ext/hash/hash_md.c4
-rw-r--r--ext/hash/hash_ripemd.c4
-rw-r--r--ext/hash/hash_salsa.c4
-rw-r--r--ext/hash/hash_sha.c4
-rw-r--r--ext/hash/hash_snefru.c4
-rw-r--r--ext/hash/hash_tiger.c4
-rw-r--r--ext/hash/hash_whirlpool.c4
-rw-r--r--ext/hash/php_hash.h4
-rw-r--r--ext/hash/php_hash_adler32.h4
-rw-r--r--ext/hash/php_hash_crc32.h4
-rw-r--r--ext/hash/php_hash_crc32_tables.h4
-rw-r--r--ext/hash/php_hash_gost.h4
-rw-r--r--ext/hash/php_hash_haval.h4
-rw-r--r--ext/hash/php_hash_md.h4
-rw-r--r--ext/hash/php_hash_ripemd.h4
-rw-r--r--ext/hash/php_hash_salsa.h4
-rw-r--r--ext/hash/php_hash_sha.h4
-rw-r--r--ext/hash/php_hash_snefru.h4
-rw-r--r--ext/hash/php_hash_snefru_tables.h4
-rw-r--r--ext/hash/php_hash_tiger.h4
-rw-r--r--ext/hash/php_hash_tiger_tables.h4
-rw-r--r--ext/hash/php_hash_types.h4
-rw-r--r--ext/hash/php_hash_whirlpool.h4
-rw-r--r--ext/hash/php_hash_whirlpool_tables.h4
-rw-r--r--ext/iconv/iconv.c4
-rw-r--r--ext/iconv/php_iconv.h4
-rw-r--r--ext/imap/php_imap.c23
-rw-r--r--ext/imap/php_imap.h4
-rw-r--r--ext/interbase/ibase_blobs.c4
-rw-r--r--ext/interbase/ibase_events.c4
-rw-r--r--ext/interbase/ibase_query.c4
-rw-r--r--ext/interbase/ibase_service.c4
-rw-r--r--ext/interbase/interbase.c4
-rwxr-xr-xext/interbase/php_ibase_includes.h6
-rw-r--r--ext/interbase/php_ibase_udf.c4
-rw-r--r--ext/interbase/php_interbase.h4
-rw-r--r--ext/json/json.c4
-rw-r--r--ext/json/php_json.h4
-rw-r--r--ext/json/tests/005.phpt10
-rw-r--r--ext/json/tests/bug41567.phpt2
-rw-r--r--ext/ldap/ldap.c6
-rw-r--r--ext/ldap/php_ldap.h4
-rw-r--r--ext/ldap/tests/ldap_dn2ufn.phpt33
-rw-r--r--ext/ldap/tests/ldap_explode_dn.phpt94
-rw-r--r--ext/ldap/tests/skipif.inc5
-rw-r--r--ext/libxml/config.w326
-rw-r--r--ext/libxml/libxml.c27
-rw-r--r--ext/libxml/php_libxml.h4
-rw-r--r--ext/libxml/php_libxml2.def3087
-rw-r--r--ext/mbstring/libmbfl/nls/nls_hy.c2
-rw-r--r--ext/mbstring/mb_gpc.c4
-rw-r--r--ext/mbstring/mbstring.c17
-rw-r--r--ext/mbstring/mbstring.h4
-rwxr-xr-xext/mbstring/oniguruma/enc/utf16_be.c2
-rwxr-xr-xext/mbstring/oniguruma/enc/utf16_le.c2
-rwxr-xr-xext/mbstring/oniguruma/enc/utf32_be.c2
-rwxr-xr-xext/mbstring/oniguruma/enc/utf32_le.c2
-rw-r--r--ext/mbstring/oniguruma/enc/utf8.c2
-rw-r--r--ext/mbstring/oniguruma/oniguruma.h2
-rw-r--r--ext/mbstring/oniguruma/regcomp.c2
-rw-r--r--ext/mbstring/oniguruma/regenc.h2
-rw-r--r--ext/mbstring/oniguruma/regerror.c2
-rw-r--r--ext/mbstring/oniguruma/regexec.c2
-rwxr-xr-xext/mbstring/oniguruma/regext.c2
-rw-r--r--ext/mbstring/oniguruma/reggnu.c2
-rw-r--r--ext/mbstring/oniguruma/regint.h2
-rw-r--r--ext/mbstring/oniguruma/regparse.c2
-rw-r--r--ext/mbstring/oniguruma/regparse.h2
-rw-r--r--ext/mbstring/oniguruma/regposix.c2
-rw-r--r--ext/mbstring/oniguruma/regsyntax.c2
-rw-r--r--ext/mbstring/oniguruma/regversion.c4
-rw-r--r--ext/mbstring/php_mbregex.c18
-rw-r--r--ext/mbstring/php_mbregex.h4
-rw-r--r--ext/mbstring/php_unicode.c7
-rw-r--r--ext/mbstring/php_unicode.h2
-rw-r--r--ext/mbstring/tests/bug43301.phpt20
-rw-r--r--ext/mbstring/tests/mb_convert_encoding_basic.phpt95
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_basic.phpt65
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt186
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation2.phpt224
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation3.phpt186
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation4.phpt187
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation5.phpt215
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt53
-rw-r--r--ext/mbstring/tests/mb_ereg1.phpt9
-rw-r--r--ext/mbstring/tests/mb_ereg_basic.phpt117
-rw-r--r--ext/mbstring/tests/mb_ereg_error.phpt49
-rw-r--r--ext/mbstring/tests/mb_ereg_variation1.phpt165
-rw-r--r--ext/mbstring/tests/mb_ereg_variation2.phpt216
-rw-r--r--ext/mbstring/tests/mb_ereg_variation3.phpt163
-rw-r--r--ext/mbstring/tests/mb_ereg_variation4.phpt149
-rw-r--r--ext/mbstring/tests/mb_ereg_variation5.phpt82
-rw-r--r--ext/mbstring/tests/mb_ereg_variation6.phpt185
-rw-r--r--ext/mbstring/tests/mb_ereg_variation7.phpt94
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_basic.phpt36
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_error1.phpt36
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_error2.phpt31
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_variation1.phpt217
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_variation2.phpt374
-rw-r--r--ext/mbstring/tests/mb_regex_encoding_basic.phpt35
-rw-r--r--ext/mbstring/tests/mb_regex_encoding_error1.phpt36
-rw-r--r--ext/mbstring/tests/mb_regex_encoding_error2.phpt31
-rw-r--r--ext/mbstring/tests/mb_regex_encoding_variation1.phpt215
-rw-r--r--ext/mbstring/tests/mb_strlen_basic.phpt43
-rw-r--r--ext/mbstring/tests/mb_strlen_error1.phpt46
-rw-r--r--ext/mbstring/tests/mb_strlen_error2.phpt34
-rw-r--r--ext/mbstring/tests/mb_strlen_variation1.phpt180
-rw-r--r--ext/mbstring/tests/mb_strlen_variation2.phpt220
-rw-r--r--ext/mbstring/tests/mb_strlen_variation3.phpt445
-rw-r--r--ext/mbstring/tests/mb_strpos_basic.phpt57
-rw-r--r--ext/mbstring/tests/mb_strpos_error1.phpt50
-rw-r--r--ext/mbstring/tests/mb_strpos_error2.phpt34
-rw-r--r--ext/mbstring/tests/mb_strpos_variation1.phpt182
-rw-r--r--ext/mbstring/tests/mb_strpos_variation2.phpt198
-rw-r--r--ext/mbstring/tests/mb_strpos_variation3.phpt202
-rw-r--r--ext/mbstring/tests/mb_strpos_variation4.phpt222
-rw-r--r--ext/mbstring/tests/mb_strrpos_basic.phpt58
-rw-r--r--ext/mbstring/tests/mb_strrpos_error1.phpt50
-rw-r--r--ext/mbstring/tests/mb_strrpos_error2.phpt35
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation1.phpt181
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation2.phpt183
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation3.phpt153
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation4.phpt222
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation5.phpt61
-rw-r--r--ext/mbstring/tests/mb_strtolower_basic.phpt58
-rw-r--r--ext/mbstring/tests/mb_strtolower_error1.phpt46
-rw-r--r--ext/mbstring/tests/mb_strtolower_error2.phpt33
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation1.phpt180
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation2.phpt219
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation3.phpt57
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation4.phpt56
-rw-r--r--ext/mbstring/tests/mb_strtoupper_basic.phpt60
-rw-r--r--ext/mbstring/tests/mb_strtoupper_error1.phpt47
-rw-r--r--ext/mbstring/tests/mb_strtoupper_error2.phpt34
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation1.phpt182
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation2.phpt220
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation3.phpt58
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation4.phpt57
-rw-r--r--ext/mbstring/tests/mb_substr_basic.phpt55
-rw-r--r--ext/mbstring/tests/mb_substr_count_basic.phpt47
-rw-r--r--ext/mbstring/tests/mb_substr_count_error1.phpt49
-rw-r--r--ext/mbstring/tests/mb_substr_count_error2.phpt37
-rw-r--r--ext/mbstring/tests/mb_substr_count_variation1.phpt183
-rw-r--r--ext/mbstring/tests/mb_substr_count_variation2.phpt197
-rw-r--r--ext/mbstring/tests/mb_substr_count_variation3.phpt220
-rw-r--r--ext/mbstring/tests/mb_substr_error1.phpt49
-rw-r--r--ext/mbstring/tests/mb_substr_error2.phpt35
-rw-r--r--ext/mbstring/tests/mb_substr_variation1.phpt179
-rw-r--r--ext/mbstring/tests/mb_substr_variation2.phpt220
-rw-r--r--ext/mbstring/tests/mb_substr_variation3.phpt445
-rw-r--r--ext/mbstring/tests/mb_substr_variation4.phpt131
-rw-r--r--ext/mbstring/tests/mb_substr_variation5.phpt134
-rw-r--r--ext/mcrypt/mcrypt.c4
-rw-r--r--ext/mcrypt/php_mcrypt.h4
-rw-r--r--ext/mhash/mhash.c4
-rw-r--r--ext/mhash/php_mhash.h4
-rw-r--r--ext/mime_magic/mime_magic.c4
-rw-r--r--ext/mime_magic/php_mime_magic.h4
-rw-r--r--ext/mime_magic/phpmimemagic.h4
-rw-r--r--ext/ming/ming.c4
-rw-r--r--ext/ming/php_ming.h4
-rw-r--r--ext/msql/php_msql.c4
-rw-r--r--ext/msql/php_msql.h4
-rw-r--r--ext/mssql/php_mssql.c4
-rw-r--r--ext/mssql/php_mssql.h4
-rw-r--r--ext/mysql/php_mysql.c123
-rw-r--r--ext/mysql/php_mysql.h4
-rw-r--r--ext/mysql/php_mysql_structs.h4
-rwxr-xr-xext/mysql/tests/001.phpt2
-rw-r--r--ext/mysqli/mysqli.c14
-rw-r--r--ext/mysqli/mysqli_api.c7
-rw-r--r--ext/mysqli/mysqli_driver.c2
-rw-r--r--ext/mysqli/mysqli_embedded.c2
-rw-r--r--ext/mysqli/mysqli_exception.c2
-rw-r--r--ext/mysqli/mysqli_fe.c4
-rw-r--r--ext/mysqli/mysqli_nonapi.c4
-rw-r--r--ext/mysqli/mysqli_prop.c4
-rw-r--r--ext/mysqli/mysqli_repl.c4
-rw-r--r--ext/mysqli/mysqli_report.c4
-rw-r--r--ext/mysqli/mysqli_report.h4
-rw-r--r--ext/mysqli/mysqli_warning.c2
-rw-r--r--ext/mysqli/php_mysqli.h4
-rw-r--r--ext/mysqli/tests/047.phpt26
-rw-r--r--ext/mysqli/tests/bug42548.phpt53
-rw-r--r--ext/ncurses/ncurses.c2
-rw-r--r--ext/ncurses/ncurses_fe.c2
-rw-r--r--ext/ncurses/ncurses_functions.c2
-rw-r--r--ext/ncurses/php_ncurses.h2
-rw-r--r--ext/ncurses/php_ncurses_fe.h2
-rw-r--r--ext/oci8/config.m419
-rw-r--r--ext/oci8/oci8.c17
-rw-r--r--ext/oci8/oci8_collection.c14
-rw-r--r--ext/oci8/oci8_interface.c11
-rw-r--r--ext/oci8/oci8_lob.c34
-rw-r--r--ext/oci8/oci8_statement.c22
-rw-r--r--ext/oci8/php_oci8.h4
-rw-r--r--ext/oci8/php_oci8_int.h8
-rw-r--r--ext/oci8/tests/bug27303.phpt382
-rw-r--r--ext/oci8/tests/bug27303_2.phpt202
-rw-r--r--ext/oci8/tests/bug27303_4.phpt382
-rw-r--r--ext/oci8/tests/bug42496_1.phpt61
-rw-r--r--ext/oci8/tests/bug42496_2.phpt59
-rw-r--r--ext/oci8/tests/bug42841.phpt187
-rw-r--r--ext/oci8/tests/bug43492.phpt378
-rw-r--r--ext/oci8/tests/bug43492_2.phpt369
-rw-r--r--ext/oci8/tests/bug43497.phpt294
-rw-r--r--ext/oci8/tests/bug44008.phpt54
-rw-r--r--ext/oci8/tests/bug44113.phpt53
-rw-r--r--ext/oci8/tests/bug44206.phpt41
-rw-r--r--ext/oci8/tests/bug6109.phpt46
-rw-r--r--ext/oci8/tests/lob_014.phpt4
-rw-r--r--ext/oci8/tests/lob_021.phpt6
-rw-r--r--ext/oci8/tests/lob_039.phpt4
-rw-r--r--ext/oci8/tests/lob_041.phpt92
-rw-r--r--ext/oci8/tests/lob_042.phpt71
-rw-r--r--ext/odbc/birdstep.c4
-rw-r--r--ext/odbc/php_birdstep.h4
-rw-r--r--ext/odbc/php_odbc.c4
-rw-r--r--ext/odbc/php_odbc.h4
-rw-r--r--ext/odbc/php_odbc_includes.h4
-rw-r--r--ext/openssl/openssl.c8
-rw-r--r--ext/openssl/php_openssl.h4
-rw-r--r--ext/openssl/xp_ssl.c8
-rwxr-xr-xext/pcntl/pcntl.c6
-rw-r--r--ext/pcntl/php_pcntl.h4
-rw-r--r--ext/pcntl/php_signal.c4
-rw-r--r--ext/pcntl/php_signal.h4
-rw-r--r--ext/pcre/pcrelib/AUTHORS4
-rw-r--r--ext/pcre/pcrelib/ChangeLog260
-rw-r--r--ext/pcre/pcrelib/LICENCE4
-rw-r--r--ext/pcre/pcrelib/NEWS27
-rw-r--r--ext/pcre/pcrelib/NON-UNIX-USE177
-rw-r--r--ext/pcre/pcrelib/README56
-rw-r--r--ext/pcre/pcrelib/config.h63
-rw-r--r--ext/pcre/pcrelib/dftables.c6
-rw-r--r--ext/pcre/pcrelib/doc/pcre.txt1543
-rw-r--r--ext/pcre/pcrelib/pcre.h11
-rw-r--r--ext/pcre/pcrelib/pcre_chartables.c2
-rw-r--r--ext/pcre/pcrelib/pcre_compile.c509
-rw-r--r--ext/pcre/pcrelib/pcre_config.c12
-rw-r--r--ext/pcre/pcrelib/pcre_exec.c99
-rw-r--r--ext/pcre/pcrelib/pcre_fullinfo.c18
-rw-r--r--ext/pcre/pcrelib/pcre_get.c6
-rw-r--r--ext/pcre/pcrelib/pcre_globals.c4
-rw-r--r--ext/pcre/pcrelib/pcre_info.c8
-rw-r--r--ext/pcre/pcrelib/pcre_internal.h60
-rw-r--r--ext/pcre/pcrelib/pcre_maketables.c4
-rw-r--r--ext/pcre/pcrelib/pcre_newline.c4
-rw-r--r--ext/pcre/pcrelib/pcre_ord2utf8.c4
-rw-r--r--ext/pcre/pcrelib/pcre_printint.src4
-rw-r--r--ext/pcre/pcrelib/pcre_refcount.c4
-rw-r--r--ext/pcre/pcrelib/pcre_study.c7
-rw-r--r--ext/pcre/pcrelib/pcre_tables.c331
-rw-r--r--ext/pcre/pcrelib/pcre_try_flipped.c5
-rw-r--r--ext/pcre/pcrelib/pcre_ucp_searchfuncs.c4
-rw-r--r--ext/pcre/pcrelib/pcre_valid_utf8.c6
-rw-r--r--ext/pcre/pcrelib/pcre_version.c4
-rw-r--r--ext/pcre/pcrelib/pcre_xclass.c4
-rw-r--r--ext/pcre/pcrelib/pcredemo.c21
-rw-r--r--ext/pcre/pcrelib/pcregrep.c300
-rw-r--r--ext/pcre/pcrelib/pcreposix.c11
-rw-r--r--ext/pcre/pcrelib/pcreposix.h2
-rw-r--r--ext/pcre/pcrelib/testdata/grepoutput17
-rw-r--r--ext/pcre/pcrelib/testdata/testinput116
-rw-r--r--ext/pcre/pcrelib/testdata/testinput2161
-rw-r--r--ext/pcre/pcrelib/testdata/testinput474
-rw-r--r--ext/pcre/pcrelib/testdata/testinput552
-rw-r--r--ext/pcre/pcrelib/testdata/testinput675
-rw-r--r--ext/pcre/pcrelib/testdata/testinput765
-rw-r--r--ext/pcre/pcrelib/testdata/testinput844
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput124
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput2377
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput4133
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput5108
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput6157
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput7134
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput888
-rw-r--r--ext/pcre/pcrelib/ucptable.h50
-rw-r--r--ext/pcre/php_pcre.c12
-rw-r--r--ext/pcre/php_pcre.h4
-rw-r--r--ext/pcre/tests/bug42945.phpt88
-rw-r--r--ext/pcre/tests/bug44191.phpt16
-rw-r--r--ext/pcre/tests/preg_grep_basic.phpt62
-rw-r--r--ext/pcre/tests/preg_grep_error.phpt43
-rw-r--r--ext/pcre/tests/preg_grep_error1.phpt68
-rw-r--r--ext/pcre/tests/preg_grep_error2.phpt42
-rw-r--r--ext/pcre/tests/preg_match_all_basic.phpt82
-rw-r--r--ext/pcre/tests/preg_match_all_error.phpt45
-rw-r--r--ext/pcre/tests/preg_match_all_error1.phpt81
-rw-r--r--ext/pcre/tests/preg_match_all_error2.phpt54
-rw-r--r--ext/pcre/tests/preg_match_all_error3.phpt20
-rw-r--r--ext/pcre/tests/preg_match_basic.phpt52
-rw-r--r--ext/pcre/tests/preg_match_error.phpt44
-rw-r--r--ext/pcre/tests/preg_match_error1.phpt61
-rw-r--r--ext/pcre/tests/preg_match_error2.phpt38
-rw-r--r--ext/pcre/tests/preg_quote_basic.phpt25
-rw-r--r--ext/pcre/tests/preg_quote_error.phpt33
-rw-r--r--ext/pcre/tests/preg_quote_error1.phpt36
-rw-r--r--ext/pcre/tests/preg_replace_basic.phpt25
-rw-r--r--ext/pcre/tests/preg_replace_callback_basic.phpt33
-rw-r--r--ext/pcre/tests/preg_replace_callback_error.phpt48
-rw-r--r--ext/pcre/tests/preg_replace_error.phpt45
-rw-r--r--ext/pcre/tests/preg_replace_error1.phpt59
-rw-r--r--ext/pcre/tests/preg_replace_error2.phpt37
-rw-r--r--ext/pcre/tests/preg_replace_variation1.phpt17
-rw-r--r--ext/pcre/tests/preg_split_basic.phpt76
-rw-r--r--ext/pcre/tests/preg_split_error.phpt44
-rw-r--r--ext/pcre/tests/preg_split_error1.phpt67
-rw-r--r--ext/pcre/tests/preg_split_error2.phpt34
-rw-r--r--ext/pcre/upgrade-pcre.php6
-rwxr-xr-xext/pdo/pdo.c4
-rwxr-xr-xext/pdo/pdo_dbh.c38
-rw-r--r--ext/pdo/pdo_sql_parser.c8
-rw-r--r--ext/pdo/pdo_sql_parser.c.orig22
-rw-r--r--ext/pdo/pdo_sql_parser.re6
-rw-r--r--ext/pdo/pdo_sqlstate.c4
-rwxr-xr-xext/pdo/pdo_stmt.c31
-rwxr-xr-xext/pdo/php_pdo.h4
-rwxr-xr-xext/pdo/php_pdo_driver.h6
-rwxr-xr-xext/pdo/php_pdo_int.h4
-rw-r--r--ext/pdo/tests/bug_43130.phpt8
-rw-r--r--ext/pdo/tests/bug_43663.phpt22
-rw-r--r--ext/pdo/tests/bug_44159.phpt37
-rw-r--r--ext/pdo_dblib/dblib_driver.c4
-rw-r--r--ext/pdo_dblib/dblib_stmt.c4
-rw-r--r--ext/pdo_dblib/pdo_dblib.c4
-rw-r--r--ext/pdo_dblib/php_pdo_dblib.h4
-rw-r--r--ext/pdo_dblib/php_pdo_dblib_int.h4
-rw-r--r--ext/pdo_firebird/firebird_driver.c4
-rw-r--r--ext/pdo_firebird/firebird_statement.c4
-rw-r--r--ext/pdo_firebird/pdo_firebird.c4
-rw-r--r--ext/pdo_firebird/php_pdo_firebird.h4
-rw-r--r--ext/pdo_firebird/php_pdo_firebird_int.h4
-rwxr-xr-xext/pdo_mysql/mysql_driver.c4
-rwxr-xr-xext/pdo_mysql/mysql_statement.c4
-rwxr-xr-xext/pdo_mysql/pdo_mysql.c4
-rwxr-xr-xext/pdo_mysql/php_pdo_mysql.h4
-rwxr-xr-xext/pdo_mysql/php_pdo_mysql_int.h4
-rwxr-xr-xext/pdo_oci/oci_driver.c9
-rwxr-xr-xext/pdo_oci/oci_statement.c4
-rwxr-xr-xext/pdo_oci/pdo_oci.c4
-rwxr-xr-xext/pdo_oci/php_pdo_oci.h4
-rwxr-xr-xext/pdo_oci/php_pdo_oci_int.h4
-rwxr-xr-xext/pdo_odbc/odbc_driver.c4
-rwxr-xr-xext/pdo_odbc/odbc_stmt.c4
-rwxr-xr-xext/pdo_odbc/pdo_odbc.c4
-rw-r--r--ext/pdo_odbc/php_pdo_odbc.h4
-rwxr-xr-xext/pdo_odbc/php_pdo_odbc_int.h4
-rw-r--r--ext/pdo_pgsql/pdo_pgsql.c6
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c12
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c14
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql.h4
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql_int.h4
-rw-r--r--ext/pdo_pgsql/tests/bug36727.phpt5
-rw-r--r--ext/pdo_sqlite/pdo_sqlite.c6
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite.h4
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite_int.h4
-rw-r--r--ext/pdo_sqlite/sqlite/VERSION2
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c4
-rw-r--r--ext/pdo_sqlite/sqlite_statement.c4
-rw-r--r--ext/pgsql/pgsql.c8
-rw-r--r--ext/pgsql/php_pgsql.h4
-rw-r--r--ext/posix/php_posix.h4
-rw-r--r--ext/posix/posix.c12
-rw-r--r--ext/posix/tests/posix_get_last_error_error.phpt31
-rw-r--r--ext/posix/tests/posix_getgid_error.phpt31
-rw-r--r--ext/posix/tests/posix_getgrgid_error.phpt53
-rw-r--r--ext/posix/tests/posix_getgrgid_variation.phpt175
-rw-r--r--ext/posix/tests/posix_getpgid_error.phpt48
-rw-r--r--ext/posix/tests/posix_getpgid_variation.phpt175
-rw-r--r--ext/posix/tests/posix_getpgrp_error.phpt31
-rw-r--r--ext/posix/tests/posix_getpid_error.phpt31
-rw-r--r--ext/posix/tests/posix_getppid_error.phpt31
-rw-r--r--ext/posix/tests/posix_getpwuid_error.phpt46
-rw-r--r--ext/posix/tests/posix_getpwuid_variation.phpt175
-rw-r--r--ext/posix/tests/posix_getuid_error.phpt31
-rw-r--r--ext/posix/tests/posix_kill_error.phpt59
-rw-r--r--ext/posix/tests/posix_kill_variation1.phpt173
-rw-r--r--ext/posix/tests/posix_kill_variation2.phpt173
-rw-r--r--ext/posix/tests/posix_strerror_error.phpt46
-rw-r--r--ext/posix/tests/posix_strerror_variation1.phpt172
-rw-r--r--ext/posix/tests/posix_times_error.phpt31
-rw-r--r--ext/posix/tests/posix_uname_error.phpt31
-rw-r--r--ext/pspell/php_pspell.h4
-rw-r--r--ext/pspell/pspell.c4
-rw-r--r--ext/readline/php_readline.h4
-rw-r--r--ext/readline/readline.c4
-rw-r--r--ext/recode/php_recode.h4
-rw-r--r--ext/recode/recode.c6
-rw-r--r--ext/reflection/php_reflection.c19
-rw-r--r--ext/reflection/php_reflection.h4
-rw-r--r--ext/reflection/tests/ReflectionMethod_basic1.phpt300
-rw-r--r--ext/reflection/tests/ReflectionMethod_basic2.phpt188
-rw-r--r--ext/reflection/tests/ReflectionMethod_basic3.phpt169
-rw-r--r--ext/reflection/tests/ReflectionMethod_basic4.phpt172
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_basic.phpt121
-rw-r--r--ext/reflection/tests/ReflectionMethod_getDeclaringClass_basic.phpt32
-rw-r--r--ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt115
-rw-r--r--ext/reflection/tests/ReflectionMethod_getDocComment_error.phpt19
-rw-r--r--ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt244
-rw-r--r--ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt65
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_basic.phpt75
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error1.phpt38
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt29
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt119
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_basic.phpt110
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_error1.phpt73
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_error2.phpt34
-rw-r--r--ext/reflection/tests/ReflectionMethod_returnsReference_basic.phpt25
-rw-r--r--ext/reflection/tests/reflectionProperty_basic1.phpt162
-rw-r--r--ext/reflection/tests/reflectionProperty_basic2.phpt105
-rw-r--r--ext/reflection/tests/reflectionProperty_constructor_error.phpt46
-rw-r--r--ext/reflection/tests/reflectionProperty_error.phpt70
-rw-r--r--ext/reflection/tests/reflectionProperty_export_basic.phpt18
-rw-r--r--ext/reflection/tests/reflectionProperty_export_error.phpt56
-rw-r--r--ext/reflection/tests/reflectionProperty_getDeclaringClass_variation1.phpt29
-rw-r--r--ext/reflection/tests/reflectionProperty_getDocComment_basic.phpt102
-rw-r--r--ext/reflection/tests/reflectionProperty_getDocComment_error.phpt31
-rw-r--r--ext/reflection/tests/reflectionProperty_getModifiers_basic.phpt48
-rw-r--r--ext/reflection/tests/reflectionProperty_getValue_error.phpt83
-rw-r--r--ext/reflection/tests/reflectionProperty_isDefault_basic.phpt65
-rw-r--r--ext/reflection/tests/reflectionProperty_setValue_error.phpt102
-rw-r--r--ext/session/mod_files.c4
-rw-r--r--ext/session/mod_files.h4
-rw-r--r--ext/session/mod_mm.c4
-rw-r--r--ext/session/mod_mm.h4
-rw-r--r--ext/session/mod_user.c4
-rw-r--r--ext/session/mod_user.h4
-rw-r--r--ext/session/php_session.h4
-rw-r--r--ext/session/session.c251
-rw-r--r--ext/session/tests/023.phpt46
-rw-r--r--ext/session/tests/024.phpt114
-rw-r--r--ext/session/tests/025.phpt159
-rw-r--r--ext/session/tests/026.phpt71
-rw-r--r--ext/session/tests/027.phpt55
-rw-r--r--ext/session/tests/028.phpt16
-rw-r--r--ext/session/tests/029.phpt17
-rw-r--r--ext/session/tests/030.phpt24
-rw-r--r--ext/session/tests/save_handler.inc63
-rw-r--r--ext/session/tests/session_cache_expire_basic.phpt39
-rw-r--r--ext/session/tests/session_cache_expire_error.phpt170
-rw-r--r--ext/session/tests/session_cache_expire_variation1.phpt41
-rw-r--r--ext/session/tests/session_cache_expire_variation2.phpt41
-rw-r--r--ext/session/tests/session_cache_expire_variation3.phpt47
-rw-r--r--ext/session/tests/session_cache_limiter_basic.phpt68
-rw-r--r--ext/session/tests/session_cache_limiter_error.phpt170
-rw-r--r--ext/session/tests/session_cache_limiter_variation1.phpt41
-rw-r--r--ext/session/tests/session_cache_limiter_variation2.phpt40
-rw-r--r--ext/session/tests/session_cache_limiter_variation3.phpt39
-rw-r--r--ext/session/tests/session_commit_basic.phpt45
-rw-r--r--ext/session/tests/session_commit_error.phpt170
-rw-r--r--ext/session/tests/session_commit_variation1.phpt41
-rw-r--r--ext/session/tests/session_commit_variation2.phpt59
-rw-r--r--ext/session/tests/session_commit_variation3.phpt39
-rw-r--r--ext/session/tests/session_commit_variation4.phpt55
-rw-r--r--ext/session/tests/session_decode_basic.phpt273
-rw-r--r--ext/session/tests/session_decode_error.phpt222
-rw-r--r--ext/session/tests/session_decode_error2.phpt615
-rw-r--r--ext/session/tests/session_decode_variation1.phpt189
-rw-r--r--ext/session/tests/session_decode_variation2.phpt78
-rw-r--r--ext/session/tests/session_decode_variation3.phpt62
-rw-r--r--ext/session/tests/session_decode_variation4.phpt56
-rw-r--r--ext/session/tests/session_destroy_error.phpt218
-rw-r--r--ext/session/tests/session_destroy_variation1.phpt45
-rw-r--r--ext/session/tests/session_destroy_variation2.phpt45
-rw-r--r--ext/session/tests/session_destroy_variation3.phpt41
-rw-r--r--ext/session/tests/session_encode_basic.phpt174
-rw-r--r--ext/session/tests/session_encode_error.phpt220
-rw-r--r--ext/session/tests/session_encode_error2.phpt251
-rw-r--r--ext/session/tests/session_encode_variation1.phpt47
-rw-r--r--ext/session/tests/session_encode_variation2.phpt35
-rw-r--r--ext/session/tests/session_encode_variation3.phpt34
-rw-r--r--ext/session/tests/session_encode_variation4.phpt36
-rw-r--r--ext/session/tests/session_encode_variation5.phpt36
-rw-r--r--ext/session/tests/session_encode_variation6.phpt52
-rw-r--r--ext/session/tests/session_encode_variation7.phpt35
-rw-r--r--ext/session/tests/session_encode_variation8.phpt39
-rw-r--r--ext/session/tests/session_get_cookie_params_basic.phpt68
-rw-r--r--ext/session/tests/session_get_cookie_params_error.phpt217
-rw-r--r--ext/session/tests/session_get_cookie_params_variation1.phpt108
-rw-r--r--ext/session/tests/session_id_basic.phpt43
-rw-r--r--ext/session/tests/session_id_error.phpt170
-rw-r--r--ext/session/tests/session_id_error2.phpt41
-rw-r--r--ext/session/tests/session_id_error3.phpt79
-rw-r--r--ext/session/tests/session_id_error4.phpt33
-rw-r--r--ext/session/tests/session_id_variation1.phpt46
-rw-r--r--ext/session/tests/session_id_variation2.phpt57
-rw-r--r--ext/session/tests/session_is_registered_basic.phpt269
-rw-r--r--ext/session/tests/session_is_registered_variation1.phpt108
-rw-r--r--ext/session/tests/session_is_registered_variation2.phpt60
-rw-r--r--ext/session/tests/session_is_registered_variation3.phpt59
-rw-r--r--ext/session/tests/session_module_name_basic.phpt35
-rw-r--r--ext/session/tests/session_module_name_error.phpt216
-rw-r--r--ext/session/tests/session_module_name_variation1.phpt35
-rw-r--r--ext/session/tests/session_module_name_variation2.phpt34
-rw-r--r--ext/session/tests/session_module_name_variation3.phpt49
-rw-r--r--ext/session/tests/session_module_name_variation4.phpt67
-rw-r--r--ext/session/tests/session_name_basic.phpt40
-rw-r--r--ext/session/tests/session_name_error.phpt172
-rw-r--r--ext/session/tests/session_name_variation1.phpt60
-rw-r--r--ext/session/tests/session_name_variation2.phpt39
-rw-r--r--ext/session/tests/session_regenerate_id_basic.phpt43
-rw-r--r--ext/session/tests/session_regenerate_id_error.phpt174
-rw-r--r--ext/session/tests/session_regenerate_id_variation1.phpt43
-rw-r--r--ext/session/tests/session_register_basic.phpt317
-rw-r--r--ext/session/tests/session_register_variation1.phpt158
-rw-r--r--ext/session/tests/session_register_variation2.phpt40
-rw-r--r--ext/session/tests/session_register_variation3.phpt45
-rw-r--r--ext/session/tests/session_register_variation4.phpt46
-rw-r--r--ext/session/tests/session_save_path_basic.phpt36
-rw-r--r--ext/session/tests/session_save_path_error.phpt176
-rw-r--r--ext/session/tests/session_save_path_variation1.phpt44
-rw-r--r--ext/session/tests/session_save_path_variation2.phpt40
-rw-r--r--ext/session/tests/session_save_path_variation3.phpt40
-rw-r--r--ext/session/tests/session_save_path_variation4.phpt63
-rw-r--r--ext/session/tests/session_save_path_variation5.phpt65
-rw-r--r--ext/session/tests/session_set_cookie_params_basic.phpt35
-rw-r--r--ext/session/tests/session_set_cookie_params_error.phpt298
-rw-r--r--ext/session/tests/session_set_cookie_params_variation1.phpt49
-rw-r--r--ext/session/tests/session_set_cookie_params_variation2.phpt49
-rw-r--r--ext/session/tests/session_set_cookie_params_variation3.phpt49
-rw-r--r--ext/session/tests/session_set_cookie_params_variation4.phpt49
-rw-r--r--ext/session/tests/session_set_cookie_params_variation5.phpt49
-rw-r--r--ext/session/tests/session_set_save_handler_basic.phpt95
-rw-r--r--ext/session/tests/session_set_save_handler_error.phpt218
-rw-r--r--ext/session/tests/session_set_save_handler_error2.phpt62
-rw-r--r--ext/session/tests/session_set_save_handler_error3.phpt43
-rw-r--r--ext/session/tests/session_set_save_handler_error4.phpt42
-rw-r--r--ext/session/tests/session_set_save_handler_variation1.phpt40
-rw-r--r--ext/session/tests/session_set_save_handler_variation2.phpt33
-rw-r--r--ext/session/tests/session_set_save_handler_variation3.phpt33
-rw-r--r--ext/session/tests/session_set_save_handler_variation4.phpt83
-rw-r--r--ext/session/tests/session_start_error.phpt195
-rw-r--r--ext/session/tests/session_start_variation1.phpt44
-rw-r--r--ext/session/tests/session_start_variation2.phpt45
-rw-r--r--ext/session/tests/session_start_variation3.phpt49
-rw-r--r--ext/session/tests/session_start_variation4.phpt37
-rw-r--r--ext/session/tests/session_start_variation5.phpt58
-rw-r--r--ext/session/tests/session_start_variation6.phpt69
-rw-r--r--ext/session/tests/session_start_variation7.phpt61
-rw-r--r--ext/session/tests/session_start_variation8.phpt35
-rw-r--r--ext/session/tests/session_start_variation9.phpt39
-rw-r--r--ext/session/tests/session_unregister_basic.phpt176
-rw-r--r--ext/session/tests/session_unregister_variation1.phpt158
-rw-r--r--ext/session/tests/session_unregister_variation2.phpt46
-rw-r--r--ext/session/tests/session_unregister_variation3.phpt47
-rw-r--r--ext/session/tests/session_unset_basic.phpt43
-rw-r--r--ext/session/tests/session_unset_error.phpt170
-rw-r--r--ext/session/tests/session_unset_variation1.phpt48
-rw-r--r--ext/session/tests/session_write_close_basic.phpt45
-rw-r--r--ext/session/tests/session_write_close_error.phpt170
-rw-r--r--ext/session/tests/session_write_close_variation1.phpt41
-rw-r--r--ext/session/tests/session_write_close_variation2.phpt59
-rw-r--r--ext/session/tests/session_write_close_variation3.phpt39
-rw-r--r--ext/session/tests/session_write_close_variation4.phpt55
-rw-r--r--ext/shmop/php_shmop.h2
-rw-r--r--ext/shmop/shmop.c4
-rw-r--r--ext/simplexml/php_simplexml.h4
-rwxr-xr-xext/simplexml/php_simplexml_exports.h4
-rw-r--r--ext/simplexml/simplexml.c31
-rw-r--r--ext/simplexml/tests/bug42369.phpt25
-rw-r--r--ext/simplexml/tests/bug43221.phpt15
-rw-r--r--ext/simplexml/tests/bug44478.phpt24
-rw-r--r--ext/snmp/php_snmp.h4
-rw-r--r--ext/snmp/snmp.c4
-rw-r--r--ext/soap/php_encoding.c4
-rw-r--r--ext/soap/php_encoding.h4
-rw-r--r--ext/soap/php_http.c6
-rw-r--r--ext/soap/php_http.h4
-rw-r--r--ext/soap/php_packet_soap.c4
-rw-r--r--ext/soap/php_packet_soap.h4
-rw-r--r--ext/soap/php_schema.c4
-rw-r--r--ext/soap/php_schema.h4
-rw-r--r--ext/soap/php_sdl.c4
-rw-r--r--ext/soap/php_sdl.h4
-rw-r--r--ext/soap/php_soap.h8
-rw-r--r--ext/soap/php_xml.c4
-rw-r--r--ext/soap/php_xml.h4
-rw-r--r--ext/soap/soap.c64
-rwxr-xr-xext/soap/tests/any.phpt1
-rw-r--r--ext/soap/tests/bugs/bug27722.phpt2
-rw-r--r--ext/soap/tests/bugs/bug27742.phpt2
-rw-r--r--ext/soap/tests/bugs/bug28985.phpt2
-rw-r--r--ext/soap/tests/bugs/bug29061.phpt2
-rw-r--r--ext/soap/tests/bugs/bug29109.phpt2
-rw-r--r--ext/soap/tests/bugs/bug29236.phpt2
-rw-r--r--ext/soap/tests/bugs/bug29795.phpt2
-rw-r--r--ext/soap/tests/bugs/bug29839.phpt2
-rw-r--r--ext/soap/tests/bugs/bug29844.phpt2
-rw-r--r--ext/soap/tests/bugs/bug30045.phpt2
-rw-r--r--ext/soap/tests/bugs/bug32776.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug34453.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug35273.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug37083.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug38004.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug38005.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug38055.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug38067.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug39815.phpt1
-rwxr-xr-xext/soap/tests/bugs/bug42692.phpt37
-rwxr-xr-xext/soap/tests/bugs/bug42692.wsdl40
-rw-r--r--ext/soap/tests/classmap001.phpt2
-rw-r--r--ext/soap/tests/classmap002.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_006w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_007w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_008w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_009w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_010w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_011w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_016w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_017w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_018w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_019w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_020w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_021w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_022w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_023w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_024w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/round2_base.inc1
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt1
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_001w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound2_001w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_003w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_003w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_emptysa_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_import1_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_import2_001w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_001w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_002w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_003w.phpt1
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_006w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/r3_groupF_ext_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/r3_groupF_extreq_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_001w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_002w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_003w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_004w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_005w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_006w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_007w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_008w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_009w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_010w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_001w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_002w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_003w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_004w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_005w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_006w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_007w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_008w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_009w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_010w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_004w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_005w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_006w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_007w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_008w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_009w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_010w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_011w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_012w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_013w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_014w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_015w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_016w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_017w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_005w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_006w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_007w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_008w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_009w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_010w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_011w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_012w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_013w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_014w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_015w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_016w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_017w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_003w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_006w.phptbin1072 -> 1099 bytes
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_007w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_008w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_009w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_010w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_011w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_012w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_013w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_014w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_015w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_016w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_017w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_018w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_019w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_020w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_021w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_022w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_023w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_024w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_025w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_026w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_027w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_028w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_029w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_030w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_031w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_032w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_033w.phpt1
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_034w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt1
-rw-r--r--ext/soap/tests/server011.phpt2
-rw-r--r--ext/soap/tests/server021.phpt2
-rwxr-xr-xext/soap/tests/server025.phpt2
-rw-r--r--ext/soap/tests/soap12/soap12-test.inc1
-rwxr-xr-xext/soap/tests/typemap001.phpt2
-rwxr-xr-xext/soap/tests/typemap002.phpt2
-rwxr-xr-xext/soap/tests/typemap003.phpt2
-rwxr-xr-xext/soap/tests/typemap004.phpt2
-rwxr-xr-xext/soap/tests/typemap005.phpt2
-rwxr-xr-xext/soap/tests/typemap006.phpt2
-rwxr-xr-xext/soap/tests/typemap007.phpt2
-rwxr-xr-xext/soap/tests/typemap008.phpt2
-rwxr-xr-xext/soap/tests/typemap009.phpt2
-rwxr-xr-xext/soap/tests/typemap010.phpt2
-rwxr-xr-xext/soap/tests/typemap011.phpt2
-rwxr-xr-xext/soap/tests/typemap012.phpt2
-rwxr-xr-xext/soap/tests/typemap013.phpt2
-rw-r--r--ext/sockets/php_sockets.h4
-rw-r--r--ext/sockets/php_sockets_win.c4
-rw-r--r--ext/sockets/php_sockets_win.h4
-rw-r--r--ext/sockets/sockets.c16
-rw-r--r--ext/sockets/unix_socket_constants.h4
-rw-r--r--ext/sockets/win32_socket_constants.h4
-rwxr-xr-xext/spl/examples/findfile.inc2
-rwxr-xr-xext/spl/examples/tree.php2
-rwxr-xr-xext/spl/internal/splobjectstorage.inc4
-rwxr-xr-xext/spl/php_spl.c4
-rwxr-xr-xext/spl/php_spl.h2
-rwxr-xr-xext/spl/spl.php334
-rwxr-xr-xext/spl/spl_array.c4
-rwxr-xr-xext/spl/spl_array.h4
-rwxr-xr-xext/spl/spl_directory.c54
-rwxr-xr-xext/spl/spl_directory.h14
-rwxr-xr-xext/spl/spl_engine.c2
-rwxr-xr-xext/spl/spl_engine.h4
-rwxr-xr-xext/spl/spl_exceptions.c4
-rwxr-xr-xext/spl/spl_exceptions.h4
-rwxr-xr-xext/spl/spl_functions.c4
-rwxr-xr-xext/spl/spl_functions.h4
-rwxr-xr-xext/spl/spl_iterators.c13
-rwxr-xr-xext/spl/spl_iterators.h8
-rwxr-xr-xext/spl/spl_observer.c4
-rwxr-xr-xext/spl/spl_observer.h4
-rwxr-xr-xext/spl/spl_sxe.c4
-rwxr-xr-xext/spl/spl_sxe.h4
-rw-r--r--ext/spl/tests/bug41828.phpt21
-rwxr-xr-xext/spl/tests/dit_002.phpt50
-rw-r--r--ext/sqlite/pdo_sqlite2.c4
-rw-r--r--ext/sqlite/php_sqlite.h4
-rw-r--r--ext/sqlite/sess_sqlite.c4
-rw-r--r--ext/sqlite/sqlite.c6
-rw-r--r--ext/standard/array.c186
-rw-r--r--ext/standard/assert.c4
-rw-r--r--ext/standard/base64.c4
-rw-r--r--ext/standard/base64.h4
-rw-r--r--ext/standard/basic_functions.c60
-rw-r--r--ext/standard/basic_functions.h4
-rw-r--r--ext/standard/browscap.c4
-rw-r--r--ext/standard/crc32.c4
-rw-r--r--ext/standard/crc32.h4
-rw-r--r--ext/standard/credits.c8
-rw-r--r--ext/standard/credits.h4
-rw-r--r--ext/standard/credits_ext.h2
-rw-r--r--ext/standard/crypt.c4
-rw-r--r--ext/standard/css.c4
-rw-r--r--ext/standard/css.h4
-rw-r--r--ext/standard/cyr_convert.c4
-rw-r--r--ext/standard/cyr_convert.h4
-rw-r--r--ext/standard/datetime.c4
-rw-r--r--ext/standard/datetime.h4
-rw-r--r--ext/standard/dir.c14
-rw-r--r--ext/standard/dl.c4
-rw-r--r--ext/standard/dl.h4
-rw-r--r--ext/standard/dns.c4
-rw-r--r--ext/standard/dns.h4
-rw-r--r--ext/standard/exec.c68
-rw-r--r--ext/standard/exec.h4
-rw-r--r--ext/standard/file.c19
-rw-r--r--ext/standard/file.h4
-rw-r--r--ext/standard/filestat.c4
-rw-r--r--ext/standard/filters.c4
-rw-r--r--ext/standard/flock_compat.c4
-rw-r--r--ext/standard/flock_compat.h4
-rw-r--r--ext/standard/formatted_print.c15
-rw-r--r--ext/standard/fsock.c4
-rw-r--r--ext/standard/fsock.h4
-rw-r--r--ext/standard/ftok.c4
-rw-r--r--ext/standard/ftp_fopen_wrapper.c14
-rw-r--r--ext/standard/head.c4
-rw-r--r--ext/standard/head.h4
-rw-r--r--ext/standard/html.c7
-rw-r--r--ext/standard/html.h4
-rw-r--r--ext/standard/http.c12
-rw-r--r--ext/standard/http_fopen_wrapper.c32
-rw-r--r--ext/standard/image.c4
-rw-r--r--ext/standard/incomplete_class.c4
-rw-r--r--ext/standard/info.c31
-rw-r--r--ext/standard/info.h4
-rw-r--r--ext/standard/iptc.c4
-rw-r--r--ext/standard/lcg.c4
-rw-r--r--ext/standard/levenshtein.c4
-rw-r--r--ext/standard/link.c4
-rw-r--r--ext/standard/mail.c4
-rw-r--r--ext/standard/math.c15
-rw-r--r--ext/standard/md5.c4
-rw-r--r--ext/standard/md5.h4
-rw-r--r--ext/standard/metaphone.c13
-rw-r--r--ext/standard/microtime.c4
-rw-r--r--ext/standard/microtime.h4
-rw-r--r--ext/standard/pack.c4
-rw-r--r--ext/standard/pack.h4
-rw-r--r--ext/standard/pageinfo.c4
-rw-r--r--ext/standard/pageinfo.h4
-rw-r--r--ext/standard/php_array.h4
-rw-r--r--ext/standard/php_assert.h4
-rw-r--r--ext/standard/php_browscap.h4
-rw-r--r--ext/standard/php_crypt.h4
-rw-r--r--ext/standard/php_dir.h4
-rw-r--r--ext/standard/php_ext_syslog.h4
-rw-r--r--ext/standard/php_filestat.h4
-rw-r--r--ext/standard/php_fopen_wrapper.c4
-rw-r--r--ext/standard/php_fopen_wrappers.h4
-rw-r--r--ext/standard/php_ftok.h4
-rw-r--r--ext/standard/php_http.h4
-rw-r--r--ext/standard/php_image.h4
-rw-r--r--ext/standard/php_incomplete_class.h4
-rw-r--r--ext/standard/php_iptc.h4
-rw-r--r--ext/standard/php_lcg.h4
-rw-r--r--ext/standard/php_link.h4
-rw-r--r--ext/standard/php_mail.h4
-rw-r--r--ext/standard/php_math.h4
-rw-r--r--ext/standard/php_metaphone.h4
-rw-r--r--ext/standard/php_rand.h8
-rw-r--r--ext/standard/php_smart_str.h4
-rw-r--r--ext/standard/php_smart_str_public.h4
-rw-r--r--ext/standard/php_standard.h4
-rw-r--r--ext/standard/php_string.h4
-rw-r--r--ext/standard/php_type.h4
-rw-r--r--ext/standard/php_uuencode.h4
-rw-r--r--ext/standard/php_var.h4
-rw-r--r--ext/standard/php_versioning.h4
-rw-r--r--ext/standard/proc_open.c6
-rw-r--r--ext/standard/proc_open.h4
-rw-r--r--ext/standard/quot_print.c4
-rw-r--r--ext/standard/quot_print.h4
-rw-r--r--ext/standard/rand.c4
-rw-r--r--ext/standard/reg.c8
-rw-r--r--ext/standard/reg.h4
-rw-r--r--ext/standard/scanf.c4
-rw-r--r--ext/standard/scanf.h4
-rw-r--r--ext/standard/sha1.c4
-rw-r--r--ext/standard/sha1.h4
-rw-r--r--ext/standard/soundex.c4
-rw-r--r--ext/standard/streamsfuncs.c9
-rw-r--r--ext/standard/streamsfuncs.h4
-rw-r--r--ext/standard/string.c183
-rw-r--r--ext/standard/syslog.c6
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation2.phpt318
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation3.phpt197
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation4.phpt138
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation5.phpt46
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation6.phpt72
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation7.phpt91
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation8.phpt128
-rw-r--r--ext/standard/tests/array/array_chunk_basic1.phpt138
-rw-r--r--ext/standard/tests/array/array_chunk_basic2.phpt222
-rw-r--r--ext/standard/tests/array/array_chunk_error.phpt46
-rw-r--r--ext/standard/tests/array/array_chunk_variation1.phpt325
-rw-r--r--ext/standard/tests/array/array_chunk_variation2.phpt427
-rw-r--r--ext/standard/tests/array/array_chunk_variation3.phpt268
-rw-r--r--ext/standard/tests/array/array_chunk_variation4.phpt120
-rw-r--r--ext/standard/tests/array/array_chunk_variation5.phpt148
-rw-r--r--ext/standard/tests/array/array_chunk_variation6.phpt135
-rw-r--r--ext/standard/tests/array/array_chunk_variation7.phpt89
-rw-r--r--ext/standard/tests/array/array_combine_basic.phpt52
-rw-r--r--ext/standard/tests/array/array_combine_error1.phpt48
-rw-r--r--ext/standard/tests/array/array_combine_error2.phpt53
-rw-r--r--ext/standard/tests/array/array_combine_variation1.phpt198
-rw-r--r--ext/standard/tests/array/array_combine_variation2.phpt198
-rw-r--r--ext/standard/tests/array/array_combine_variation3.phpt279
-rw-r--r--ext/standard/tests/array/array_combine_variation4.phpt192
-rw-r--r--ext/standard/tests/array/array_combine_variation5.phpt186
-rw-r--r--ext/standard/tests/array/array_combine_variation6.phpt53
-rw-r--r--ext/standard/tests/array/array_diff_assoc_basic.phpt90
-rw-r--r--ext/standard/tests/array/array_diff_assoc_error.phpt41
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation1.phpt234
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation10.phpt50
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation2.phpt235
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation3.phpt206
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation4.phpt177
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation5.phpt148
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation6.phpt196
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation7.phpt101
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation8.phpt49
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation9.phpt141
-rw-r--r--ext/standard/tests/array/array_diff_basic.phpt116
-rw-r--r--ext/standard/tests/array/array_diff_error.phpt40
-rw-r--r--ext/standard/tests/array/array_diff_key_basic.phpt19
-rw-r--r--ext/standard/tests/array/array_diff_key_variation1.phpt89
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_basic.phpt28
-rw-r--r--ext/standard/tests/array/array_diff_ukey_basic.phpt24
-rw-r--r--ext/standard/tests/array/array_diff_variation1.phpt208
-rw-r--r--ext/standard/tests/array/array_diff_variation10.phpt44
-rw-r--r--ext/standard/tests/array/array_diff_variation2.phpt207
-rw-r--r--ext/standard/tests/array/array_diff_variation3.phpt190
-rw-r--r--ext/standard/tests/array/array_diff_variation4.phpt184
-rw-r--r--ext/standard/tests/array/array_diff_variation5.phpt119
-rw-r--r--ext/standard/tests/array/array_diff_variation6.phpt46
-rw-r--r--ext/standard/tests/array/array_diff_variation7.phpt95
-rw-r--r--ext/standard/tests/array/array_diff_variation8.phpt207
-rw-r--r--ext/standard/tests/array/array_diff_variation9.phpt100
-rw-r--r--ext/standard/tests/array/array_intersect_key_basic.phpt19
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_basic.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_basic.phpt24
-rw-r--r--ext/standard/tests/array/array_key_exists_basic.phpt29
-rw-r--r--ext/standard/tests/array/array_key_exists_error.phpt44
-rw-r--r--ext/standard/tests/array/array_key_exists_object1.phpt80
-rw-r--r--ext/standard/tests/array/array_key_exists_object2.phpt84
-rw-r--r--ext/standard/tests/array/array_key_exists_variation1.phpt203
-rw-r--r--ext/standard/tests/array/array_key_exists_variation2.phpt225
-rw-r--r--ext/standard/tests/array/array_key_exists_variation3.phpt60
-rw-r--r--ext/standard/tests/array/array_key_exists_variation4.phpt46
-rw-r--r--ext/standard/tests/array/array_key_exists_variation5.phpt39
-rw-r--r--ext/standard/tests/array/array_key_exists_variation6.phpt96
-rw-r--r--ext/standard/tests/array/array_key_exists_variation7.phpt36
-rw-r--r--ext/standard/tests/array/array_key_exists_variation8.phpt547
-rw-r--r--ext/standard/tests/array/array_map.phpt423
-rw-r--r--ext/standard/tests/array/array_map_basic.phpt70
-rw-r--r--ext/standard/tests/array/array_map_error.phpt73
-rw-r--r--ext/standard/tests/array/array_map_object1.phpt200
-rw-r--r--ext/standard/tests/array/array_map_object2.phpt46
-rw-r--r--ext/standard/tests/array/array_map_object3.phpt91
-rw-r--r--ext/standard/tests/array/array_map_variation1.phpt56
-rw-r--r--ext/standard/tests/array/array_map_variation10.phpt120
-rw-r--r--ext/standard/tests/array/array_map_variation11.phpt52
-rw-r--r--ext/standard/tests/array/array_map_variation12.phpt60
-rw-r--r--ext/standard/tests/array/array_map_variation13.phpt107
-rw-r--r--ext/standard/tests/array/array_map_variation14.phpt125
-rw-r--r--ext/standard/tests/array/array_map_variation15.phpt30
-rw-r--r--ext/standard/tests/array/array_map_variation16.phpt73
-rw-r--r--ext/standard/tests/array/array_map_variation17.phpt158
-rw-r--r--ext/standard/tests/array/array_map_variation18.phpt205
-rw-r--r--ext/standard/tests/array/array_map_variation2.phpt276
-rw-r--r--ext/standard/tests/array/array_map_variation3.phpt227
-rw-r--r--ext/standard/tests/array/array_map_variation4.phpt179
-rw-r--r--ext/standard/tests/array/array_map_variation5.phpt181
-rw-r--r--ext/standard/tests/array/array_map_variation6.phpt72
-rw-r--r--ext/standard/tests/array/array_map_variation7.phpt122
-rw-r--r--ext/standard/tests/array/array_map_variation8.phpt81
-rw-r--r--ext/standard/tests/array/array_map_variation9.phpt88
-rw-r--r--ext/standard/tests/array/array_merge_basic.phpt58
-rw-r--r--ext/standard/tests/array/array_merge_error.phpt30
-rw-r--r--ext/standard/tests/array/array_merge_recursive_basic1.phpt97
-rw-r--r--ext/standard/tests/array/array_merge_recursive_basic2.phpt94
-rw-r--r--ext/standard/tests/array/array_merge_recursive_error.phpt25
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation1.phpt303
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation10.phpt174
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation2.phpt199
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation3.phpt761
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation4.phpt424
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation5.phpt404
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation6.phpt113
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation7.phpt82
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation8.phpt73
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation9.phpt117
-rw-r--r--ext/standard/tests/array/array_merge_variation1.phpt231
-rw-r--r--ext/standard/tests/array/array_merge_variation10.phpt70
-rw-r--r--ext/standard/tests/array/array_merge_variation2.phpt230
-rw-r--r--ext/standard/tests/array/array_merge_variation3.phpt379
-rw-r--r--ext/standard/tests/array/array_merge_variation4.phpt368
-rw-r--r--ext/standard/tests/array/array_merge_variation5.phpt61
-rw-r--r--ext/standard/tests/array/array_merge_variation6.phpt53
-rw-r--r--ext/standard/tests/array/array_merge_variation7.phpt65
-rw-r--r--ext/standard/tests/array/array_merge_variation8.phpt74
-rw-r--r--ext/standard/tests/array/array_merge_variation9.phpt114
-rw-r--r--ext/standard/tests/array/array_pad_basic.phpt92
-rw-r--r--ext/standard/tests/array/array_pad_error.phpt53
-rw-r--r--ext/standard/tests/array/array_pad_variation1.phpt270
-rw-r--r--ext/standard/tests/array/array_pad_variation2.phpt288
-rw-r--r--ext/standard/tests/array/array_pad_variation3.phpt869
-rw-r--r--ext/standard/tests/array/array_pad_variation4.phpt60
-rw-r--r--ext/standard/tests/array/array_pad_variation5.phpt140
-rw-r--r--ext/standard/tests/array/array_pad_variation6.phpt668
-rw-r--r--ext/standard/tests/array/array_pad_variation7.phpt127
-rw-r--r--ext/standard/tests/array/array_push_basic.phpt63
-rw-r--r--ext/standard/tests/array/array_push_error1.phpt30
-rw-r--r--ext/standard/tests/array/array_push_error2.phpt53
-rw-r--r--ext/standard/tests/array/array_push_variation1.phpt225
-rw-r--r--ext/standard/tests/array/array_push_variation2.phpt178
-rw-r--r--ext/standard/tests/array/array_push_variation3.phpt70
-rw-r--r--ext/standard/tests/array/array_push_variation4.phpt134
-rw-r--r--ext/standard/tests/array/array_push_variation5.phpt36
-rw-r--r--ext/standard/tests/array/array_push_variation6.phpt159
-rw-r--r--ext/standard/tests/array/array_reverse_variation5.phpt8
-rw-r--r--ext/standard/tests/array/array_shift_basic.phpt54
-rw-r--r--ext/standard/tests/array/array_shift_error.phpt40
-rw-r--r--ext/standard/tests/array/array_shift_variation1.phpt218
-rw-r--r--ext/standard/tests/array/array_shift_variation2.phpt208
-rw-r--r--ext/standard/tests/array/array_shift_variation3.phpt188
-rw-r--r--ext/standard/tests/array/array_shift_variation4.phpt109
-rw-r--r--ext/standard/tests/array/array_shift_variation5.phpt45
-rw-r--r--ext/standard/tests/array/array_shift_variation6.phpt83
-rw-r--r--ext/standard/tests/array/array_shift_variation7.phpt34
-rw-r--r--ext/standard/tests/array/array_shift_variation8.phpt50
-rw-r--r--ext/standard/tests/array/array_shuffle_basic.phpt99
-rw-r--r--ext/standard/tests/array/array_slice_basic.phpt51
-rw-r--r--ext/standard/tests/array/array_slice_error.phpt43
-rw-r--r--ext/standard/tests/array/array_slice_variation1.phpt227
-rw-r--r--ext/standard/tests/array/array_slice_variation10.phpt44
-rw-r--r--ext/standard/tests/array/array_slice_variation2.phpt309
-rw-r--r--ext/standard/tests/array/array_slice_variation3.phpt207
-rw-r--r--ext/standard/tests/array/array_slice_variation4.phpt327
-rw-r--r--ext/standard/tests/array/array_slice_variation5.phpt191
-rw-r--r--ext/standard/tests/array/array_slice_variation6.phpt150
-rw-r--r--ext/standard/tests/array/array_slice_variation7.phpt300
-rw-r--r--ext/standard/tests/array/array_slice_variation8.phpt56
-rw-r--r--ext/standard/tests/array/array_slice_variation9.phpt75
-rw-r--r--ext/standard/tests/array/array_sum_basic.phpt37
-rw-r--r--ext/standard/tests/array/array_sum_error.phpt34
-rw-r--r--ext/standard/tests/array/array_sum_variation1.phpt179
-rw-r--r--ext/standard/tests/array/array_sum_variation2.phpt49
-rw-r--r--ext/standard/tests/array/array_sum_variation3.phpt54
-rw-r--r--ext/standard/tests/array/array_sum_variation4.phpt34
-rw-r--r--ext/standard/tests/array/array_sum_variation5.phpt37
-rw-r--r--ext/standard/tests/array/array_sum_variation6.phpt33
-rw-r--r--ext/standard/tests/array/array_sum_variation7.phpt86
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_basic.phpt41
-rw-r--r--ext/standard/tests/array/array_udiff_basic.phpt36
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_basic.phpt45
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_basic.phpt36
-rw-r--r--ext/standard/tests/array/array_uintersect_basic.phpt41
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_basic.phpt40
-rw-r--r--ext/standard/tests/array/array_unique_basic.phpt48
-rw-r--r--ext/standard/tests/array/array_unique_error.phpt36
-rw-r--r--ext/standard/tests/array/array_unique_variation1.phpt194
-rw-r--r--ext/standard/tests/array/array_unique_variation2.phpt232
-rw-r--r--ext/standard/tests/array/array_unique_variation3.phpt134
-rw-r--r--ext/standard/tests/array/array_unique_variation4.phpt131
-rw-r--r--ext/standard/tests/array/array_unique_variation5.phpt33
-rw-r--r--ext/standard/tests/array/array_unique_variation6.phpt44
-rw-r--r--ext/standard/tests/array/array_unique_variation7.phpt33
-rw-r--r--ext/standard/tests/array/array_unique_variation8.phpt44
-rw-r--r--ext/standard/tests/array/array_unshift_variation5.phpt6
-rw-r--r--ext/standard/tests/array/array_values_basic.phpt40
-rw-r--r--ext/standard/tests/array/array_values_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_values_variation2.phpt215
-rw-r--r--ext/standard/tests/array/array_values_variation3.phpt200
-rw-r--r--ext/standard/tests/array/array_values_variation4.phpt118
-rw-r--r--ext/standard/tests/array/array_values_variation5.phpt46
-rw-r--r--ext/standard/tests/array/array_values_variation6.phpt70
-rw-r--r--ext/standard/tests/array/array_values_variation7.phpt55
-rw-r--r--ext/standard/tests/array/array_walk_basic1.phpt80
-rw-r--r--ext/standard/tests/array/array_walk_basic2.phpt105
-rw-r--r--ext/standard/tests/array/array_walk_error1.phpt48
-rw-r--r--ext/standard/tests/array/array_walk_error2.phpt59
-rw-r--r--ext/standard/tests/array/array_walk_object1.phptbin0 -> 1391 bytes
-rw-r--r--ext/standard/tests/array/array_walk_object2.phpt104
-rw-r--r--ext/standard/tests/array/array_walk_recursive_basic1.phpt80
-rw-r--r--ext/standard/tests/array/array_walk_recursive_basic2.phpt105
-rw-r--r--ext/standard/tests/array/array_walk_recursive_error1.phpt48
-rw-r--r--ext/standard/tests/array/array_walk_recursive_error2.phpt59
-rw-r--r--ext/standard/tests/array/array_walk_recursive_object1.phptbin0 -> 1441 bytes
-rw-r--r--ext/standard/tests/array/array_walk_recursive_object2.phpt106
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation1.phpt250
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation2.phpt271
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation3.phpt123
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation4.phpt76
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation5.phpt64
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation6.phpt147
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation7.phpt93
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation8.phpt42
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation9.phpt99
-rw-r--r--ext/standard/tests/array/array_walk_variation1.phpt250
-rw-r--r--ext/standard/tests/array/array_walk_variation2.phpt271
-rw-r--r--ext/standard/tests/array/array_walk_variation3.phpt123
-rw-r--r--ext/standard/tests/array/array_walk_variation4.phpt87
-rw-r--r--ext/standard/tests/array/array_walk_variation5.phpt64
-rw-r--r--ext/standard/tests/array/array_walk_variation6.phpt143
-rw-r--r--ext/standard/tests/array/array_walk_variation7.phpt93
-rw-r--r--ext/standard/tests/array/array_walk_variation8.phpt42
-rw-r--r--ext/standard/tests/array/array_walk_variation9.phpt99
-rw-r--r--ext/standard/tests/array/arsort_error.phpt79
-rw-r--r--ext/standard/tests/array/arsort_variation1.phpt399
-rw-r--r--ext/standard/tests/array/arsort_variation10.phpt114
-rw-r--r--ext/standard/tests/array/arsort_variation11.phptbin0 -> 3384 bytes
-rw-r--r--ext/standard/tests/array/arsort_variation2.phpt308
-rw-r--r--ext/standard/tests/array/arsort_variation3.phpt326
-rw-r--r--ext/standard/tests/array/arsort_variation4.phpt79
-rw-r--r--ext/standard/tests/array/arsort_variation5.phpt242
-rw-r--r--ext/standard/tests/array/arsort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/arsort_variation7.phpt98
-rw-r--r--ext/standard/tests/array/arsort_variation8.phpt180
-rw-r--r--ext/standard/tests/array/arsort_variation9.phpt258
-rw-r--r--ext/standard/tests/array/bug26458.phptbin395 -> 406 bytes
-rw-r--r--ext/standard/tests/array/bug42177.phpt35
-rw-r--r--ext/standard/tests/array/bug42838.phpt24
-rw-r--r--ext/standard/tests/array/bug42850.phpt59
-rw-r--r--ext/standard/tests/array/bug43495.phpt21
-rw-r--r--ext/standard/tests/array/bug43505.phpt36
-rw-r--r--ext/standard/tests/array/compact_basic.phpt85
-rw-r--r--ext/standard/tests/array/compact_error.phpt31
-rw-r--r--ext/standard/tests/array/count_basic.phpt45
-rw-r--r--ext/standard/tests/array/count_error.phpt41
-rw-r--r--ext/standard/tests/array/count_variation1.phpt170
-rw-r--r--ext/standard/tests/array/count_variation2.phpt187
-rw-r--r--ext/standard/tests/array/count_variation3.phpt41
-rw-r--r--ext/standard/tests/array/current_basic.phpt32
-rw-r--r--ext/standard/tests/array/current_error.phpt40
-rw-r--r--ext/standard/tests/array/current_variation1.phpt217
-rw-r--r--ext/standard/tests/array/current_variation2.phpt155
-rw-r--r--ext/standard/tests/array/current_variation3.phpt42
-rw-r--r--ext/standard/tests/array/current_variation4.phpt72
-rw-r--r--ext/standard/tests/array/each_basic.phpt74
-rw-r--r--ext/standard/tests/array/each_error.phpt42
-rw-r--r--ext/standard/tests/array/each_variation1.phpt222
-rw-r--r--ext/standard/tests/array/each_variation2.phpt248
-rw-r--r--ext/standard/tests/array/each_variation3.phpt253
-rw-r--r--ext/standard/tests/array/each_variation4.phpt90
-rw-r--r--ext/standard/tests/array/each_variation5.phpt96
-rw-r--r--ext/standard/tests/array/each_variation6.phpt51
-rw-r--r--ext/standard/tests/array/end_basic.phpt46
-rw-r--r--ext/standard/tests/array/end_error.phpt39
-rw-r--r--ext/standard/tests/array/end_variation1.phpt220
-rw-r--r--ext/standard/tests/array/end_variation2.phpt43
-rw-r--r--ext/standard/tests/array/end_variation3.phpt41
-rw-r--r--ext/standard/tests/array/key_basic.phpt47
-rw-r--r--ext/standard/tests/array/key_error.phpt39
-rw-r--r--ext/standard/tests/array/key_variation1.phpt220
-rw-r--r--ext/standard/tests/array/key_variation2.phpt155
-rw-r--r--ext/standard/tests/array/key_variation3.phpt43
-rw-r--r--ext/standard/tests/array/key_variation4.phpt64
-rw-r--r--ext/standard/tests/array/krsort_basic.phpt132
-rw-r--r--ext/standard/tests/array/krsort_error.phpt78
-rw-r--r--ext/standard/tests/array/krsort_object.phpt242
-rw-r--r--ext/standard/tests/array/krsort_variation1.phpt397
-rw-r--r--ext/standard/tests/array/krsort_variation10.phpt98
-rw-r--r--ext/standard/tests/array/krsort_variation11.phpt81
-rw-r--r--ext/standard/tests/array/krsort_variation2.phpt307
-rw-r--r--ext/standard/tests/array/krsort_variation3.phpt262
-rw-r--r--ext/standard/tests/array/krsort_variation4.phpt114
-rw-r--r--ext/standard/tests/array/krsort_variation5.phpt230
-rw-r--r--ext/standard/tests/array/krsort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/krsort_variation7.phpt177
-rw-r--r--ext/standard/tests/array/krsort_variation8.phptbin0 -> 3328 bytes
-rw-r--r--ext/standard/tests/array/krsort_variation9.phpt257
-rw-r--r--ext/standard/tests/array/ksort_basic.phpt131
-rw-r--r--ext/standard/tests/array/ksort_error.phpt78
-rw-r--r--ext/standard/tests/array/ksort_object.phpt241
-rw-r--r--ext/standard/tests/array/ksort_variation1.phpt397
-rw-r--r--ext/standard/tests/array/ksort_variation10.phpt113
-rw-r--r--ext/standard/tests/array/ksort_variation11.phpt98
-rw-r--r--ext/standard/tests/array/ksort_variation2.phpt307
-rw-r--r--ext/standard/tests/array/ksort_variation3.phpt262
-rw-r--r--ext/standard/tests/array/ksort_variation4.phpt81
-rw-r--r--ext/standard/tests/array/ksort_variation5.phpt230
-rw-r--r--ext/standard/tests/array/ksort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/ksort_variation7.phpt177
-rw-r--r--ext/standard/tests/array/ksort_variation8.phptbin0 -> 3295 bytes
-rw-r--r--ext/standard/tests/array/ksort_variation9.phpt256
-rw-r--r--ext/standard/tests/array/natcasesort_basic.phpt57
-rw-r--r--ext/standard/tests/array/natcasesort_error.phpt40
-rw-r--r--ext/standard/tests/array/natcasesort_object1.phpt99
-rw-r--r--ext/standard/tests/array/natcasesort_object2.phpt99
-rw-r--r--ext/standard/tests/array/natcasesort_variation1.phpt220
-rw-r--r--ext/standard/tests/array/natcasesort_variation10.phpt52
-rw-r--r--ext/standard/tests/array/natcasesort_variation11.phpt232
-rw-r--r--ext/standard/tests/array/natcasesort_variation2.phpt227
-rw-r--r--ext/standard/tests/array/natcasesort_variation3.phpt135
-rw-r--r--ext/standard/tests/array/natcasesort_variation4.phpt86
-rw-r--r--ext/standard/tests/array/natcasesort_variation5.phpt49
-rw-r--r--ext/standard/tests/array/natcasesort_variation6.phpt56
-rw-r--r--ext/standard/tests/array/natcasesort_variation7.phpt98
-rw-r--r--ext/standard/tests/array/natcasesort_variation8.phpt46
-rw-r--r--ext/standard/tests/array/natcasesort_variation9.phpt110
-rw-r--r--ext/standard/tests/array/next_basic.phpt35
-rw-r--r--ext/standard/tests/array/next_error.phpt39
-rw-r--r--ext/standard/tests/array/next_variation1.phpt219
-rw-r--r--ext/standard/tests/array/next_variation2.phpt45
-rw-r--r--ext/standard/tests/array/reset_basic.phpt45
-rw-r--r--ext/standard/tests/array/reset_error.phpt39
-rw-r--r--ext/standard/tests/array/reset_variation1.phpt219
-rw-r--r--ext/standard/tests/array/reset_variation2.phpt34
-rw-r--r--ext/standard/tests/array/reset_variation3.phpt56
-rw-r--r--ext/standard/tests/array/rsort_basic.phpt129
-rw-r--r--ext/standard/tests/array/rsort_error.phpt51
-rw-r--r--ext/standard/tests/array/rsort_object1.phpt243
-rw-r--r--ext/standard/tests/array/rsort_object2.phpt258
-rw-r--r--ext/standard/tests/array/rsort_variation1.phpt514
-rw-r--r--ext/standard/tests/array/rsort_variation10.phpt108
-rw-r--r--ext/standard/tests/array/rsort_variation11.phptbin0 -> 2695 bytes
-rw-r--r--ext/standard/tests/array/rsort_variation2.phpt484
-rw-r--r--ext/standard/tests/array/rsort_variation3.phpt325
-rw-r--r--ext/standard/tests/array/rsort_variation4.phpt80
-rw-r--r--ext/standard/tests/array/rsort_variation5.phpt221
-rw-r--r--ext/standard/tests/array/rsort_variation6.phpt120
-rw-r--r--ext/standard/tests/array/rsort_variation7.phpt96
-rw-r--r--ext/standard/tests/array/rsort_variation8.phpt180
-rw-r--r--ext/standard/tests/array/rsort_variation9.phpt259
-rw-r--r--ext/standard/tests/array/sizeof_basic1.phpt60
-rw-r--r--ext/standard/tests/array/sizeof_basic2.phpt99
-rw-r--r--ext/standard/tests/array/sizeof_error.phpt41
-rw-r--r--ext/standard/tests/array/sizeof_object1.phpt55
-rw-r--r--ext/standard/tests/array/sizeof_object2.phpt138
-rw-r--r--ext/standard/tests/array/sizeof_variation1.phpt215
-rw-r--r--ext/standard/tests/array/sizeof_variation2.phpt163
-rw-r--r--ext/standard/tests/array/sizeof_variation3.phpt34
-rw-r--r--ext/standard/tests/array/sizeof_variation4.phpt350
-rw-r--r--ext/standard/tests/array/sizeof_variation5.phpt132
-rw-r--r--ext/standard/tests/array/uasort_basic1.phpt116
-rw-r--r--ext/standard/tests/array/uasort_basic2.phpt102
-rw-r--r--ext/standard/tests/array/uasort_error.phpt81
-rw-r--r--ext/standard/tests/array/uasort_object1.phpt150
-rw-r--r--ext/standard/tests/array/uasort_object2.phpt187
-rw-r--r--ext/standard/tests/array/uasort_variation1.phpt188
-rw-r--r--ext/standard/tests/array/uasort_variation10.phpt74
-rw-r--r--ext/standard/tests/array/uasort_variation11.phpt82
-rw-r--r--ext/standard/tests/array/uasort_variation2.phpt212
-rw-r--r--ext/standard/tests/array/uasort_variation3.phptbin0 -> 2584 bytes
-rw-r--r--ext/standard/tests/array/uasort_variation4.phpt150
-rw-r--r--ext/standard/tests/array/uasort_variation5.phpt145
-rw-r--r--ext/standard/tests/array/uasort_variation6.phpt115
-rw-r--r--ext/standard/tests/array/uasort_variation7.phpt60
-rw-r--r--ext/standard/tests/array/uasort_variation8.phpt78
-rw-r--r--ext/standard/tests/array/uasort_variation9.phpt81
-rw-r--r--ext/standard/tests/array/var_export2.phptbin204 -> 215 bytes
-rw-r--r--ext/standard/tests/class_object/class_exists_basic_001.phpt55
-rw-r--r--ext/standard/tests/class_object/class_exists_error_001.phpt42
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_001.phpt182
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_002.phpt193
-rw-r--r--ext/standard/tests/class_object/class_exists_variation_003.phpt18
-rw-r--r--ext/standard/tests/class_object/get_class_error_001.phpt28
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_001.phpt63
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_002.phpt178
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_003.phpt76
-rw-r--r--ext/standard/tests/class_object/get_class_methods_error_001.phpt41
-rw-r--r--ext/standard/tests/class_object/get_class_methods_variation_001.phpt172
-rw-r--r--ext/standard/tests/class_object/get_class_methods_variation_002.phpt27
-rw-r--r--ext/standard/tests/class_object/get_class_variation_001.phpt160
-rw-r--r--ext/standard/tests/class_object/get_class_variation_002.phpt18
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_basic_001.phpt47
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_error_001.phpt27
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt47
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt27
-rw-r--r--ext/standard/tests/class_object/get_object_vars_basic_001.phpt107
-rw-r--r--ext/standard/tests/class_object/get_object_vars_basic_002.phpt64
-rw-r--r--ext/standard/tests/class_object/get_object_vars_error_001.phpt37
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_002.phpt47
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_003.phpt158
-rw-r--r--ext/standard/tests/class_object/get_parent_class_error_001.phpt29
-rw-r--r--ext/standard/tests/class_object/get_parent_class_variation_001.phpt27
-rw-r--r--ext/standard/tests/class_object/get_parent_class_variation_002.phpt174
-rw-r--r--ext/standard/tests/class_object/is_a_error_001.phpt44
-rw-r--r--ext/standard/tests/class_object/is_a_variation_001.phpt213
-rw-r--r--ext/standard/tests/class_object/is_a_variation_002.phpt223
-rw-r--r--ext/standard/tests/class_object/is_a_variation_003.phpt25
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_error_001.phpt40
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_001.phpt175
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_002.phpt172
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_003.phpt26
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_001.phpt83
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_002.phpt33
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_003.phpt22
-rw-r--r--ext/standard/tests/class_object/method_exists_error_001.phpt40
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_001.phpt170
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_002.phpt172
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_003.phpt26
-rw-r--r--ext/standard/tests/dir/chdir_basic.phpt53
-rw-r--r--ext/standard/tests/dir/chdir_error1.phpt39
-rw-r--r--ext/standard/tests/dir/chdir_error2.phpt26
-rw-r--r--ext/standard/tests/dir/chdir_variation1.phpt235
-rw-r--r--ext/standard/tests/dir/chdir_variation2.phpt104
-rw-r--r--ext/standard/tests/dir/closedir_basic.phpt56
-rw-r--r--ext/standard/tests/dir/closedir_error.phpt45
-rw-r--r--ext/standard/tests/dir/closedir_variation1.phpt212
-rw-r--r--ext/standard/tests/dir/closedir_variation2.phpt51
-rw-r--r--ext/standard/tests/dir/closedir_variation3.phpt44
-rw-r--r--ext/standard/tests/dir/dir_basic.phpt86
-rw-r--r--ext/standard/tests/dir/dir_error.phpt34
-rw-r--r--ext/standard/tests/dir/dir_variation1.phpt160
-rw-r--r--ext/standard/tests/dir/dir_variation2.phpt223
-rw-r--r--ext/standard/tests/dir/dir_variation3.phpt204
-rw-r--r--ext/standard/tests/dir/dir_variation4.phpt72
-rw-r--r--ext/standard/tests/dir/dir_variation5.phpt29
-rw-r--r--ext/standard/tests/dir/dir_variation6.phpt51
-rw-r--r--ext/standard/tests/dir/dir_variation7.phpt94
-rw-r--r--ext/standard/tests/dir/dir_variation8.phpt63
-rw-r--r--ext/standard/tests/dir/dir_variation9.phpt111
-rw-r--r--ext/standard/tests/dir/getcwd_basic.phpt34
-rw-r--r--ext/standard/tests/dir/getcwd_error.phpt29
-rw-r--r--ext/standard/tests/dir/opendir_basic.phpt62
-rw-r--r--ext/standard/tests/dir/opendir_error1.phpt47
-rw-r--r--ext/standard/tests/dir/opendir_error2.phpt37
-rw-r--r--ext/standard/tests/dir/opendir_variation1.phpt218
-rw-r--r--ext/standard/tests/dir/opendir_variation2.phpt239
-rw-r--r--ext/standard/tests/dir/opendir_variation3.phpt50
-rw-r--r--ext/standard/tests/dir/opendir_variation4.phpt107
-rw-r--r--ext/standard/tests/dir/opendir_variation5.phpt103
-rw-r--r--ext/standard/tests/dir/opendir_variation6.phpt61
-rw-r--r--ext/standard/tests/dir/opendir_variation7.phpt127
-rw-r--r--ext/standard/tests/dir/readdir_basic.phpt73
-rw-r--r--ext/standard/tests/dir/readdir_error.phpt43
-rw-r--r--ext/standard/tests/dir/readdir_variation1.phpt210
-rw-r--r--ext/standard/tests/dir/readdir_variation2.phpt39
-rw-r--r--ext/standard/tests/dir/readdir_variation3.phpt68
-rw-r--r--ext/standard/tests/dir/readdir_variation4.phpt179
-rw-r--r--ext/standard/tests/dir/readdir_variation5.phpt144
-rw-r--r--ext/standard/tests/dir/readdir_variation6.phpt80
-rw-r--r--ext/standard/tests/dir/readdir_variation7.phpt36
-rw-r--r--ext/standard/tests/dir/rewinddir_basic.phpt94
-rw-r--r--ext/standard/tests/dir/rewinddir_error.phpt42
-rw-r--r--ext/standard/tests/dir/rewinddir_variation1.phpt211
-rw-r--r--ext/standard/tests/dir/rewinddir_variation2.phpt45
-rw-r--r--ext/standard/tests/dir/rewinddir_variation3.phpt43
-rw-r--r--ext/standard/tests/dir/scandir_basic.phpt70
-rw-r--r--ext/standard/tests/dir/scandir_error1.phpt47
-rw-r--r--ext/standard/tests/dir/scandir_error2.phpt41
-rw-r--r--ext/standard/tests/dir/scandir_variation1.phpt253
-rw-r--r--ext/standard/tests/dir/scandir_variation2.phpt283
-rw-r--r--ext/standard/tests/dir/scandir_variation3.phpt238
-rw-r--r--ext/standard/tests/dir/scandir_variation4.phpt169
-rw-r--r--ext/standard/tests/dir/scandir_variation5.phpt98
-rw-r--r--ext/standard/tests/dir/scandir_variation6.phpt70
-rw-r--r--ext/standard/tests/dir/scandir_variation7.phpt169
-rw-r--r--ext/standard/tests/dir/scandir_variation8.phpt154
-rw-r--r--ext/standard/tests/dir/scandir_variation9.phpt72
-rw-r--r--ext/standard/tests/file/bug22414.phpt11
-rw-r--r--ext/standard/tests/file/bug41655_2.phpt6
-rwxr-xr-xext/standard/tests/file/bug43216.phpt8
-rwxr-xr-xext/standard/tests/file/bug43248.phpt8
-rw-r--r--ext/standard/tests/file/bug43522.phpt25
-rw-r--r--ext/standard/tests/file/fgetc_basic.phpt216
-rw-r--r--ext/standard/tests/file/fgetc_variation2.phpt15
-rw-r--r--ext/standard/tests/file/fopen_variation1.phpt14
-rw-r--r--ext/standard/tests/file/fread_socket_variation1.phpt16
-rw-r--r--ext/standard/tests/file/fseek_dir_basic.phpt96
-rw-r--r--ext/standard/tests/file/glob_variation2.phpt57
-rw-r--r--ext/standard/tests/file/is_dir_variation2.phpt2
-rw-r--r--ext/standard/tests/file/open_basedir.inc133
-rw-r--r--ext/standard/tests/file/open_basedir_chdir.phpt51
-rw-r--r--ext/standard/tests/file/open_basedir_chmod.phpt71
-rw-r--r--ext/standard/tests/file/open_basedir_copy.phpt79
-rw-r--r--ext/standard/tests/file/open_basedir_copy_variation1.phpt35
-rw-r--r--ext/standard/tests/file/open_basedir_disk_free_space.phpt52
-rw-r--r--ext/standard/tests/file/open_basedir_file.phpt88
-rw-r--r--ext/standard/tests/file/open_basedir_file_exists.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_file_get_contents.phpt75
-rw-r--r--ext/standard/tests/file/open_basedir_file_put_contents.phpt57
-rw-r--r--ext/standard/tests/file/open_basedir_fileatime.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_filectime.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_filegroup.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_fileinode.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_filemtime.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_fileowner.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_fileperms.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_filesize.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_filetype.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_fopen.phpt86
-rw-r--r--ext/standard/tests/file/open_basedir_glob-win32.phpt59
-rw-r--r--ext/standard/tests/file/open_basedir_glob.phpt58
-rw-r--r--ext/standard/tests/file/open_basedir_is_dir.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_is_executable.phpt59
-rw-r--r--ext/standard/tests/file/open_basedir_is_file.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_is_link.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_is_readable.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_is_writable.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_link.phpt78
-rw-r--r--ext/standard/tests/file/open_basedir_linkinfo.phpt64
-rw-r--r--ext/standard/tests/file/open_basedir_lstat.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_mkdir.phpt52
-rw-r--r--ext/standard/tests/file/open_basedir_parse_ini_file.phpt74
-rw-r--r--ext/standard/tests/file/open_basedir_readlink.phpt76
-rw-r--r--ext/standard/tests/file/open_basedir_realpath.phpt61
-rw-r--r--ext/standard/tests/file/open_basedir_rename.phpt47
-rw-r--r--ext/standard/tests/file/open_basedir_rmdir.phpt47
-rw-r--r--ext/standard/tests/file/open_basedir_stat.phpt55
-rw-r--r--ext/standard/tests/file/open_basedir_symlink.phpt78
-rw-r--r--ext/standard/tests/file/open_basedir_tempnam.phpt57
-rw-r--r--ext/standard/tests/file/open_basedir_touch.phpt70
-rw-r--r--ext/standard/tests/file/open_basedir_unlink.phpt47
-rw-r--r--ext/standard/tests/file/parse_ini_file_error.phpt52
-rw-r--r--ext/standard/tests/file/realpath_basic2.phpt13
-rw-r--r--ext/standard/tests/file/realpath_basic3.phpt86
-rwxr-xr-xext/standard/tests/file/rename_basic.phpt89
-rw-r--r--ext/standard/tests/file/rename_variation-win32.phpt130
-rw-r--r--ext/standard/tests/file/rename_variation1-win32.phpt81
-rw-r--r--ext/standard/tests/file/rename_variation2-win32.phpt61
-rw-r--r--ext/standard/tests/file/rename_variation3-win32.phpt69
-rw-r--r--ext/standard/tests/file/rename_variation8.phpt67
-rw-r--r--ext/standard/tests/file/rename_variation9.phpt53
-rw-r--r--ext/standard/tests/general_functions/bug42272.phpt11
-rw-r--r--ext/standard/tests/general_functions/bug43293_1.phpt25
-rw-r--r--ext/standard/tests/general_functions/bug43293_2.phpt13
-rw-r--r--ext/standard/tests/general_functions/bug43293_3.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug44394.phpt18
-rw-r--r--ext/standard/tests/general_functions/bug44394_2.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug44487.phpt24
-rw-r--r--ext/standard/tests/general_functions/bug44667.phpt33
-rwxr-xr-xext/standard/tests/general_functions/dl-cve-2007-4887.phpt2
-rw-r--r--ext/standard/tests/general_functions/getopt_002.phpt42
-rw-r--r--ext/standard/tests/general_functions/import_request.phpt2
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt2
-rw-r--r--ext/standard/tests/general_functions/var_export-locale.phpt6
-rw-r--r--ext/standard/tests/general_functions/var_export.phpt6
-rw-r--r--ext/standard/tests/math/acos_error.phpt1
-rw-r--r--ext/standard/tests/math/acosh_error.phpt1
-rw-r--r--ext/standard/tests/math/asin_error.phpt1
-rw-r--r--ext/standard/tests/math/asinh_error.phpt1
-rw-r--r--ext/standard/tests/math/atan2_basic.phpt185
-rw-r--r--ext/standard/tests/math/atan2_error.phpt15
-rw-r--r--ext/standard/tests/math/atan_error.phpt1
-rw-r--r--ext/standard/tests/math/atanh_error.phpt1
-rw-r--r--ext/standard/tests/math/base_convert_basic.phpt316
-rw-r--r--ext/standard/tests/math/base_convert_error.phpt21
-rw-r--r--ext/standard/tests/math/bindec_basic.phpt53
-rw-r--r--ext/standard/tests/math/bindec_basic_64bit.phpt53
-rw-r--r--ext/standard/tests/math/bindec_error.phpt12
-rw-r--r--ext/standard/tests/math/constants_basic.phpt65
-rw-r--r--ext/standard/tests/math/cos_error.phpt1
-rw-r--r--ext/standard/tests/math/cosh_error.phpt1
-rw-r--r--ext/standard/tests/math/decbin_basic.phpt39
-rw-r--r--ext/standard/tests/math/decbin_error.phpt13
-rw-r--r--ext/standard/tests/math/dechex_basic.phpt38
-rw-r--r--ext/standard/tests/math/dechex_error.phpt13
-rw-r--r--ext/standard/tests/math/decoct_basic.phpt38
-rw-r--r--ext/standard/tests/math/decoct_error.phpt13
-rw-r--r--ext/standard/tests/math/deg2rad_basic.phpt67
-rw-r--r--ext/standard/tests/math/deg2rad_error.phpt31
-rw-r--r--ext/standard/tests/math/deg2rad_variation.phpt52
-rw-r--r--ext/standard/tests/math/exp_error.phpt14
-rw-r--r--ext/standard/tests/math/fmod_basic.phpt209
-rw-r--r--ext/standard/tests/math/fmod_error.phpt17
-rw-r--r--ext/standard/tests/math/getrandmax_basic.phpt9
-rw-r--r--ext/standard/tests/math/getrandmax_error.phpt9
-rw-r--r--ext/standard/tests/math/hexdec_basic.phpt50
-rw-r--r--ext/standard/tests/math/hexdec_error.phpt12
-rw-r--r--ext/standard/tests/math/hypot_error.phpt18
-rw-r--r--ext/standard/tests/math/is_finite_basic.phpt41
-rw-r--r--ext/standard/tests/math/is_finite_error.phpt13
-rw-r--r--ext/standard/tests/math/is_infinite_basic.phpt42
-rw-r--r--ext/standard/tests/math/is_infinite_error.phpt12
-rw-r--r--ext/standard/tests/math/is_nan_basic.phpt45
-rw-r--r--ext/standard/tests/math/is_nan_error.phpt16
-rw-r--r--ext/standard/tests/math/lcg_value_basic.phpt56
-rw-r--r--ext/standard/tests/math/log10_basic.phpt55
-rw-r--r--ext/standard/tests/math/log10_error.phpt31
-rw-r--r--ext/standard/tests/math/log10_variation.phpt52
-rw-r--r--ext/standard/tests/math/log_basic.phpt60
-rw-r--r--ext/standard/tests/math/log_error.phpt17
-rw-r--r--ext/standard/tests/math/mt_getrandmax_basic.phpt8
-rw-r--r--ext/standard/tests/math/mt_getrandmax_error.phpt9
-rw-r--r--ext/standard/tests/math/mt_rand_basic.phpt102
-rw-r--r--ext/standard/tests/math/mt_rand_error.phpt19
-rw-r--r--ext/standard/tests/math/mt_srand_basic.phpt24
-rw-r--r--ext/standard/tests/math/mt_srand_error.phpt20
-rw-r--r--ext/standard/tests/math/number_format_error.phpt16
-rw-r--r--ext/standard/tests/math/octdec_basic.phpt49
-rw-r--r--ext/standard/tests/math/octdec_error.phpt12
-rw-r--r--ext/standard/tests/math/pi_basic.phpt14
-rw-r--r--ext/standard/tests/math/pow_basic.phpt37
-rw-r--r--ext/standard/tests/math/pow_error.phpt19
-rw-r--r--ext/standard/tests/math/rad2deg_basic.phpt65
-rw-r--r--ext/standard/tests/math/rad2deg_error.phpt31
-rw-r--r--ext/standard/tests/math/rad2deg_variation.phpt52
-rw-r--r--ext/standard/tests/math/rand_basic.phpt103
-rw-r--r--ext/standard/tests/math/rand_error.phpt18
-rw-r--r--ext/standard/tests/math/sin_error.phpt1
-rw-r--r--ext/standard/tests/math/sinh_error.phpt1
-rw-r--r--ext/standard/tests/math/sqrt_basic.phpt18
-rw-r--r--ext/standard/tests/math/sqrt_error.phpt31
-rw-r--r--ext/standard/tests/math/srand_basic.phpt24
-rw-r--r--ext/standard/tests/math/srand_error.phpt17
-rw-r--r--ext/standard/tests/math/tan_error.phpt1
-rw-r--r--ext/standard/tests/math/tanh_error.phpt1
-rw-r--r--ext/standard/tests/network/gethostbyaddr_error.phpt60
-rw-r--r--ext/standard/tests/network/gethostbynamel_error.phpt44
-rw-r--r--ext/standard/tests/reg/ereg_basic_001.phpt127
-rw-r--r--ext/standard/tests/reg/ereg_basic_002.phpt56
-rw-r--r--ext/standard/tests/reg/ereg_basic_003.phpt25
-rw-r--r--ext/standard/tests/reg/ereg_basic_004.phpt33
-rw-r--r--ext/standard/tests/reg/ereg_error_001.phpt45
-rw-r--r--ext/standard/tests/reg/ereg_error_002.phpt88
-rw-r--r--ext/standard/tests/reg/ereg_replace_basic_001.phpt60
-rw-r--r--ext/standard/tests/reg/ereg_replace_basic_002.phpt30
-rw-r--r--ext/standard/tests/reg/ereg_replace_error_001.phpt42
-rw-r--r--ext/standard/tests/reg/ereg_replace_error_002.phpt76
-rw-r--r--ext/standard/tests/reg/ereg_replace_variation_001.phpt175
-rw-r--r--ext/standard/tests/reg/ereg_replace_variation_002.phpt163
-rw-r--r--ext/standard/tests/reg/ereg_replace_variation_003.phpt169
-rw-r--r--ext/standard/tests/reg/ereg_variation_001.phpt178
-rw-r--r--ext/standard/tests/reg/ereg_variation_002.phpt169
-rw-r--r--ext/standard/tests/reg/ereg_variation_003.phpt283
-rw-r--r--ext/standard/tests/reg/ereg_variation_004.phpt18
-rw-r--r--ext/standard/tests/reg/eregi_basic.phpt41
-rw-r--r--ext/standard/tests/reg/eregi_basic_001.phpt127
-rw-r--r--ext/standard/tests/reg/eregi_basic_002.phpt56
-rw-r--r--ext/standard/tests/reg/eregi_basic_003.phpt25
-rw-r--r--ext/standard/tests/reg/eregi_basic_004.phpt31
-rw-r--r--ext/standard/tests/reg/eregi_error_001.phpt45
-rw-r--r--ext/standard/tests/reg/eregi_error_002.phpt88
-rw-r--r--ext/standard/tests/reg/eregi_replace_basic.phpt36
-rw-r--r--ext/standard/tests/reg/eregi_replace_basic_001.phpt60
-rw-r--r--ext/standard/tests/reg/eregi_replace_basic_002.phpt28
-rw-r--r--ext/standard/tests/reg/eregi_replace_error_001.phpt42
-rw-r--r--ext/standard/tests/reg/eregi_replace_error_002.phpt76
-rw-r--r--ext/standard/tests/reg/eregi_replace_variation_001.phpt175
-rw-r--r--ext/standard/tests/reg/eregi_replace_variation_002.phpt163
-rw-r--r--ext/standard/tests/reg/eregi_replace_variation_003.phpt169
-rw-r--r--ext/standard/tests/reg/eregi_variation_001.phpt178
-rw-r--r--ext/standard/tests/reg/eregi_variation_002.phpt169
-rw-r--r--ext/standard/tests/reg/eregi_variation_003.phpt283
-rw-r--r--ext/standard/tests/reg/eregi_variation_004.phpt18
-rw-r--r--ext/standard/tests/reg/regular_expressions.inc24
-rw-r--r--ext/standard/tests/reg/split_basic_001.phpt129
-rw-r--r--ext/standard/tests/reg/split_basic_002.phpt227
-rw-r--r--ext/standard/tests/reg/split_basic_003.phpt48
-rw-r--r--ext/standard/tests/reg/split_error_001.phpt41
-rw-r--r--ext/standard/tests/reg/split_error_002.phpt88
-rw-r--r--ext/standard/tests/reg/split_variation_001.phpt256
-rw-r--r--ext/standard/tests/reg/split_variation_002.phpt268
-rw-r--r--ext/standard/tests/reg/split_variation_003.phpt225
-rw-r--r--ext/standard/tests/reg/split_variation_004.phpt40
-rw-r--r--ext/standard/tests/reg/spliti_basic_001.phpt129
-rw-r--r--ext/standard/tests/reg/spliti_basic_002.phpt227
-rw-r--r--ext/standard/tests/reg/spliti_basic_003.phpt43
-rw-r--r--ext/standard/tests/reg/spliti_basic_004.phpt45
-rw-r--r--ext/standard/tests/reg/spliti_error_001.phpt41
-rw-r--r--ext/standard/tests/reg/spliti_error_002.phpt88
-rw-r--r--ext/standard/tests/reg/spliti_variation_001.phpt256
-rw-r--r--ext/standard/tests/reg/spliti_variation_002.phpt270
-rw-r--r--ext/standard/tests/reg/spliti_variation_003.phpt225
-rw-r--r--ext/standard/tests/reg/spliti_variation_004.phpt40
-rw-r--r--ext/standard/tests/reg/sql_regcase_basic_001.phpt25
-rw-r--r--ext/standard/tests/reg/sql_regcase_error_001.phpt37
-rw-r--r--ext/standard/tests/reg/sql_regcase_variation_001.phpt167
-rwxr-xr-xext/standard/tests/serialize/005.phpt2
-rw-r--r--ext/standard/tests/serialize/bug43614.phpt21
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_001.phpt108
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_002.phpt544
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_003.phpt294
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_004.phpt474
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_005.phpt571
-rw-r--r--ext/standard/tests/serialize/serialization_error_001.phpt42
-rw-r--r--ext/standard/tests/serialize/serialization_miscTypes_001.phptbin0 -> 7686 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_001.phptbin0 -> 2373 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_002.phptbin0 -> 7192 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_003.phpt67
-rw-r--r--ext/standard/tests/serialize/serialization_objects_004.phpt49
-rw-r--r--ext/standard/tests/serialize/serialization_objects_005.phpt120
-rw-r--r--ext/standard/tests/serialize/serialization_objects_006.phpt28
-rw-r--r--ext/standard/tests/serialize/serialization_objects_007.phpt42
-rw-r--r--ext/standard/tests/serialize/serialization_objects_008.phpt28
-rw-r--r--ext/standard/tests/serialize/serialization_objects_009.phpt36
-rw-r--r--ext/standard/tests/serialize/serialization_objects_010.phpt37
-rw-r--r--ext/standard/tests/serialize/serialization_objects_011.phpt196
-rw-r--r--ext/standard/tests/serialize/serialization_objects_012.phpt244
-rw-r--r--ext/standard/tests/serialize/serialization_objects_013.phpt494
-rw-r--r--ext/standard/tests/serialize/serialization_objects_014.phpt295
-rw-r--r--ext/standard/tests/serialize/serialization_objects_015.phpt532
-rw-r--r--ext/standard/tests/serialize/serialization_precision_001.phpt21
-rw-r--r--ext/standard/tests/serialize/serialization_precision_002.phpt21
-rw-r--r--ext/standard/tests/serialize/serialization_resources_001.phpt30
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt50
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt33
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_error.phpt57
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt510
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt135
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt71
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt77
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_process_basic-win32.phpt43
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt43
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt27
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt110
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt108
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt86
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt89
-rw-r--r--ext/standard/tests/streams/stream_set_timeout_error.phpt79
-rw-r--r--ext/standard/tests/strings/bug37262.phpt2
-rw-r--r--ext/standard/tests/strings/bug43927.phpt12
-rw-r--r--ext/standard/tests/strings/bug44242.phpt14
-rw-r--r--ext/standard/tests/strings/bug44703.phpt48
-rw-r--r--ext/standard/tests/strings/chunk_split_variation1.phpt334
-rw-r--r--ext/standard/tests/strings/chunk_split_variation2.phpt346
-rw-r--r--ext/standard/tests/strings/chunk_split_variation3.phpt316
-rw-r--r--ext/standard/tests/strings/crc32_variation1.phpt393
-rw-r--r--ext/standard/tests/strings/explode.phpt9
-rw-r--r--ext/standard/tests/strings/join_variation1.phpt334
-rw-r--r--ext/standard/tests/strings/setlocale_basic1.phpt4
-rw-r--r--ext/standard/tests/strings/setlocale_variation4.phpt3
-rw-r--r--ext/standard/tests/strings/setlocale_variation5.phpt3
-rw-r--r--ext/standard/tests/strings/sprintf_variation1.phpt18
-rw-r--r--ext/standard/tests/strings/sprintf_variation11.phpt10
-rw-r--r--ext/standard/tests/strings/sprintf_variation16.phpt96
-rw-r--r--ext/standard/tests/strings/sprintf_variation17.phpt10
-rw-r--r--ext/standard/tests/strings/sprintf_variation18.phpt2
-rw-r--r--ext/standard/tests/strings/sprintf_variation2.phpt16
-rw-r--r--ext/standard/tests/strings/sprintf_variation30.phpt14
-rw-r--r--ext/standard/tests/strings/sprintf_variation42.phpt14
-rw-r--r--ext/standard/tests/strings/sprintf_variation48.phpt38
-rw-r--r--ext/standard/tests/strings/sprintf_variation5.phpt17
-rw-r--r--ext/standard/tests/strings/str_replace.phpt17
-rw-r--r--ext/standard/tests/strings/strcspn_variation1.phpt549
-rw-r--r--ext/standard/tests/strings/strcspn_variation2.phpt546
-rw-r--r--ext/standard/tests/strings/strcspn_variation3.phpt16
-rw-r--r--ext/standard/tests/strings/strcspn_variation4.phpt394
-rw-r--r--ext/standard/tests/strings/stripos_variation10.phpt6
-rw-r--r--ext/standard/tests/strings/strpos.phptbin9396 -> 9368 bytes
-rw-r--r--ext/standard/tests/strings/strpos_number.phpt15
-rw-r--r--ext/standard/tests/strings/strrchr_variation10.phpt6
-rw-r--r--ext/standard/tests/strings/strrchr_variation11.phpt8
-rw-r--r--ext/standard/tests/strings/strrpos_variation10.phpt6
-rw-r--r--ext/standard/tests/strings/strspn_variation1.phpt548
-rw-r--r--ext/standard/tests/strings/strspn_variation2.phpt66
-rw-r--r--ext/standard/tests/strings/strspn_variation3.phpt16
-rw-r--r--ext/standard/tests/strings/strspn_variation4.phpt16
-rw-r--r--ext/standard/tests/strings/strstr.phptbin10387 -> 10369 bytes
-rw-r--r--ext/standard/tests/strings/strtok_variation1.phpt344
-rw-r--r--ext/standard/tests/strings/ucwords_variation1.phpt12
-rw-r--r--ext/standard/tests/strings/vsprintf_variation1.phpt8
-rw-r--r--ext/standard/tests/strings/vsprintf_variation2.phpt10
-rw-r--r--ext/standard/tests/strings/wordwrap_variation1.phpt26
-rw-r--r--ext/standard/tests/strings/wordwrap_variation3.phpt16
-rw-r--r--ext/standard/tests/url/base64_decode_basic_001.phpt24
-rw-r--r--ext/standard/tests/url/base64_decode_basic_002.phpt47
-rw-r--r--ext/standard/tests/url/base64_decode_error_001.phpt38
-rw-r--r--ext/standard/tests/url/base64_decode_variation_001.phpt167
-rw-r--r--ext/standard/tests/url/base64_decode_variation_002.phpt177
-rw-r--r--ext/standard/tests/url/base64_encode_basic_001.phpt283
-rw-r--r--ext/standard/tests/url/base64_encode_error_001.phpt37
-rw-r--r--ext/standard/tests/url/base64_encode_variation_001.phpt167
-rw-r--r--ext/standard/tests/url/parse_url_basic_001.phpt899
-rw-r--r--ext/standard/tests/url/parse_url_basic_002.phpt151
-rw-r--r--ext/standard/tests/url/parse_url_basic_003.phpt150
-rw-r--r--ext/standard/tests/url/parse_url_basic_004.phpt150
-rw-r--r--ext/standard/tests/url/parse_url_basic_005.phpt150
-rw-r--r--ext/standard/tests/url/parse_url_basic_006.phpt150
-rw-r--r--ext/standard/tests/url/parse_url_basic_007.phpt150
-rw-r--r--ext/standard/tests/url/parse_url_basic_008.phpt150
-rw-r--r--ext/standard/tests/url/parse_url_basic_009.phpt150
-rw-r--r--ext/standard/tests/url/parse_url_basic_010.phpt31
-rw-r--r--ext/standard/tests/url/parse_url_error_001.phpt38
-rw-r--r--ext/standard/tests/url/parse_url_error_002.phpt47
-rw-r--r--ext/standard/tests/url/parse_url_variation_001.phpt221
-rw-r--r--ext/standard/tests/url/parse_url_variation_002_32bit.phpt200
-rw-r--r--ext/standard/tests/url/parse_url_variation_002_64bit.phpt184
-rw-r--r--ext/standard/tests/url/rawurldecode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/rawurldecode_variation_001.phpt168
-rw-r--r--ext/standard/tests/url/rawurlencode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/rawurlencode_variation_001.phpt168
-rw-r--r--ext/standard/tests/url/urldecode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/urldecode_variation_001.phpt168
-rw-r--r--ext/standard/tests/url/urlencode_error_001.phpt39
-rw-r--r--ext/standard/tests/url/urlencode_variation_001.phpt168
-rw-r--r--ext/standard/tests/url/urls.inc109
-rw-r--r--ext/standard/type.c4
-rw-r--r--ext/standard/uniqid.c4
-rw-r--r--ext/standard/uniqid.h4
-rw-r--r--ext/standard/url.c4
-rw-r--r--ext/standard/url.h4
-rw-r--r--ext/standard/url_scanner.c4
-rw-r--r--ext/standard/url_scanner.h4
-rw-r--r--ext/standard/url_scanner_ex.c4
-rw-r--r--ext/standard/url_scanner_ex.c.orig4
-rw-r--r--ext/standard/url_scanner_ex.h4
-rw-r--r--ext/standard/url_scanner_ex.re4
-rw-r--r--ext/standard/user_filters.c4
-rw-r--r--ext/standard/uuencode.c4
-rw-r--r--ext/standard/var.c24
-rw-r--r--ext/standard/var_unserializer.c6
-rw-r--r--ext/standard/var_unserializer.c.orig6
-rw-r--r--ext/standard/var_unserializer.re6
-rw-r--r--ext/standard/versioning.c4
-rw-r--r--ext/sybase/php_sybase_db.c4
-rw-r--r--ext/sybase/php_sybase_db.h4
-rw-r--r--ext/sybase_ct/php_sybase_ct.c4
-rw-r--r--ext/sybase_ct/php_sybase_ct.h4
-rw-r--r--ext/sysvmsg/php_sysvmsg.h4
-rw-r--r--ext/sysvmsg/sysvmsg.c6
-rw-r--r--ext/sysvsem/php_sysvsem.h4
-rw-r--r--ext/sysvsem/sysvsem.c4
-rw-r--r--ext/sysvshm/php_sysvshm.h4
-rw-r--r--ext/sysvshm/sysvshm.c4
-rw-r--r--ext/tidy/php_tidy.h4
-rw-r--r--ext/tidy/tidy.c6
-rw-r--r--ext/tokenizer/php_tokenizer.h4
-rw-r--r--ext/tokenizer/tests/token_get_all_basic.phpt97
-rw-r--r--ext/tokenizer/tests/token_get_all_error.phpt35
-rw-r--r--ext/tokenizer/tests/token_get_all_variation1.phpt285
-rw-r--r--ext/tokenizer/tests/token_get_all_variation10.phpt781
-rw-r--r--ext/tokenizer/tests/token_get_all_variation11.phpt1147
-rw-r--r--ext/tokenizer/tests/token_get_all_variation12.phpt532
-rw-r--r--ext/tokenizer/tests/token_get_all_variation13.phpt1167
-rw-r--r--ext/tokenizer/tests/token_get_all_variation14.phpt289
-rw-r--r--ext/tokenizer/tests/token_get_all_variation15.phpt778
-rw-r--r--ext/tokenizer/tests/token_get_all_variation16.phpt1001
-rw-r--r--ext/tokenizer/tests/token_get_all_variation17.phpt611
-rw-r--r--ext/tokenizer/tests/token_get_all_variation18.phpt118
-rw-r--r--ext/tokenizer/tests/token_get_all_variation19.phpt88
-rw-r--r--ext/tokenizer/tests/token_get_all_variation2.phpt429
-rw-r--r--ext/tokenizer/tests/token_get_all_variation3.phpt568
-rw-r--r--ext/tokenizer/tests/token_get_all_variation4.phpt747
-rw-r--r--ext/tokenizer/tests/token_get_all_variation5.phpt798
-rw-r--r--ext/tokenizer/tests/token_get_all_variation6.phpt392
-rw-r--r--ext/tokenizer/tests/token_get_all_variation7.phpt259
-rw-r--r--ext/tokenizer/tests/token_get_all_variation8.phpt832
-rw-r--r--ext/tokenizer/tests/token_get_all_variation9.phpt441
-rw-r--r--ext/tokenizer/tokenizer.c4
-rw-r--r--ext/tokenizer/tokenizer_data.c4
-rw-r--r--ext/wddx/php_wddx.h4
-rw-r--r--ext/wddx/php_wddx_api.h4
-rw-r--r--ext/wddx/tests/001-64bit.phpt62
-rw-r--r--ext/wddx/tests/001.phpt3
-rw-r--r--ext/wddx/wddx.c4
-rw-r--r--ext/xml/compat.c2
-rw-r--r--ext/xml/expat_compat.h4
-rw-r--r--ext/xml/php_xml.h4
-rw-r--r--ext/xml/tests/bug43957.phpt13
-rw-r--r--ext/xml/xml.c22
-rw-r--r--ext/xmlreader/php_xmlreader.c4
-rw-r--r--ext/xmlreader/php_xmlreader.h4
-rw-r--r--ext/xmlrpc/php_xmlrpc.h4
-rw-r--r--ext/xmlrpc/tests/bug42736.phpt56
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c9
-rw-r--r--ext/xmlwriter/php_xmlwriter.c4
-rw-r--r--ext/xmlwriter/php_xmlwriter.h4
-rw-r--r--ext/xsl/php_xsl.c4
-rw-r--r--ext/xsl/php_xsl.h4
-rw-r--r--ext/xsl/xsl_fe.h4
-rw-r--r--ext/xsl/xsltprocessor.c75
-rw-r--r--ext/zip/Makefile.frag28
-rw-r--r--ext/zip/config.m410
-rw-r--r--ext/zip/config.w323
-rw-r--r--ext/zip/lib/zip.h103
-rw-r--r--ext/zip/lib/zip_add.c2
-rw-r--r--ext/zip/lib/zip_add_dir.c4
-rw-r--r--ext/zip/lib/zip_alias.h45
-rw-r--r--ext/zip/lib/zip_close.c2
-rw-r--r--ext/zip/lib/zip_delete.c2
-rw-r--r--ext/zip/lib/zip_dirent.c18
-rw-r--r--ext/zip/lib/zip_entry_free.c2
-rw-r--r--ext/zip/lib/zip_entry_new.c2
-rw-r--r--ext/zip/lib/zip_error.c14
-rw-r--r--ext/zip/lib/zip_error_clear.c4
-rw-r--r--ext/zip/lib/zip_error_get.c2
-rw-r--r--ext/zip/lib/zip_error_get_sys_type.c2
-rw-r--r--ext/zip/lib/zip_error_strerror.c2
-rw-r--r--ext/zip/lib/zip_error_to_str.c2
-rw-r--r--ext/zip/lib/zip_fclose.c2
-rw-r--r--ext/zip/lib/zip_file_error_clear.c4
-rw-r--r--ext/zip/lib/zip_file_error_get.c2
-rw-r--r--ext/zip/lib/zip_file_get_offset.c2
-rw-r--r--ext/zip/lib/zip_file_strerror.c2
-rw-r--r--ext/zip/lib/zip_fopen.c2
-rw-r--r--ext/zip/lib/zip_fopen_index.c4
-rw-r--r--ext/zip/lib/zip_fread.c2
-rw-r--r--ext/zip/lib/zip_free.c2
-rw-r--r--ext/zip/lib/zip_get_archive_comment.c2
-rw-r--r--ext/zip/lib/zip_get_file_comment.c2
-rw-r--r--ext/zip/lib/zip_get_name.c4
-rw-r--r--ext/zip/lib/zip_get_num_files.c2
-rw-r--r--ext/zip/lib/zip_memdup.c2
-rw-r--r--ext/zip/lib/zip_name_locate.c11
-rw-r--r--ext/zip/lib/zip_new.c2
-rw-r--r--ext/zip/lib/zip_open.c4
-rw-r--r--ext/zip/lib/zip_rename.c2
-rw-r--r--ext/zip/lib/zip_replace.c4
-rw-r--r--ext/zip/lib/zip_set_archive_comment.c2
-rw-r--r--ext/zip/lib/zip_set_file_comment.c2
-rw-r--r--ext/zip/lib/zip_set_name.c2
-rw-r--r--ext/zip/lib/zip_source_buffer.c4
-rw-r--r--ext/zip/lib/zip_source_file.c2
-rw-r--r--ext/zip/lib/zip_source_filep.c4
-rw-r--r--ext/zip/lib/zip_source_free.c2
-rw-r--r--ext/zip/lib/zip_source_function.c2
-rw-r--r--ext/zip/lib/zip_source_zip.c2
-rw-r--r--ext/zip/lib/zip_stat.c2
-rw-r--r--ext/zip/lib/zip_stat_index.c2
-rw-r--r--ext/zip/lib/zip_stat_init.c2
-rw-r--r--ext/zip/lib/zip_strerror.c2
-rw-r--r--ext/zip/lib/zip_unchange.c4
-rw-r--r--ext/zip/lib/zip_unchange_all.c2
-rw-r--r--ext/zip/lib/zip_unchange_archive.c2
-rw-r--r--ext/zip/lib/zip_unchange_data.c2
-rw-r--r--ext/zip/lib/zip_win32.h7
-rw-r--r--ext/zip/lib/zipint.h77
-rw-r--r--ext/zip/lib/zipint_alias.h49
-rw-r--r--ext/zip/php_zip.c122
-rw-r--r--ext/zip/php_zip.h6
-rw-r--r--ext/zip/tests/oo_properties.phpt4
-rw-r--r--ext/zlib/php_zlib.h4
-rw-r--r--ext/zlib/tests/bug.tarbin0 -> 4720640 bytes
-rw-r--r--ext/zlib/tests/bug_40189.phpt25
-rw-r--r--ext/zlib/tests/bug_40189_2.phpt14
-rw-r--r--ext/zlib/tests/zlib_filter_inflate2.phpt41
-rw-r--r--ext/zlib/zlib.c4
-rw-r--r--ext/zlib/zlib_filter.c84
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c4
2089 files changed, 141125 insertions, 9456 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index b09b5f50e..d99a16a33 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bcmath.c,v 1.62.2.2.2.8 2007/06/08 00:41:57 iliaa Exp $ */
+/* $Id: bcmath.c,v 1.62.2.2.2.9 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
index c3d4b6915..097dc2812 100644
--- a/ext/bcmath/php_bcmath.h
+++ b/ext/bcmath/php_bcmath.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_bcmath.h,v 1.20.2.1.2.2 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: php_bcmath.h,v 1.20.2.1.2.3 2007/12/31 07:20:04 sebastian Exp $ */
#ifndef PHP_BCMATH_H
#define PHP_BCMATH_H
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index 1b1d38d70..74edd2d7a 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bz2.c,v 1.14.2.3.2.12 2007/03/14 03:50:18 iliaa Exp $ */
+/* $Id: bz2.c,v 1.14.2.3.2.13 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index eaca6cd48..63ca109f2 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bz2_filter.c,v 1.3.2.2.2.5 2007/08/09 23:27:22 iliaa Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.9 2008/01/12 22:04:03 cellog Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -101,11 +101,6 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
consumed += desired;
bin += desired;
- if (!desired) {
- flags |= PSFS_FLAG_FLUSH_CLOSE;
- break;
- }
-
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -114,6 +109,10 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
data->strm.avail_out = data->outbuf_len;
data->strm.next_out = data->outbuf;
exit_status = PSFS_PASS_ON;
+ } else if (status == BZ_STREAM_END && data->strm.avail_out >= data->outbuf_len) {
+ /* no more data to decompress, and nothing was spat out */
+ php_stream_bucket_delref(bucket TSRMLS_CC);
+ return PSFS_PASS_ON;
}
}
php_stream_bucket_delref(bucket TSRMLS_CC);
@@ -132,6 +131,8 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
data->strm.avail_out = data->outbuf_len;
data->strm.next_out = data->outbuf;
exit_status = PSFS_PASS_ON;
+ } else if (status == BZ_OK) {
+ break;
}
}
}
diff --git a/ext/bz2/php_bz2.h b/ext/bz2/php_bz2.h
index a547f8c5c..fe3132ef4 100644
--- a/ext/bz2/php_bz2.h
+++ b/ext/bz2/php_bz2.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_bz2.h,v 1.7.2.1.2.4 2007/09/12 11:44:25 jani Exp $ */
+/* $Id: php_bz2.h,v 1.7.2.1.2.5 2007/12/31 07:20:04 sebastian Exp $ */
#ifndef PHP_BZ2_H
#define PHP_BZ2_H
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
index 4efe16eee..be0e0c5a2 100644
--- a/ext/calendar/cal_unix.c
+++ b/ext/calendar/cal_unix.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 2e914ae42..b20edb5e0 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
| Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: calendar.c,v 1.46.2.2.2.4 2007/02/16 18:32:38 stas Exp $ */
+/* $Id: calendar.c,v 1.46.2.2.2.5 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
index ed28931ae..bd787de42 100644
--- a/ext/calendar/easter.c
+++ b/ext/calendar/easter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index 28b4b2ec5..473c34a37 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_com.c,v 1.16.2.2.2.5 2007/04/09 15:32:08 dmitry Exp $ */
+/* $Id: com_com.c,v 1.16.2.2.2.6 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index adcb330be..68f0b419e 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_dotnet.c,v 1.14.2.1.2.4 2007/02/21 01:11:11 stas Exp $ */
+/* $Id: com_dotnet.c,v 1.14.2.1.2.5 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index ae8b73c73..739943fca 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_extension.c,v 1.17.2.2.2.6 2007/03/05 15:49:00 wharmby Exp $ */
+/* $Id: com_extension.c,v 1.17.2.2.2.7 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index e277339d0..388ec7847 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_handlers.c,v 1.30.2.5.2.6 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: com_handlers.c,v 1.30.2.5.2.7 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c
index 90ab03ef1..9f540cd6a 100644
--- a/ext/com_dotnet/com_iterator.c
+++ b/ext/com_dotnet/com_iterator.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_iterator.c,v 1.9.2.2.2.2 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: com_iterator.c,v 1.9.2.2.2.3 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c
index 7ee866f98..10ac789e7 100644
--- a/ext/com_dotnet/com_misc.c
+++ b/ext/com_dotnet/com_misc.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_misc.c,v 1.8.2.2.2.3 2007/02/02 15:44:06 wharmby Exp $ */
+/* $Id: com_misc.c,v 1.8.2.2.2.4 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_olechar.c b/ext/com_dotnet/com_olechar.c
index 651166537..e746fb1a6 100644
--- a/ext/com_dotnet/com_olechar.c
+++ b/ext/com_dotnet/com_olechar.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_olechar.c,v 1.5.2.1.2.3 2007/02/21 01:13:44 stas Exp $ */
+/* $Id: com_olechar.c,v 1.5.2.1.2.4 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c
index 49a21651e..127d86b13 100755
--- a/ext/com_dotnet/com_persist.c
+++ b/ext/com_dotnet/com_persist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_persist.c,v 1.5.2.3.2.2 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: com_persist.c,v 1.5.2.3.2.3 2007/12/31 07:20:04 sebastian Exp $ */
/* Infrastructure for working with persistent COM objects.
* Implements: IStream* wrapper for PHP streams.
diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c
index c08ee5b3a..ec6945418 100644
--- a/ext/com_dotnet/com_saproxy.c
+++ b/ext/com_dotnet/com_saproxy.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_saproxy.c,v 1.15.2.2.2.3 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: com_saproxy.c,v 1.15.2.2.2.4 2007/12/31 07:20:04 sebastian Exp $ */
/* This module implements a SafeArray proxy which is used internally
* by the engine when resolving multi-dimensional array accesses on
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index 25ac81c96..be3e8d159 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_typeinfo.c,v 1.7.2.1.2.3 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: com_typeinfo.c,v 1.7.2.1.2.4 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c
index b60463b78..4b2b83cf4 100644
--- a/ext/com_dotnet/com_variant.c
+++ b/ext/com_dotnet/com_variant.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_variant.c,v 1.11.2.2.2.6 2007/04/09 15:32:35 dmitry Exp $ */
+/* $Id: com_variant.c,v 1.11.2.2.2.7 2007/12/31 07:20:04 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c
index a9f9afd8f..193c5a14f 100644
--- a/ext/com_dotnet/com_wrapper.c
+++ b/ext/com_dotnet/com_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_wrapper.c,v 1.9.2.1.2.5 2007/03/05 15:49:00 wharmby Exp $ */
+/* $Id: com_wrapper.c,v 1.9.2.1.2.6 2007/12/31 07:20:05 sebastian Exp $ */
/* This module exports a PHP object as a COM object by wrapping it
* using IDispatchEx */
diff --git a/ext/com_dotnet/php_com_dotnet.h b/ext/com_dotnet/php_com_dotnet.h
index d0f8d3c9f..3ae43efc1 100644
--- a/ext/com_dotnet/php_com_dotnet.h
+++ b/ext/com_dotnet/php_com_dotnet.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_com_dotnet.h,v 1.5.2.1.2.2 2007/03/05 15:49:00 wharmby Exp $ */
+/* $Id: php_com_dotnet.h,v 1.5.2.1.2.3 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef PHP_COM_DOTNET_H
#define PHP_COM_DOTNET_H
diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h
index ba8dbf642..00408f4d1 100644
--- a/ext/com_dotnet/php_com_dotnet_internal.h
+++ b/ext/com_dotnet/php_com_dotnet_internal.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_com_dotnet_internal.h,v 1.14.2.3.2.4 2007/02/02 15:27:35 wharmby Exp $ */
+/* $Id: php_com_dotnet_internal.h,v 1.14.2.3.2.5 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef PHP_COM_DOTNET_INTERNAL_H
#define PHP_COM_DOTNET_INTERNAL_H
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index fb1af418c..823136397 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/ctype/php_ctype.h b/ext/ctype/php_ctype.h
index 615bd7225..c13c11935 100644
--- a/ext/ctype/php_ctype.h
+++ b/ext/ctype/php_ctype.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/ctype/tests/ctype_alnum_basic.phpt b/ext/ctype/tests/ctype_alnum_basic.phpt
new file mode 100644
index 000000000..32da928c2
--- /dev/null
+++ b/ext/ctype/tests/ctype_alnum_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_alnum() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_alnum(mixed $c)
+ * Description: Checks for alphanumeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_alnum() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = 'abcXYZ';
+$c2 = ' \t*@';
+
+var_dump(ctype_alnum($c1));
+var_dump(ctype_alnum($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alnum() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_error.phpt b/ext/ctype/tests/ctype_alnum_error.phpt
new file mode 100644
index 000000000..9ced2d7c7
--- /dev/null
+++ b/ext/ctype/tests/ctype_alnum_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test ctype_alnum() function : error conditions - Incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_alnum(mixed $c)
+ * Description: Checks for alphanumeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass incorrect number of arguments to ctype_alnum() to test behaviour
+ */
+
+echo "*** Testing ctype_alnum() : error conditions ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+// Zero arguments
+echo "\n-- Testing ctype_alnum() function with Zero arguments --\n";
+var_dump( ctype_alnum() );
+
+//Test ctype_alnum with one more than the expected number of arguments
+echo "\n-- Testing ctype_alnum() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_alnum($c, $extra_arg) );
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alnum() : error conditions ***
+
+-- Testing ctype_alnum() function with Zero arguments --
+
+Warning: ctype_alnum() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_alnum() function with more than expected no. of arguments --
+
+Warning: ctype_alnum() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation1.phpt b/ext/ctype/tests/ctype_alnum_variation1.phpt
new file mode 100644
index 000000000..3f6730748
--- /dev/null
+++ b/ext/ctype/tests/ctype_alnum_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_alnum() function : usage variations - Different data types as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_alnum(mixed $c)
+ * Description: Checks for alphanumeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_alnum() to test behaviour
+ */
+
+echo "*** Testing ctype_alnum() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "xyz";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+123
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "pqr",
+ 'LMN',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_alnum()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_alnum($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alnum() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation2.phpt b/ext/ctype/tests/ctype_alnum_variation2.phpt
new file mode 100644
index 000000000..c360e676c
--- /dev/null
+++ b/ext/ctype/tests/ctype_alnum_variation2.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test ctype_alnum() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_alnum(mixed $c)
+ * Description: Checks for alphanumeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_alnum() to test which character codes are considered
+ * valid alphanumeric characters
+ */
+
+echo "*** Testing ctype_alnum() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_alnum($i)) {
+ echo "character code $i is alpha numeric\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alnum() : usage variations ***
+character code 48 is alpha numeric
+character code 49 is alpha numeric
+character code 50 is alpha numeric
+character code 51 is alpha numeric
+character code 52 is alpha numeric
+character code 53 is alpha numeric
+character code 54 is alpha numeric
+character code 55 is alpha numeric
+character code 56 is alpha numeric
+character code 57 is alpha numeric
+character code 65 is alpha numeric
+character code 66 is alpha numeric
+character code 67 is alpha numeric
+character code 68 is alpha numeric
+character code 69 is alpha numeric
+character code 70 is alpha numeric
+character code 71 is alpha numeric
+character code 72 is alpha numeric
+character code 73 is alpha numeric
+character code 74 is alpha numeric
+character code 75 is alpha numeric
+character code 76 is alpha numeric
+character code 77 is alpha numeric
+character code 78 is alpha numeric
+character code 79 is alpha numeric
+character code 80 is alpha numeric
+character code 81 is alpha numeric
+character code 82 is alpha numeric
+character code 83 is alpha numeric
+character code 84 is alpha numeric
+character code 85 is alpha numeric
+character code 86 is alpha numeric
+character code 87 is alpha numeric
+character code 88 is alpha numeric
+character code 89 is alpha numeric
+character code 90 is alpha numeric
+character code 97 is alpha numeric
+character code 98 is alpha numeric
+character code 99 is alpha numeric
+character code 100 is alpha numeric
+character code 101 is alpha numeric
+character code 102 is alpha numeric
+character code 103 is alpha numeric
+character code 104 is alpha numeric
+character code 105 is alpha numeric
+character code 106 is alpha numeric
+character code 107 is alpha numeric
+character code 108 is alpha numeric
+character code 109 is alpha numeric
+character code 110 is alpha numeric
+character code 111 is alpha numeric
+character code 112 is alpha numeric
+character code 113 is alpha numeric
+character code 114 is alpha numeric
+character code 115 is alpha numeric
+character code 116 is alpha numeric
+character code 117 is alpha numeric
+character code 118 is alpha numeric
+character code 119 is alpha numeric
+character code 120 is alpha numeric
+character code 121 is alpha numeric
+character code 122 is alpha numeric
+===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation3.phpt b/ext/ctype/tests/ctype_alnum_variation3.phpt
new file mode 100644
index 000000000..ee0a74836
--- /dev/null
+++ b/ext/ctype/tests/ctype_alnum_variation3.phpt
@@ -0,0 +1,127 @@
+--TEST--
+Test ctype_alnum() function : usage variations - different string values
+--FILE--
+<?php
+/* Prototype : bool ctype_alnum(mixed $c)
+ * Description: Checks for alphanumeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different strings to ctype_alnum to test behaviour
+ */
+
+echo "*** Testing ctype_alnum() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ 'abc123\n',
+/*20*/ 'abc 123',
+ '',
+ ' ',
+/*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters
+);
+
+
+// loop through each element of $values to test behaviour of ctype_alnum()
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_alnum($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alnum() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation4.phpt b/ext/ctype/tests/ctype_alnum_variation4.phpt
new file mode 100644
index 000000000..d56c925c7
--- /dev/null
+++ b/ext/ctype/tests/ctype_alnum_variation4.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test ctype_alnum() function : usage variations - octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_alnum(mixed $c)
+ * Description: Checks for alphanumeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values to ctype_alnum() to test behaviour
+ */
+
+echo "*** Testing ctype_alnum() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array (060, 061, 062, 063);
+$hex_values = array(0x30, 0x31, 0x32, 0x33);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alnum($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alnum($c));
+ $iterator++;
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alnum() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_basic.phpt b/ext/ctype/tests/ctype_alpha_basic.phpt
new file mode 100644
index 000000000..c467bf8f6
--- /dev/null
+++ b/ext/ctype/tests/ctype_alpha_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_alpha() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_alpha(mixed $c)
+ * Description: Checks for alphabetic character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_alpha() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = 'abcXYZ';
+$c2 = "Hello, World!";
+
+var_dump(ctype_alpha($c1));
+var_dump(ctype_alpha($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alpha() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_error.phpt b/ext/ctype/tests/ctype_alpha_error.phpt
new file mode 100644
index 000000000..18c2edb52
--- /dev/null
+++ b/ext/ctype/tests/ctype_alpha_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_alpha() function : error conditions - Incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : bool ctype_alpha(mixed $c)
+ * Description: Checks for alphabetic character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to ctype_alpha() to test behaviour
+ */
+
+echo "*** Testing ctype_alpha() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_alpha() function with Zero arguments --\n";
+var_dump( ctype_alpha() );
+
+//Test ctype_alpha with one more than the expected number of arguments
+echo "\n-- Testing ctype_alpha() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_alpha($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alpha() : error conditions ***
+
+-- Testing ctype_alpha() function with Zero arguments --
+
+Warning: ctype_alpha() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_alpha() function with more than expected no. of arguments --
+
+Warning: ctype_alpha() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation1.phpt b/ext/ctype/tests/ctype_alpha_variation1.phpt
new file mode 100644
index 000000000..98c64a16e
--- /dev/null
+++ b/ext/ctype/tests/ctype_alpha_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_alpha() function : usage variations - different data types as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_alpha(mixed $c)
+ * Description: Checks for alphabetic character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_alpha() to test behaviour
+ */
+
+echo "*** Testing ctype_alpha() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "abcdef";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+XYZ
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_alpha()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_alpha($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alpha() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation2.phpt b/ext/ctype/tests/ctype_alpha_variation2.phpt
new file mode 100644
index 000000000..ea3afc2be
--- /dev/null
+++ b/ext/ctype/tests/ctype_alpha_variation2.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test ctype_alpha() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_alpha(mixed $c)
+ * Description: Checks for alphabetic character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_alpha() to test which character codes are considered
+ * valid alphabetic characters
+ */
+
+echo "*** Testing ctype_alpha() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_alpha($i)) {
+ echo "character code $i is alphabetic\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alpha() : usage variations ***
+character code 65 is alphabetic
+character code 66 is alphabetic
+character code 67 is alphabetic
+character code 68 is alphabetic
+character code 69 is alphabetic
+character code 70 is alphabetic
+character code 71 is alphabetic
+character code 72 is alphabetic
+character code 73 is alphabetic
+character code 74 is alphabetic
+character code 75 is alphabetic
+character code 76 is alphabetic
+character code 77 is alphabetic
+character code 78 is alphabetic
+character code 79 is alphabetic
+character code 80 is alphabetic
+character code 81 is alphabetic
+character code 82 is alphabetic
+character code 83 is alphabetic
+character code 84 is alphabetic
+character code 85 is alphabetic
+character code 86 is alphabetic
+character code 87 is alphabetic
+character code 88 is alphabetic
+character code 89 is alphabetic
+character code 90 is alphabetic
+character code 97 is alphabetic
+character code 98 is alphabetic
+character code 99 is alphabetic
+character code 100 is alphabetic
+character code 101 is alphabetic
+character code 102 is alphabetic
+character code 103 is alphabetic
+character code 104 is alphabetic
+character code 105 is alphabetic
+character code 106 is alphabetic
+character code 107 is alphabetic
+character code 108 is alphabetic
+character code 109 is alphabetic
+character code 110 is alphabetic
+character code 111 is alphabetic
+character code 112 is alphabetic
+character code 113 is alphabetic
+character code 114 is alphabetic
+character code 115 is alphabetic
+character code 116 is alphabetic
+character code 117 is alphabetic
+character code 118 is alphabetic
+character code 119 is alphabetic
+character code 120 is alphabetic
+character code 121 is alphabetic
+character code 122 is alphabetic
+===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation3.phpt b/ext/ctype/tests/ctype_alpha_variation3.phpt
new file mode 100644
index 000000000..3eed89795
--- /dev/null
+++ b/ext/ctype/tests/ctype_alpha_variation3.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test ctype_alpha() function : usage variations - different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_alpha(mixed $c)
+ * Description: Checks for alphabetic character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_alpha() to test
+ * which are considered valid alphabetic character only strings
+ */
+
+echo "*** Testing ctype_alpha() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ 'abc123\n',
+/*20*/ 'abc 123',
+ '',
+ ' ',
+/*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters
+);
+
+
+// loop through each element of $values to test behaviour of ctype_alnum()
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_alpha($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alpha() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- 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)
+===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation4.phpt b/ext/ctype/tests/ctype_alpha_variation4.phpt
new file mode 100644
index 000000000..cf091a7b1
--- /dev/null
+++ b/ext/ctype/tests/ctype_alpha_variation4.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test ctype_alpha() function : usage variations - Octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_alpha(mixed $c)
+ * Description: Checks for alphabetic character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values to ctype_alpha() to test behaviour
+ */
+
+echo "*** Testing ctype_alpha() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array (0101, 0102, 0103, 0104);
+$hex_values = array (0x41, 0x42, 0x43, 0x44);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alpha($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alpha($c));
+ $iterator++;
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_alpha() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_basic.phpt b/ext/ctype/tests/ctype_cntrl_basic.phpt
new file mode 100644
index 000000000..5bd977b06
--- /dev/null
+++ b/ext/ctype/tests/ctype_cntrl_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_cntrl() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_cntrl(mixed $c)
+ * Description: Checks for control character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_cntrl() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = "\r\n\t";
+$c2 = "Hello, World!\n";
+
+var_dump(ctype_cntrl($c1));
+var_dump(ctype_cntrl($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_cntrl() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_error.phpt b/ext/ctype/tests/ctype_cntrl_error.phpt
new file mode 100644
index 000000000..d089e6edf
--- /dev/null
+++ b/ext/ctype/tests/ctype_cntrl_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_cntrl() function : error conditions - Incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_cntrl(mixed $c)
+ * Description: Checks for control character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to ctype_cntrl() to test behaviour
+ */
+
+echo "*** Testing ctype_cntrl() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_cntrl() function with Zero arguments --\n";
+var_dump( ctype_cntrl() );
+
+//Test ctype_cntrl with one more than the expected number of arguments
+echo "\n-- Testing ctype_cntrl() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_cntrl($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_cntrl() : error conditions ***
+
+-- Testing ctype_cntrl() function with Zero arguments --
+
+Warning: ctype_cntrl() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_cntrl() function with more than expected no. of arguments --
+
+Warning: ctype_cntrl() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation1.phpt b/ext/ctype/tests/ctype_cntrl_variation1.phpt
new file mode 100644
index 000000000..0740d0def
--- /dev/null
+++ b/ext/ctype/tests/ctype_cntrl_variation1.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test ctype_cntrl() function : usage variations - Different data types as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_cntrl(mixed $c)
+ * Description: Checks for control character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_cntrl() to test behaviour
+ */
+
+echo "*** Testing ctype_cntrl() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "\n\r\t";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+\t\r\n
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "\t\r\n",
+ '
+',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_cntrl()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_cntrl($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_cntrl() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation2.phpt b/ext/ctype/tests/ctype_cntrl_variation2.phpt
new file mode 100644
index 000000000..a9deaab58
--- /dev/null
+++ b/ext/ctype/tests/ctype_cntrl_variation2.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test ctype_cntrl() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_cntrl(mixed $c)
+ * Description: Checks for control character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_cntrl() to test which character codes are considered
+ * valid control characters
+ */
+
+echo "*** Testing ctype_cntrl() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_cntrl($i)) {
+ echo "character code $i is control character\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_cntrl() : usage variations ***
+character code 0 is control character
+character code 1 is control character
+character code 2 is control character
+character code 3 is control character
+character code 4 is control character
+character code 5 is control character
+character code 6 is control character
+character code 7 is control character
+character code 8 is control character
+character code 9 is control character
+character code 10 is control character
+character code 11 is control character
+character code 12 is control character
+character code 13 is control character
+character code 14 is control character
+character code 15 is control character
+character code 16 is control character
+character code 17 is control character
+character code 18 is control character
+character code 19 is control character
+character code 20 is control character
+character code 21 is control character
+character code 22 is control character
+character code 23 is control character
+character code 24 is control character
+character code 25 is control character
+character code 26 is control character
+character code 27 is control character
+character code 28 is control character
+character code 29 is control character
+character code 30 is control character
+character code 31 is control character
+character code 127 is control character
+===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation3.phpt b/ext/ctype/tests/ctype_cntrl_variation3.phpt
new file mode 100644
index 000000000..6528c1c0a
--- /dev/null
+++ b/ext/ctype/tests/ctype_cntrl_variation3.phpt
@@ -0,0 +1,156 @@
+--TEST--
+Test ctype_cntrl() function : usage variations - Different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_cntrl(mixed $c)
+ * Description: Checks for control character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_cntrl() to test
+ * which are considered valid control character only strings
+ */
+
+echo "*** Testing ctype_cntrl() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ 'abc123\n',
+/*20*/ 'abc 123',
+ '',
+ ' ',
+ base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
+ "\n",
+/*25*/ "\r",
+ "\t",
+ "0xD",
+ "0xA",
+ "0xE",
+/*30*/ "\t\r\n",
+);
+
+
+// loop through each element of $values to test behaviour of ctype_cntrl()
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_cntrl($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_cntrl() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(true)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(true)
+
+-- Iteration 25 --
+bool(true)
+
+-- Iteration 26 --
+bool(true)
+
+-- Iteration 27 --
+bool(false)
+
+-- Iteration 28 --
+bool(false)
+
+-- Iteration 29 --
+bool(false)
+
+-- Iteration 30 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation4.phpt b/ext/ctype/tests/ctype_cntrl_variation4.phpt
new file mode 100644
index 000000000..38f622d46
--- /dev/null
+++ b/ext/ctype/tests/ctype_cntrl_variation4.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test ctype_cntrl() function : usage variations - Octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_cntrl(mixed $c)
+ * Description: Checks for control character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass hexadecimal and octal values to ctype_cntrl() to test behaviour
+ */
+
+echo "*** Testing ctype_cntrl() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array(01, 02, 03, 04);
+$hex_values = array(0x1, 0x2, 0x3, 0x4);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_cntrl($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_cntrl($c));
+ $iterator++;
+}
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_cntrl() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_digit_basic.phpt b/ext/ctype/tests/ctype_digit_basic.phpt
new file mode 100644
index 000000000..e39208cca
--- /dev/null
+++ b/ext/ctype/tests/ctype_digit_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_digit() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_digit(mixed $c)
+ * Description: Checks for numeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_digit() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = '1234';
+$c2 = 'abc123';
+
+var_dump(ctype_digit($c1));
+var_dump(ctype_digit($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_digit() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_digit_error.phpt b/ext/ctype/tests/ctype_digit_error.phpt
new file mode 100644
index 000000000..7f911eba6
--- /dev/null
+++ b/ext/ctype/tests/ctype_digit_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_digit() function : error conditions - incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : bool ctype_digit(mixed $c)
+ * Description: Checks for numeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to ctype_digit() to test behaviour
+ */
+
+echo "*** Testing ctype_digit() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_digit() function with Zero arguments --\n";
+var_dump( ctype_digit() );
+
+//Test ctype_digit with one more than the expected number of arguments
+echo "\n-- Testing ctype_digit() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_digit($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_digit() : error conditions ***
+
+-- Testing ctype_digit() function with Zero arguments --
+
+Warning: ctype_digit() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_digit() function with more than expected no. of arguments --
+
+Warning: ctype_digit() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation1.phpt b/ext/ctype/tests/ctype_digit_variation1.phpt
new file mode 100644
index 000000000..626dcee6c
--- /dev/null
+++ b/ext/ctype/tests/ctype_digit_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_digit() function : usage variations - different data types as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_digit(mixed $c)
+ * Description: Checks for numeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_digit() to test behaviour
+ */
+
+echo "*** Testing ctype_digit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "123456";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+1
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "2",
+ '309',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_digit()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_digit($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_digit() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation2.phpt b/ext/ctype/tests/ctype_digit_variation2.phpt
new file mode 100644
index 000000000..e7b911571
--- /dev/null
+++ b/ext/ctype/tests/ctype_digit_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test ctype_digit() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_digit(mixed $c)
+ * Description: Checks for numeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_digit() to test which character codes are considered
+ * valid decimal digits
+ */
+
+echo "*** Testing ctype_digit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_digit($i)) {
+ echo "character code $i is a numeric digit\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_digit() : usage variations ***
+character code 48 is a numeric digit
+character code 49 is a numeric digit
+character code 50 is a numeric digit
+character code 51 is a numeric digit
+character code 52 is a numeric digit
+character code 53 is a numeric digit
+character code 54 is a numeric digit
+character code 55 is a numeric digit
+character code 56 is a numeric digit
+character code 57 is a numeric digit
+===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation3.phpt b/ext/ctype/tests/ctype_digit_variation3.phpt
new file mode 100644
index 000000000..4746166a7
--- /dev/null
+++ b/ext/ctype/tests/ctype_digit_variation3.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test ctype_digit() function : usage variations - different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_digit(mixed $c)
+ * Description: Checks for numeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_digit() to test
+ * which are considered valid decimal digit only strings
+ */
+
+echo "*** Testing ctype_digit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ ")speci@! ch@r$(",
+ '@!$*',
+ "0",
+/*15*/ "3",
+ "9",
+ "1234",
+ "7890",
+ "0677",
+/*20*/ '0',
+ '3',
+ '9',
+ '1234',
+ '7890',
+/*25*/ "123abc",
+ "abc123",
+ "123\r\t",
+ "123 ",
+ " 123",
+/*30*/ "123E4",
+/*31*/ "0x3F",
+);
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_digit($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_digit() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(true)
+
+-- Iteration 23 --
+bool(true)
+
+-- Iteration 24 --
+bool(true)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+bool(false)
+
+-- Iteration 27 --
+bool(false)
+
+-- Iteration 28 --
+bool(false)
+
+-- Iteration 29 --
+bool(false)
+
+-- Iteration 30 --
+bool(false)
+
+-- Iteration 31 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation4.phpt b/ext/ctype/tests/ctype_digit_variation4.phpt
new file mode 100644
index 000000000..852bba32e
--- /dev/null
+++ b/ext/ctype/tests/ctype_digit_variation4.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test ctype_digit() function : usage variations - octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_digit(mixed $c)
+ * Description: Checks for numeric character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values as $c argument to ctype_digit() to test behaviour
+ */
+
+echo "*** Testing ctype_digit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array(061, 062, 063, 064);
+$hex_values = array (0x31, 0x32, 0x33, 0x34);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_digit($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_digit($c));
+ $iterator++;
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_digit() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_graph_basic.phpt b/ext/ctype/tests/ctype_graph_basic.phpt
new file mode 100644
index 000000000..bf789fbea
--- /dev/null
+++ b/ext/ctype/tests/ctype_graph_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_graph() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_graph(mixed $c)
+ * Description: Checks for any printable character(s) except space
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_graph() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = 'helloWorld!';
+$c2 = "Hello, world!\n";
+
+var_dump(ctype_graph($c1));
+var_dump(ctype_graph($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_graph() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_graph_error.phpt b/ext/ctype/tests/ctype_graph_error.phpt
new file mode 100644
index 000000000..7cd94fc26
--- /dev/null
+++ b/ext/ctype/tests/ctype_graph_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_graph() function : error conditions - incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : bool ctype_graph(mixed $c)
+ * Description: Checks for any printable character(s) except space
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to ctype_graph() to test behaviour
+ */
+
+echo "*** Testing ctype_graph() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_graph() function with Zero arguments --\n";
+var_dump( ctype_graph() );
+
+//Test ctype_graph with one more than the expected number of arguments
+echo "\n-- Testing ctype_graph() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_graph($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_graph() : error conditions ***
+
+-- Testing ctype_graph() function with Zero arguments --
+
+Warning: ctype_graph() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_graph() function with more than expected no. of arguments --
+
+Warning: ctype_graph() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation1.phpt b/ext/ctype/tests/ctype_graph_variation1.phpt
new file mode 100644
index 000000000..ee6e95bd3
--- /dev/null
+++ b/ext/ctype/tests/ctype_graph_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_graph() function : usage variations - different data types as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_graph(mixed $c)
+ * Description: Checks for any printable character(s) except space
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_graph() to test behaviour
+ */
+
+echo "*** Testing ctype_graph() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "myClass";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hiWorld!
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_graph()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_graph($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_graph() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation2.phpt b/ext/ctype/tests/ctype_graph_variation2.phpt
new file mode 100644
index 000000000..6ab56c75e
--- /dev/null
+++ b/ext/ctype/tests/ctype_graph_variation2.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test ctype_graph() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_graph(mixed $c)
+ * Description: Checks for any printable character(s) except space
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_graph() to test which character codes are considered
+ * valid visibly printable characters
+ */
+
+echo "*** Testing ctype_graph() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_graph($i)) {
+ echo "character code $i is a printable character\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_graph() : usage variations ***
+character code 33 is a printable character
+character code 34 is a printable character
+character code 35 is a printable character
+character code 36 is a printable character
+character code 37 is a printable character
+character code 38 is a printable character
+character code 39 is a printable character
+character code 40 is a printable character
+character code 41 is a printable character
+character code 42 is a printable character
+character code 43 is a printable character
+character code 44 is a printable character
+character code 45 is a printable character
+character code 46 is a printable character
+character code 47 is a printable character
+character code 48 is a printable character
+character code 49 is a printable character
+character code 50 is a printable character
+character code 51 is a printable character
+character code 52 is a printable character
+character code 53 is a printable character
+character code 54 is a printable character
+character code 55 is a printable character
+character code 56 is a printable character
+character code 57 is a printable character
+character code 58 is a printable character
+character code 59 is a printable character
+character code 60 is a printable character
+character code 61 is a printable character
+character code 62 is a printable character
+character code 63 is a printable character
+character code 64 is a printable character
+character code 65 is a printable character
+character code 66 is a printable character
+character code 67 is a printable character
+character code 68 is a printable character
+character code 69 is a printable character
+character code 70 is a printable character
+character code 71 is a printable character
+character code 72 is a printable character
+character code 73 is a printable character
+character code 74 is a printable character
+character code 75 is a printable character
+character code 76 is a printable character
+character code 77 is a printable character
+character code 78 is a printable character
+character code 79 is a printable character
+character code 80 is a printable character
+character code 81 is a printable character
+character code 82 is a printable character
+character code 83 is a printable character
+character code 84 is a printable character
+character code 85 is a printable character
+character code 86 is a printable character
+character code 87 is a printable character
+character code 88 is a printable character
+character code 89 is a printable character
+character code 90 is a printable character
+character code 91 is a printable character
+character code 92 is a printable character
+character code 93 is a printable character
+character code 94 is a printable character
+character code 95 is a printable character
+character code 96 is a printable character
+character code 97 is a printable character
+character code 98 is a printable character
+character code 99 is a printable character
+character code 100 is a printable character
+character code 101 is a printable character
+character code 102 is a printable character
+character code 103 is a printable character
+character code 104 is a printable character
+character code 105 is a printable character
+character code 106 is a printable character
+character code 107 is a printable character
+character code 108 is a printable character
+character code 109 is a printable character
+character code 110 is a printable character
+character code 111 is a printable character
+character code 112 is a printable character
+character code 113 is a printable character
+character code 114 is a printable character
+character code 115 is a printable character
+character code 116 is a printable character
+character code 117 is a printable character
+character code 118 is a printable character
+character code 119 is a printable character
+character code 120 is a printable character
+character code 121 is a printable character
+character code 122 is a printable character
+character code 123 is a printable character
+character code 124 is a printable character
+character code 125 is a printable character
+character code 126 is a printable character
+===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation3.phpt b/ext/ctype/tests/ctype_graph_variation3.phpt
new file mode 100644
index 000000000..7843a058f
--- /dev/null
+++ b/ext/ctype/tests/ctype_graph_variation3.phpt
@@ -0,0 +1,146 @@
+--TEST--
+Test ctype_graph() function : usage variations - different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_graph(mixed $c)
+ * Description: Checks for any printable character(s) except space
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_graph() to test
+ * which are considered valid printable character only strings
+ */
+
+echo "*** Testing ctype_graph() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ "abc123\n",
+/*20*/ 'abc 123',
+ '',
+ ' ',
+ base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
+ "!$%^&*()_+-={}[]:;@~'#<,>.?/",
+/*25*/ "\"ABC\"",
+ "String\twith\ttabs",
+ "Sample string with newline\n",
+/*28*/ "123 ABC XYZ",
+);
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_graph($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_graph() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(true)
+
+-- Iteration 25 --
+bool(true)
+
+-- Iteration 26 --
+bool(false)
+
+-- Iteration 27 --
+bool(false)
+
+-- Iteration 28 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation4.phpt b/ext/ctype/tests/ctype_graph_variation4.phpt
new file mode 100644
index 000000000..0a504324c
--- /dev/null
+++ b/ext/ctype/tests/ctype_graph_variation4.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test ctype_graph() function : usage variations - octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_graph(mixed $c)
+ * Description: Checks for any printable character(s) except space
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values to ctype_graph() to test behaviour
+ */
+
+echo "*** Testing ctype_graph() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array(061, 062, 063, 064);
+$hex_values = array (0x31, 0x32, 0x33, 0x34);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_graph($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_graph($c));
+ $iterator++;
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_graph() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_lower_basic.phpt b/ext/ctype/tests/ctype_lower_basic.phpt
new file mode 100644
index 000000000..f9c854048
--- /dev/null
+++ b/ext/ctype/tests/ctype_lower_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_lower() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_lower(mixed $c)
+ * Description: Checks for lowercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_lower() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = 'helloworld';
+$c2 = "Hello, world!\n";
+
+var_dump(ctype_lower($c1));
+var_dump(ctype_lower($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_lower() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_lower_error.phpt b/ext/ctype/tests/ctype_lower_error.phpt
new file mode 100644
index 000000000..141d02c6e
--- /dev/null
+++ b/ext/ctype/tests/ctype_lower_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_lower() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_lower(mixed $c)
+ * Description: Checks for lowercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass incorrect number of arguments to ctype_lower() to test behaviour
+ */
+
+echo "*** Testing ctype_lower() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_lower() function with Zero arguments --\n";
+var_dump( ctype_lower() );
+
+//Test ctype_lower with one more than the expected number of arguments
+echo "\n-- Testing ctype_lower() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_lower($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_lower() : error conditions ***
+
+-- Testing ctype_lower() function with Zero arguments --
+
+Warning: ctype_lower() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_lower() function with more than expected no. of arguments --
+
+Warning: ctype_lower() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation1.phpt b/ext/ctype/tests/ctype_lower_variation1.phpt
new file mode 100644
index 000000000..60288c3d9
--- /dev/null
+++ b/ext/ctype/tests/ctype_lower_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_lower() function : usage variations - different data types as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_lower(mixed $c)
+ * Description: Checks for lowercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_lower() to test behaviour
+ */
+
+echo "*** Testing ctype_lower() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "class";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+heredoc
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_lower()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_lower($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_lower() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation2.phpt b/ext/ctype/tests/ctype_lower_variation2.phpt
new file mode 100644
index 000000000..99a3ad775
--- /dev/null
+++ b/ext/ctype/tests/ctype_lower_variation2.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test ctype_lower() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_lower(mixed $c)
+ * Description: Checks for lowercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_lower() to test which character codes are considered
+ * valid lowercase characters
+ */
+
+echo "*** Testing ctype_lower() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_lower($i)) {
+ echo "character code $i is a lower case character\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_lower() : usage variations ***
+character code 97 is a lower case character
+character code 98 is a lower case character
+character code 99 is a lower case character
+character code 100 is a lower case character
+character code 101 is a lower case character
+character code 102 is a lower case character
+character code 103 is a lower case character
+character code 104 is a lower case character
+character code 105 is a lower case character
+character code 106 is a lower case character
+character code 107 is a lower case character
+character code 108 is a lower case character
+character code 109 is a lower case character
+character code 110 is a lower case character
+character code 111 is a lower case character
+character code 112 is a lower case character
+character code 113 is a lower case character
+character code 114 is a lower case character
+character code 115 is a lower case character
+character code 116 is a lower case character
+character code 117 is a lower case character
+character code 118 is a lower case character
+character code 119 is a lower case character
+character code 120 is a lower case character
+character code 121 is a lower case character
+character code 122 is a lower case character
+===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation3.phpt b/ext/ctype/tests/ctype_lower_variation3.phpt
new file mode 100644
index 000000000..73d6fcd60
--- /dev/null
+++ b/ext/ctype/tests/ctype_lower_variation3.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test ctype_lower() function : usage variations - different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_lower(mixed $c)
+ * Description: Checks for lowercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_lower() to test
+ * which are considered valid lowercase character only strings
+ */
+
+echo "*** Testing ctype_lower() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ 'abc123\n',
+/*20*/ 'abc 123',
+ '',
+ ' ',
+ base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
+ "abcXYZ",
+/*25*/ "abc xyz",
+/*26*/ "abc+efg*xyz",
+);
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_lower($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_lower() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation4.phpt b/ext/ctype/tests/ctype_lower_variation4.phpt
new file mode 100644
index 000000000..30a68a3af
--- /dev/null
+++ b/ext/ctype/tests/ctype_lower_variation4.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test ctype_lower() function : usage variations - octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_lower(mixed $c)
+ * Description: Checks for lowercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values to ctype_lower() to test behaviour
+ */
+
+echo "*** Testing ctype_lower() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array(0141, 0142, 0143, 0144);
+$hex_values = array (0x61, 0x62, 0x63, 0x64);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_lower($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_lower($c));
+ $iterator++;
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_lower() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_print_basic.phpt b/ext/ctype/tests/ctype_print_basic.phpt
new file mode 100644
index 000000000..5d01f5abd
--- /dev/null
+++ b/ext/ctype/tests/ctype_print_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_print() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_print(mixed $c)
+ * Description: Checks for printable character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_print() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = "Hello, World!";
+$c2 = null;
+
+var_dump(ctype_print($c1));
+var_dump(ctype_print($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_print() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_print_error.phpt b/ext/ctype/tests/ctype_print_error.phpt
new file mode 100644
index 000000000..243d2f802
--- /dev/null
+++ b/ext/ctype/tests/ctype_print_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_print() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_print(mixed $c)
+ * Description: Checks for printable character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass incorrect number of arguments to ctype_print() to test behaviour
+ */
+
+echo "*** Testing ctype_print() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_print() function with Zero arguments --\n";
+var_dump( ctype_print() );
+
+//Test ctype_print with one more than the expected number of arguments
+echo "\n-- Testing ctype_print() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_print($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_print() : error conditions ***
+
+-- Testing ctype_print() function with Zero arguments --
+
+Warning: ctype_print() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_print() function with more than expected no. of arguments --
+
+Warning: ctype_print() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation1.phpt b/ext/ctype/tests/ctype_print_variation1.phpt
new file mode 100644
index 000000000..c121dd723
--- /dev/null
+++ b/ext/ctype/tests/ctype_print_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_print() function : usage variations - different data types as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_print(mixed $c)
+ * Description: Checks for printable character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_print() to test behaviour
+ */
+
+echo "*** Testing ctype_print() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//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 $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_print()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_print($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_print() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation2.phpt b/ext/ctype/tests/ctype_print_variation2.phpt
new file mode 100644
index 000000000..ac492b882
--- /dev/null
+++ b/ext/ctype/tests/ctype_print_variation2.phpt
@@ -0,0 +1,125 @@
+--TEST--
+Test ctype_print() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_print(mixed $c)
+ * Description: Checks for printable character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_print() to test which character codes are considered
+ * valid printable characters
+ */
+
+echo "*** Testing ctype_print() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_print($i)) {
+ echo "character code $i is a printable character\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_print() : usage variations ***
+character code 32 is a printable character
+character code 33 is a printable character
+character code 34 is a printable character
+character code 35 is a printable character
+character code 36 is a printable character
+character code 37 is a printable character
+character code 38 is a printable character
+character code 39 is a printable character
+character code 40 is a printable character
+character code 41 is a printable character
+character code 42 is a printable character
+character code 43 is a printable character
+character code 44 is a printable character
+character code 45 is a printable character
+character code 46 is a printable character
+character code 47 is a printable character
+character code 48 is a printable character
+character code 49 is a printable character
+character code 50 is a printable character
+character code 51 is a printable character
+character code 52 is a printable character
+character code 53 is a printable character
+character code 54 is a printable character
+character code 55 is a printable character
+character code 56 is a printable character
+character code 57 is a printable character
+character code 58 is a printable character
+character code 59 is a printable character
+character code 60 is a printable character
+character code 61 is a printable character
+character code 62 is a printable character
+character code 63 is a printable character
+character code 64 is a printable character
+character code 65 is a printable character
+character code 66 is a printable character
+character code 67 is a printable character
+character code 68 is a printable character
+character code 69 is a printable character
+character code 70 is a printable character
+character code 71 is a printable character
+character code 72 is a printable character
+character code 73 is a printable character
+character code 74 is a printable character
+character code 75 is a printable character
+character code 76 is a printable character
+character code 77 is a printable character
+character code 78 is a printable character
+character code 79 is a printable character
+character code 80 is a printable character
+character code 81 is a printable character
+character code 82 is a printable character
+character code 83 is a printable character
+character code 84 is a printable character
+character code 85 is a printable character
+character code 86 is a printable character
+character code 87 is a printable character
+character code 88 is a printable character
+character code 89 is a printable character
+character code 90 is a printable character
+character code 91 is a printable character
+character code 92 is a printable character
+character code 93 is a printable character
+character code 94 is a printable character
+character code 95 is a printable character
+character code 96 is a printable character
+character code 97 is a printable character
+character code 98 is a printable character
+character code 99 is a printable character
+character code 100 is a printable character
+character code 101 is a printable character
+character code 102 is a printable character
+character code 103 is a printable character
+character code 104 is a printable character
+character code 105 is a printable character
+character code 106 is a printable character
+character code 107 is a printable character
+character code 108 is a printable character
+character code 109 is a printable character
+character code 110 is a printable character
+character code 111 is a printable character
+character code 112 is a printable character
+character code 113 is a printable character
+character code 114 is a printable character
+character code 115 is a printable character
+character code 116 is a printable character
+character code 117 is a printable character
+character code 118 is a printable character
+character code 119 is a printable character
+character code 120 is a printable character
+character code 121 is a printable character
+character code 122 is a printable character
+character code 123 is a printable character
+character code 124 is a printable character
+character code 125 is a printable character
+character code 126 is a printable character
+===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation3.phpt b/ext/ctype/tests/ctype_print_variation3.phpt
new file mode 100644
index 000000000..0231a3db2
--- /dev/null
+++ b/ext/ctype/tests/ctype_print_variation3.phpt
@@ -0,0 +1,126 @@
+--TEST--
+Test ctype_print() function : usage variations - different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_print(mixed $c)
+ * Description: Checks for printable character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_print() to test
+ * which are considered valid printable character only strings
+ */
+
+echo "*** Testing ctype_print() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ "abc123\n",
+/*20*/ 'abc 123',
+ '',
+ ' ',
+/*23*/ base64_decode("w4DDoMOHw6fDiMOo") // non-ascii characters
+);
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_print($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_print() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(true)
+
+-- Iteration 23 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation4.phpt b/ext/ctype/tests/ctype_print_variation4.phpt
new file mode 100644
index 000000000..b8e643582
--- /dev/null
+++ b/ext/ctype/tests/ctype_print_variation4.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test ctype_print() function : usage variations - octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_print(mixed $c)
+ * Description: Checks for printable character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values to ctype_print() to test behaviour
+ */
+
+echo "*** Testing ctype_print() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array(040, 041, 042, 043);
+$hex_values = array (0x20, 0x21, 0x23, 0x24);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_print($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_print($c));
+ $iterator++;
+}
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_print() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_punct_basic.phpt b/ext/ctype/tests/ctype_punct_basic.phpt
new file mode 100644
index 000000000..d1f6f4601
--- /dev/null
+++ b/ext/ctype/tests/ctype_punct_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test ctype_punct() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_punct(mixed $c)
+ * Description: Checks for any printable character which is not whitespace
+ * or an alphanumeric character
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_punct() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = '@!$*';
+$c2 = 'hello, world!';
+
+var_dump(ctype_punct($c1));
+var_dump(ctype_punct($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_punct() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_punct_error.phpt b/ext/ctype/tests/ctype_punct_error.phpt
new file mode 100644
index 000000000..ec4aff71d
--- /dev/null
+++ b/ext/ctype/tests/ctype_punct_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test ctype_punct() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_punct(mixed $c)
+ * Description: Checks for any printable character which is not whitespace
+ * or an alphanumeric character
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass incorrect number of arguments to ctype_punct() to test behaviour
+ */
+
+echo "*** Testing ctype_punct() : error conditions ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+// Zero arguments
+echo "\n-- Testing ctype_punct() function with Zero arguments --\n";
+var_dump( ctype_punct() );
+
+//Test ctype_punct with one more than the expected number of arguments
+echo "\n-- Testing ctype_punct() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_punct($c, $extra_arg) );
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_punct() : error conditions ***
+
+-- Testing ctype_punct() function with Zero arguments --
+
+Warning: ctype_punct() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_punct() function with more than expected no. of arguments --
+
+Warning: ctype_punct() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation1.phpt b/ext/ctype/tests/ctype_punct_variation1.phpt
new file mode 100644
index 000000000..2bdfd709c
--- /dev/null
+++ b/ext/ctype/tests/ctype_punct_variation1.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test ctype_punct() function : usage variations - different data types as $c argument
+--FILE--
+<?php
+/* Prototype : bool ctype_punct(mixed $c)
+ * Description: Checks for any printable character which is not whitespace
+ * or an alphanumeric character
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_punt() to test behaviour
+ */
+
+echo "*** Testing ctype_punct() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return ",<.>";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+[{}]
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ ";:'@",
+ '#~/?',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_punct
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_punct($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_punct() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation2.phpt b/ext/ctype/tests/ctype_punct_variation2.phpt
new file mode 100644
index 000000000..cc04753e6
--- /dev/null
+++ b/ext/ctype/tests/ctype_punct_variation2.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test ctype_punct() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_punct(mixed $c)
+ * Description: Checks for any printable character which is not whitespace
+ * or an alphanumeric character
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_punct() to test which character codes are considered
+ * valid punctuation characters
+ */
+
+echo "*** Testing ctype_punct() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($c = 1; $c < 256; $c++) {
+ if (ctype_punct($c)) {
+ echo "character code $c is punctuation\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_punct() : usage variations ***
+character code 33 is punctuation
+character code 34 is punctuation
+character code 35 is punctuation
+character code 36 is punctuation
+character code 37 is punctuation
+character code 38 is punctuation
+character code 39 is punctuation
+character code 40 is punctuation
+character code 41 is punctuation
+character code 42 is punctuation
+character code 43 is punctuation
+character code 44 is punctuation
+character code 45 is punctuation
+character code 46 is punctuation
+character code 47 is punctuation
+character code 58 is punctuation
+character code 59 is punctuation
+character code 60 is punctuation
+character code 61 is punctuation
+character code 62 is punctuation
+character code 63 is punctuation
+character code 64 is punctuation
+character code 91 is punctuation
+character code 92 is punctuation
+character code 93 is punctuation
+character code 94 is punctuation
+character code 95 is punctuation
+character code 96 is punctuation
+character code 123 is punctuation
+character code 124 is punctuation
+character code 125 is punctuation
+character code 126 is punctuation
+===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation3.phpt b/ext/ctype/tests/ctype_punct_variation3.phpt
new file mode 100644
index 000000000..5282a291b
--- /dev/null
+++ b/ext/ctype/tests/ctype_punct_variation3.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test ctype_punct() function : usage variations - different punctuation
+--FILE--
+<?php
+/* Prototype : bool ctype_punct(mixed $c)
+ * Description: Checks for any printable character which is not whitespace
+ * or an alphanumeric character
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_punct() to test
+ * which are considered valid punctuation character only strings
+ */
+
+echo "*** Testing ctype_punct() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ "abc123\n",
+/*20*/ 'abc 123',
+ '',
+ ' ',
+ base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
+ "!$%@\n",
+/*25*/ "\"?!\"",
+/*26*/ "|\ @~",
+);
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_punct($value) );
+ $iterator++;
+};
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_punct() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(true)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(true)
+
+-- Iteration 26 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation4.phpt b/ext/ctype/tests/ctype_punct_variation4.phpt
new file mode 100644
index 000000000..40ef656cb
--- /dev/null
+++ b/ext/ctype/tests/ctype_punct_variation4.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test ctype_punct() function : usage variations - Octal and Hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_punct(mixed $c)
+ * Description: Checks for any printable character which is not whitespace
+ * or an alphanumeric character
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different octal and hexadecimal values to ctype_punct() to test behaviour
+ */
+
+echo "*** Testing ctype_punct() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array(041, 042, 043, 044);
+$hex_values = array(0x21, 0x22, 0x23, 0x24);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_punct($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_punct($c));
+ $iterator++;
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_punct() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_space_basic.phpt b/ext/ctype/tests/ctype_space_basic.phpt
new file mode 100644
index 000000000..8f2cbe91b
--- /dev/null
+++ b/ext/ctype/tests/ctype_space_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_space() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_space(mixed $c)
+ * Description: Checks for whitespace character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_space() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = " \t\r\n";
+var_dump(ctype_space($c1));
+
+$c2 = "Hello, world!\n";
+var_dump(ctype_space($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_space() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_space_error.phpt b/ext/ctype/tests/ctype_space_error.phpt
new file mode 100644
index 000000000..e4cd4f4f4
--- /dev/null
+++ b/ext/ctype/tests/ctype_space_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test ctype_space() function : error conditions - Incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_space(mixed $c)
+ * Description: Checks for whitespace character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to ctype_space() to test behaviour
+ */
+
+echo "*** Testing ctype_space() : error conditions ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+// Zero arguments
+echo "\n-- Testing ctype_space() function with Zero arguments --\n";
+var_dump( ctype_space() );
+
+//Test ctype_space with one more than the expected number of arguments
+echo "\n-- Testing ctype_space() function with more than expected no. of arguments --\n";
+$c = " ";
+$extra_arg = 10;
+var_dump( ctype_space($c, $extra_arg) );
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_space() : error conditions ***
+
+-- Testing ctype_space() function with Zero arguments --
+
+Warning: ctype_space() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_space() function with more than expected no. of arguments --
+
+Warning: ctype_space() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation1.phpt b/ext/ctype/tests/ctype_space_variation1.phpt
new file mode 100644
index 000000000..be1cb2406
--- /dev/null
+++ b/ext/ctype/tests/ctype_space_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_space() function : usage variations - different data types as $c argument
+--FILE--
+<?php
+/* Prototype : bool ctype_space(mixed $c)
+ * Description: Checks for whitespace character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_space() to test behaviour
+ */
+
+echo "*** Testing ctype_space() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "\n\t\r";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "\n\t\r",
+ ' ',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_space()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_space($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_space() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation2.phpt b/ext/ctype/tests/ctype_space_variation2.phpt
new file mode 100644
index 000000000..8eadc2359
--- /dev/null
+++ b/ext/ctype/tests/ctype_space_variation2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test ctype_space() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_space(mixed $c)
+ * Description: Checks for whitespace character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_space() to test which character codes are considered
+ * valid whitespace characters
+ */
+
+echo "*** Testing ctype_space() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($c = 1; $c < 256; $c++) {
+ if (ctype_space($c)) {
+ echo "character code $c is a space character\n";
+ }
+}
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_space() : usage variations ***
+character code 9 is a space character
+character code 10 is a space character
+character code 11 is a space character
+character code 12 is a space character
+character code 13 is a space character
+character code 32 is a space character
+===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation3.phpt b/ext/ctype/tests/ctype_space_variation3.phpt
new file mode 100644
index 000000000..21aa866c9
--- /dev/null
+++ b/ext/ctype/tests/ctype_space_variation3.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test ctype_space() function : usage variations - different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_space(mixed $c)
+ * Description: Checks for whitespace character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_space() to test
+ * which are considered valid whitespace character only strings
+ */
+
+echo "*** Testing ctype_space() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ "abc123\n",
+/*20*/ 'abc 123',
+ '',
+ ' ',
+ base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
+ "\"\n",
+/*25*/ " \t\r\n",
+/*26*/ "\v\f",
+);
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_space($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_space() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(true)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(true)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(true)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(true)
+
+-- Iteration 26 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation4.phpt b/ext/ctype/tests/ctype_space_variation4.phpt
new file mode 100644
index 000000000..3eed45a45
--- /dev/null
+++ b/ext/ctype/tests/ctype_space_variation4.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test ctype_space() function : usage variations - octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_space(mixed $c)
+ * Description: Checks for whitespace character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values as $c to ctype_space() to test behaviour
+ */
+
+echo "*** Testing ctype_space() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array (011, 012, 013, 014, 015, 040);
+$hex_values = array (0x9, 0xA, 0xB, 0xC, 0xD, 0x20);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_space($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_space($c));
+ $iterator++;
+}
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_space() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_upper_basic.phpt b/ext/ctype/tests/ctype_upper_basic.phpt
new file mode 100644
index 000000000..55f91151a
--- /dev/null
+++ b/ext/ctype/tests/ctype_upper_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ctype_upper() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_upper(mixed $c)
+ * Description: Checks for uppercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_upper() : basic functionality ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = 'HELLOWORLD';
+$c2 = "Hello, World!\n";
+
+var_dump(ctype_upper($c1));
+var_dump(ctype_upper($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_upper() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_upper_error.phpt b/ext/ctype/tests/ctype_upper_error.phpt
new file mode 100644
index 000000000..185e63d9e
--- /dev/null
+++ b/ext/ctype/tests/ctype_upper_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_upper() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_upper(mixed $c)
+ * Description: Checks for uppercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass incorrect number of arguments to ctype_upper() to test behaviour
+ */
+
+echo "*** Testing ctype_upper() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_upper() function with Zero arguments --\n";
+var_dump( ctype_upper() );
+
+//Test ctype_upper with one more than the expected number of arguments
+echo "\n-- Testing ctype_upper() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_upper($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_upper() : error conditions ***
+
+-- Testing ctype_upper() function with Zero arguments --
+
+Warning: ctype_upper() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_upper() function with more than expected no. of arguments --
+
+Warning: ctype_upper() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation1.phpt b/ext/ctype/tests/ctype_upper_variation1.phpt
new file mode 100644
index 000000000..f7dd07921
--- /dev/null
+++ b/ext/ctype/tests/ctype_upper_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_upper() function : usage variations - different data types
+--FILE--
+<?php
+/* Prototype : bool ctype_upper(mixed $c)
+ * Description: Checks for uppercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_upper() to test behaviour
+ */
+
+echo "*** Testing ctype_upper() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "HELLO";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+HI
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "STRING",
+ 'STRING',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_upper()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_upper($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_upper() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation2.phpt b/ext/ctype/tests/ctype_upper_variation2.phpt
new file mode 100644
index 000000000..03ec85806
--- /dev/null
+++ b/ext/ctype/tests/ctype_upper_variation2.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test ctype_upper() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_upper(mixed $c)
+ * Description: Checks for uppercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_upper() to test which character codes are considered
+ * valid uppercase characters
+ */
+
+echo "*** Testing ctype_upper() : usage variations ***\n";
+$orig = setlocale(LC_CTYPE, "C");
+
+for ($i = 0; $i < 256; $i++) {
+ if (ctype_upper($i)) {
+ echo "character code $i is a uppercase character\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_upper() : usage variations ***
+character code 65 is a uppercase character
+character code 66 is a uppercase character
+character code 67 is a uppercase character
+character code 68 is a uppercase character
+character code 69 is a uppercase character
+character code 70 is a uppercase character
+character code 71 is a uppercase character
+character code 72 is a uppercase character
+character code 73 is a uppercase character
+character code 74 is a uppercase character
+character code 75 is a uppercase character
+character code 76 is a uppercase character
+character code 77 is a uppercase character
+character code 78 is a uppercase character
+character code 79 is a uppercase character
+character code 80 is a uppercase character
+character code 81 is a uppercase character
+character code 82 is a uppercase character
+character code 83 is a uppercase character
+character code 84 is a uppercase character
+character code 85 is a uppercase character
+character code 86 is a uppercase character
+character code 87 is a uppercase character
+character code 88 is a uppercase character
+character code 89 is a uppercase character
+character code 90 is a uppercase character
+===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation3.phpt b/ext/ctype/tests/ctype_upper_variation3.phpt
new file mode 100644
index 000000000..db57ed5f9
--- /dev/null
+++ b/ext/ctype/tests/ctype_upper_variation3.phpt
@@ -0,0 +1,137 @@
+--TEST--
+Test ctype_upper() function : usage variations - different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_upper(mixed $c)
+ * Description: Checks for uppercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_upper() to test
+ * which are considered valid uppercase character only strings
+ */
+
+echo "*** Testing ctype_upper() : usage variations ***\n";
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ 'abc123\n',
+/*20*/ 'abc 123',
+ '',
+ ' ',
+ base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
+ "abcXYZ",
+/*25*/ "ABC XYZ",
+/*26*/ "ABC+EFG*XYZ",
+);
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_upper($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_upper() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation4.phpt b/ext/ctype/tests/ctype_upper_variation4.phpt
new file mode 100644
index 000000000..723c4d0a8
--- /dev/null
+++ b/ext/ctype/tests/ctype_upper_variation4.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test ctype_upper() function : usage variations - octal and hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ctype_upper(mixed $c)
+ * Description: Checks for uppercase character(s)
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass octal and hexadecimal values to ctype_upper() to test behaviour
+ */
+
+echo "*** Testing ctype_upper() : usage variations ***\n";
+$orig = setlocale(LC_CTYPE, "C");
+
+$octal_values = array(0101, 0102, 0103, 0104);
+$hex_values = array(0x41, 0x42, 0x43, 0x44);
+
+echo "\n-- Octal Values --\n";
+$iterator = 1;
+foreach($octal_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_upper($c));
+ $iterator++;
+}
+
+echo "\n-- Hexadecimal Values --\n";
+$iterator = 1;
+foreach($hex_values as $c) {
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_upper($c));
+ $iterator++;
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_upper() : usage variations ***
+
+-- Octal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+-- Hexadecimal Values --
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_basic.phpt b/ext/ctype/tests/ctype_xdigit_basic.phpt
new file mode 100644
index 000000000..58cc5b2e0
--- /dev/null
+++ b/ext/ctype/tests/ctype_xdigit_basic.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test ctype_xdigit() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ctype_xdigit(mixed $c)
+ * Description: Checks for character(s) representing a hexadecimal digit
+ * Source code: ext/ctype/ctype.c
+ */
+
+echo "*** Testing ctype_xdigit() : basic functionality ***\n";
+$orig = setlocale(LC_CTYPE, "C");
+
+$c1 = 'abcdefABCDEF0123456789';
+$c2 = 'face 034';
+
+var_dump(ctype_xdigit($c1));
+var_dump(ctype_xdigit($c2));
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_xdigit() : basic functionality ***
+bool(true)
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_error.phpt b/ext/ctype/tests/ctype_xdigit_error.phpt
new file mode 100644
index 000000000..06ee73341
--- /dev/null
+++ b/ext/ctype/tests/ctype_xdigit_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ctype_xdigit() function : error conditions - Incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool ctype_xdigit(mixed $c)
+ * Description: Checks for character(s) representing a hexadecimal digit
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass incorrect number of arguments to ctype_xdigit() to test behaviour
+ */
+
+echo "*** Testing ctype_xdigit() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ctype_xdigit() function with Zero arguments --\n";
+var_dump( ctype_xdigit() );
+
+//Test ctype_xdigit with one more than the expected number of arguments
+echo "\n-- Testing ctype_xdigit() function with more than expected no. of arguments --\n";
+$c = 1;
+$extra_arg = 10;
+var_dump( ctype_xdigit($c, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_xdigit() : error conditions ***
+
+-- Testing ctype_xdigit() function with Zero arguments --
+
+Warning: ctype_xdigit() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing ctype_xdigit() function with more than expected no. of arguments --
+
+Warning: ctype_xdigit() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation1.phpt b/ext/ctype/tests/ctype_xdigit_variation1.phpt
new file mode 100644
index 000000000..adde77bbd
--- /dev/null
+++ b/ext/ctype/tests/ctype_xdigit_variation1.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ctype_xdigit() function : usage variations - different data typse as $c arg
+--FILE--
+<?php
+/* Prototype : bool ctype_xdigit(mixed $c)
+ * Description: Checks for character(s) representing a hexadecimal digit
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different data types as $c argument to ctype_xdigit() to test behaviour
+ */
+
+echo "*** Testing ctype_xdigit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "ABcd";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+234
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $c argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "456",
+ 'def',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of ctype_xdigit()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_xdigit($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_xdigit() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(true)
+
+-- 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(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation2.phpt b/ext/ctype/tests/ctype_xdigit_variation2.phpt
new file mode 100644
index 000000000..92f9aba0c
--- /dev/null
+++ b/ext/ctype/tests/ctype_xdigit_variation2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test ctype_xdigit() function : usage variations - different integers
+--FILE--
+<?php
+/* Prototype : bool ctype_xdigit(mixed $c)
+ * Description: Checks for character(s) representing a hexadecimal digit
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different integers to ctype_xdigit() to test which character codes are considered
+ * valid hexadecimal 'digits'
+ */
+
+echo "*** Testing ctype_xdigit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+for($c = 1; $c < 256; $c++) {
+ if (ctype_xdigit($c)) {
+ echo "character code $c is a hexadecimal 'digit'\n";
+ }
+}
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_xdigit() : usage variations ***
+character code 48 is a hexadecimal 'digit'
+character code 49 is a hexadecimal 'digit'
+character code 50 is a hexadecimal 'digit'
+character code 51 is a hexadecimal 'digit'
+character code 52 is a hexadecimal 'digit'
+character code 53 is a hexadecimal 'digit'
+character code 54 is a hexadecimal 'digit'
+character code 55 is a hexadecimal 'digit'
+character code 56 is a hexadecimal 'digit'
+character code 57 is a hexadecimal 'digit'
+character code 65 is a hexadecimal 'digit'
+character code 66 is a hexadecimal 'digit'
+character code 67 is a hexadecimal 'digit'
+character code 68 is a hexadecimal 'digit'
+character code 69 is a hexadecimal 'digit'
+character code 70 is a hexadecimal 'digit'
+character code 97 is a hexadecimal 'digit'
+character code 98 is a hexadecimal 'digit'
+character code 99 is a hexadecimal 'digit'
+character code 100 is a hexadecimal 'digit'
+character code 101 is a hexadecimal 'digit'
+character code 102 is a hexadecimal 'digit'
+===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation3.phpt b/ext/ctype/tests/ctype_xdigit_variation3.phpt
new file mode 100644
index 000000000..35e8407fc
--- /dev/null
+++ b/ext/ctype/tests/ctype_xdigit_variation3.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test ctype_xdigit() function : usage variations - Different strings
+--FILE--
+<?php
+/* Prototype : bool ctype_xdigit(mixed $c)
+ * Description: Checks for character(s) representing a hexadecimal digit
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass strings containing different character types to ctype_xdigit() to test
+ * which are considered valid hexadecimal 'digit' only strings
+ */
+
+echo "*** Testing ctype_xdigit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+$values = array(
+/*1*/ "This string contains just letters and spaces", // Simple string
+ "but this one contains some numbers too 123+456 = 678", // Mixed string
+ "",
+ " ",
+/*5*/ "a",
+ "ABCXYZ",
+ "abcxyz",
+ "ABCXYZ123DEF456",
+ "abczyz123DEF456",
+/*10*/ "\r\n",
+ "123",
+ "03F", // hexadecimal 'digits'
+ ")speci@! ch@r$(",
+ '@!$*',
+/*15*/ 'ABC',
+ 'abc',
+ 'ABC123',
+ 'abc123',
+ 'abc123\n',
+/*20*/ 'abc 123',
+ '',
+ ' ',
+ base64_decode("w4DDoMOHw6fDiMOo"), // non-ascii characters
+ 'ABCdef07',
+ "56ea\tFB",
+ "0x2A"
+ );
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_xdigit($value) );
+ $iterator++;
+};
+
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_xdigit() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(true)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+bool(false)
+===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation4.phpt b/ext/ctype/tests/ctype_xdigit_variation4.phpt
new file mode 100644
index 000000000..68e03cb88
--- /dev/null
+++ b/ext/ctype/tests/ctype_xdigit_variation4.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test ctype_xdigit() function : usage variations - heaxadecimal and octal values
+--FILE--
+<?php
+/* Prototype : bool ctype_xdigit(mixed $c)
+ * Description: Checks for character(s) representing a hexadecimal digit
+ * Source code: ext/ctype/ctype.c
+ */
+
+/*
+ * Pass different hexadecimal and octal values that:
+ * 1. contain hexadecimal digits
+ * 2. correspond to character codes recognised as hexadecimal digits (see variation2)
+ * referred to as 'correct' integers below
+ */
+
+echo "*** Testing ctype_xdigit() : usage variations ***\n";
+
+$orig = setlocale(LC_CTYPE, "C");
+
+// contain hexadecimal digits but do not correspond to 'correct' ints
+$octal_values1 = array(012, 013, 014, 015);
+
+// correspond to 'correct' integers
+$octal_values2 = array(061, 062, 063, 064);
+
+// contain hexadecimal digits but do not correspond to 'correct' ints
+$hex_values1 = array(0x1A, 0x1B, 0x1C, 0x1D);
+
+//correspond to 'correct' integers
+$hex_values2 = array(0x61, 0x62, 0x63, 0x64);
+
+echo "\n-- Octal values --\n";
+echo "'Incorrect' Integers: \n";
+foreach($octal_values1 as $c) {
+ var_dump(ctype_xdigit($c));
+}
+echo "'Correct' Integers: \n";
+foreach($octal_values2 as $c) {
+ var_dump(ctype_xdigit($c));
+}
+
+echo "\n-- Hexadecimal values --\n";
+echo "'Incorrect' Integers: \n";
+foreach($hex_values1 as $c) {
+ var_dump(ctype_xdigit($c));
+}
+echo "'Correct' Integers: \n";
+foreach($hex_values2 as $c) {
+ var_dump(ctype_xdigit($c));
+}
+setlocale(LC_CTYPE, $orig);
+?>
+===DONE===
+--EXPECTF--
+*** Testing ctype_xdigit() : usage variations ***
+
+-- Octal values --
+'Incorrect' Integers:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+'Correct' Integers:
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+-- Hexadecimal values --
+'Incorrect' Integers:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+'Correct' Integers:
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===DONE===
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 683c36aec..ff702f20b 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.62.2.14.2.29 2007/10/13 11:35:35 bjori Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.34 2008/01/06 17:12:29 iliaa Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -153,7 +153,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (long) v);
#define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s), (double) v);
-#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) v, 1);
+#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) (v ? v : ""), 1);
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
#if defined(PHP_WIN32) || defined(__GNUC__)
@@ -173,7 +173,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
php_curl_ret(__ret); \
} \
\
- if (!php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) { \
+ if (tmp_url->host || !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_url_free(tmp_url); \
php_curl_ret(__ret); \
@@ -931,7 +931,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
}
/* }}} */
-static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, void *ctx)
+static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, void *ctx) /* {{{ */
{
php_curl *ch = (php_curl *) ctx;
@@ -947,6 +947,7 @@ static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, v
return 0;
}
+/* }}} */
#if CURLOPT_PASSWDFUNCTION != 0
/* {{{ curl_passwd
@@ -1074,9 +1075,9 @@ static void alloc_curl_handle(php_curl **ch)
memset(&(*ch)->err, 0, sizeof((*ch)->err));
- zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (void(*)(void *)) curl_free_string, 0);
- zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (void(*)(void *)) curl_free_slist, 0);
- zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (void(*)(void *)) curl_free_post, 0);
+ zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
+ zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
+ zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
}
/* }}} */
@@ -1204,6 +1205,8 @@ PHP_FUNCTION(curl_copy_handle)
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
zend_llist_copy(&dupch->to_free.str, &ch->to_free.str);
+ /* Don't try to free copied strings, they're free'd when the original handle is destroyed */
+ dupch->to_free.str.dtor = NULL;
zend_llist_copy(&dupch->to_free.slist, &ch->to_free.slist);
zend_llist_copy(&dupch->to_free.post, &ch->to_free.post);
@@ -1212,7 +1215,7 @@ PHP_FUNCTION(curl_copy_handle)
}
/* }}} */
-static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC)
+static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC) /* {{{ */
{
CURLcode error=CURLE_OK;
@@ -1601,6 +1604,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
return 0;
}
}
+/* }}} */
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
Set an option for a cURL transfer */
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 6d66b5fad..cefc5f441 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: multi.c,v 1.19.2.3.2.7 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: multi.c,v 1.19.2.3.2.9 2007/12/31 07:20:05 sebastian Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -122,13 +122,13 @@ void _php_curl_multi_cleanup_list(void *data) /* {{{ */
/* }}} */
/* Used internally as comparison routine passed to zend_list_del_element */
-static int curl_compare_resources( zval *z1, zval **z2 )
+static int curl_compare_resources( zval *z1, zval **z2 ) /* {{{ */
{
return (Z_TYPE_P( z1 ) == Z_TYPE_PP( z2 ) &&
Z_TYPE_P( z1 ) == IS_RESOURCE &&
Z_LVAL_P( z1 ) == Z_LVAL_PP( z2 ) );
}
-
+/* }}} */
/* {{{ proto int curl_multi_remove_handle(resource mh, resource ch)
Remove a multi handle from a set of cURL handles */
@@ -155,7 +155,7 @@ PHP_FUNCTION(curl_multi_remove_handle)
}
/* }}} */
-static void _make_timeval_struct(struct timeval *to, double timeout)
+static void _make_timeval_struct(struct timeval *to, double timeout) /* {{{ */
{
unsigned long conv;
@@ -163,6 +163,7 @@ static void _make_timeval_struct(struct timeval *to, double timeout)
to->tv_sec = conv / 1000000;
to->tv_usec = conv % 1000000;
}
+/* }}} */
/* {{{ proto int curl_multi_select(resource mh[, double timeout])
Get all the sockets associated with the cURL extension, which can then be "selected" */
@@ -319,7 +320,7 @@ PHP_FUNCTION(curl_multi_close)
}
/* }}} */
-void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
{
php_curlm *mh = (php_curlm *) rsrc->ptr;
if (mh) {
@@ -329,6 +330,7 @@ void _php_curl_multi_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
rsrc->ptr = NULL;
}
}
+/* }}} */
#endif
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 676671c4d..b17df0a77 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_curl.h,v 1.44.2.2.2.2 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: php_curl.h,v 1.44.2.2.2.3 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef _PHP_CURL_H
#define _PHP_CURL_H
diff --git a/ext/curl/streams.c b/ext/curl/streams.c
index b112bae83..2d73f25c8 100644
--- a/ext/curl/streams.c
+++ b/ext/curl/streams.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.14.2.2.2.11 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: streams.c,v 1.14.2.2.2.12 2007/12/31 07:20:05 sebastian Exp $ */
/* This file implements cURL based wrappers.
* NOTE: If you are implementing your own streams that are intended to
diff --git a/ext/date/lib/astro.c b/ext/date/lib/astro.c
index 17c03ba9b..87e91c448 100644
--- a/ext/date/lib/astro.c
+++ b/ext/date/lib/astro.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: astro.c,v 1.1.2.4.2.1 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: astro.c,v 1.1.2.4.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#include <stdio.h>
#include <math.h>
diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c
index 08e83d2da..4a5fa32d5 100644
--- a/ext/date/lib/dow.c
+++ b/ext/date/lib/dow.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dow.c,v 1.8.2.3.2.3 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: dow.c,v 1.8.2.3.2.5 2008/02/22 17:49:30 derick Exp $ */
#include "timelib.h"
@@ -35,10 +35,12 @@ static timelib_sll timelib_day_of_week_ex(timelib_sll y, timelib_sll m, timelib_
{
timelib_sll c1, y1, m1, dow;
- /* Only valid for Gregorian calendar */
+ /* Only valid for Gregorian calendar, commented out as we don't handle
+ * julian calendar. We just return the 'wrong' day of week to be
+ * consistent.
if (y < 1753) {
return -1;
- }
+ } */
c1 = century_value(y / 100);
y1 = (y % 100);
m1 = timelib_is_leap(y) ? m_table_leap[m] : m_table_common[m];
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 4d888a886..3c25760d6 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.12.1 on Thu Jul 12 19:32:22 2007 */
+/* Generated by re2c 0.12.1 on Mon Feb 25 19:27:05 2008 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.c,v 1.29.2.30.2.14 2007/07/12 18:59:55 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.16 2008/02/25 18:28:03 derick Exp $ */
#include "timelib.h"
@@ -668,7 +668,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
long value = 0;
const timelib_tz_lookup_table *tp;
- while (**ptr != '\0' && **ptr != ')') {
+ while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
++*ptr;
}
end = *ptr;
diff --git a/ext/date/lib/parse_date.c.orig b/ext/date/lib/parse_date.c.orig
index 79bad2b92..4948a2e82 100644
--- a/ext/date/lib/parse_date.c.orig
+++ b/ext/date/lib/parse_date.c.orig
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.12.1 on Thu Jul 12 19:32:22 2007 */
+/* Generated by re2c 0.12.1 on Mon Feb 25 19:27:05 2008 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.c,v 1.29.2.30.2.14 2007/07/12 18:59:55 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.16 2008/02/25 18:28:03 derick Exp $ */
#include "timelib.h"
@@ -669,7 +669,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
long value = 0;
const timelib_tz_lookup_table *tp;
- while (**ptr != '\0' && **ptr != ')') {
+ while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
++*ptr;
}
end = *ptr;
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index c88d12e5b..6a24ff1f0 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.re,v 1.26.2.27.2.12 2007/07/12 18:58:00 derick Exp $ */
+/* $Id: parse_date.re,v 1.26.2.27.2.13 2008/02/25 18:28:18 derick Exp $ */
#include "timelib.h"
@@ -667,7 +667,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
long value = 0;
const timelib_tz_lookup_table *tp;
- while (**ptr != '\0' && **ptr != ')') {
+ while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
++*ptr;
}
end = *ptr;
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index 5aae8e036..1ec5def7c 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_tz.c,v 1.20.2.6.2.13 2007/09/04 18:46:21 tony2001 Exp $ */
+/* $Id: parse_tz.c,v 1.20.2.6.2.14 2007/12/31 07:20:05 sebastian Exp $ */
#include "timelib.h"
diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c
index 3043ebdf2..1a5e3c632 100644
--- a/ext/date/lib/timelib.c
+++ b/ext/date/lib/timelib.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: timelib.c,v 1.7.2.4.2.6 2007/07/20 23:53:40 jani Exp $ */
+/* $Id: timelib.c,v 1.7.2.4.2.7 2007/12/31 07:20:05 sebastian Exp $ */
#include "timelib.h"
#include <ctype.h>
diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h
index 40e32494f..04db962bb 100644
--- a/ext/date/lib/timelib.h
+++ b/ext/date/lib/timelib.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,12 +16,15 @@
+----------------------------------------------------------------------+
*/
-/* $Id: timelib.h,v 1.10.2.11.2.3 2007/07/20 23:53:40 jani Exp $ */
+/* $Id: timelib.h,v 1.10.2.11.2.5 2008/02/22 09:48:18 derick Exp $ */
#ifndef __TIMELIB_H__
#define __TIMELIB_H__
#include "timelib_structs.h"
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h
index 323c95a8a..57eb4aafd 100644
--- a/ext/date/lib/timelib_structs.h
+++ b/ext/date/lib/timelib_structs.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: timelib_structs.h,v 1.13.2.6.2.3 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: timelib_structs.h,v 1.13.2.6.2.4 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef __TIMELIB_STRUCTS_H__
#define __TIMELIB_STRUCTS_H__
diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h
index cfab2c936..bbd1c570a 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[552] = {
+const timelib_tzdb_index_entry timezonedb_idx_builtin[557] = {
{ "Africa/Abidjan" , 0x000000 },
{ "Africa/Accra" , 0x000049 },
{ "Africa/Addis_Ababa" , 0x0000E5 },
@@ -58,502 +58,507 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[552] = {
{ "America/Antigua" , 0x002535 },
{ "America/Araguaina" , 0x00258F },
{ "America/Argentina/Buenos_Aires" , 0x0026D5 },
- { "America/Argentina/Catamarca" , 0x00284E },
- { "America/Argentina/ComodRivadavia" , 0x0029DE },
- { "America/Argentina/Cordoba" , 0x002B6E },
- { "America/Argentina/Jujuy" , 0x002CF4 },
- { "America/Argentina/La_Rioja" , 0x002E88 },
- { "America/Argentina/Mendoza" , 0x00301D },
- { "America/Argentina/Rio_Gallegos" , 0x0031BB },
- { "America/Argentina/San_Juan" , 0x00334B },
- { "America/Argentina/Tucuman" , 0x0034E0 },
- { "America/Argentina/Ushuaia" , 0x003670 },
- { "America/Aruba" , 0x003800 },
- { "America/Asuncion" , 0x00385A },
- { "America/Atikokan" , 0x003B33 },
- { "America/Atka" , 0x003BB9 },
- { "America/Bahia" , 0x003F13 },
- { "America/Barbados" , 0x00408B },
- { "America/Belem" , 0x004119 },
- { "America/Belize" , 0x0041FB },
- { "America/Blanc-Sablon" , 0x00436B },
- { "America/Boa_Vista" , 0x0043E0 },
- { "America/Bogota" , 0x0044D6 },
- { "America/Boise" , 0x004536 },
- { "America/Buenos_Aires" , 0x004898 },
- { "America/Cambridge_Bay" , 0x004A11 },
- { "America/Campo_Grande" , 0x004D11 },
- { "America/Cancun" , 0x004FE2 },
- { "America/Caracas" , 0x0051FD },
- { "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 },
+ { "America/Argentina/Catamarca" , 0x00297F },
+ { "America/Argentina/ComodRivadavia" , 0x002C40 },
+ { "America/Argentina/Cordoba" , 0x002F01 },
+ { "America/Argentina/Jujuy" , 0x0031B8 },
+ { "America/Argentina/La_Rioja" , 0x00347D },
+ { "America/Argentina/Mendoza" , 0x003743 },
+ { "America/Argentina/Rio_Gallegos" , 0x003A12 },
+ { "America/Argentina/San_Juan" , 0x003CD3 },
+ { "America/Argentina/San_Luis" , 0x003F99 },
+ { "America/Argentina/Tucuman" , 0x004138 },
+ { "America/Argentina/Ushuaia" , 0x0043F9 },
+ { "America/Aruba" , 0x0046BA },
+ { "America/Asuncion" , 0x004714 },
+ { "America/Atikokan" , 0x0049ED },
+ { "America/Atka" , 0x004A73 },
+ { "America/Bahia" , 0x004DCD },
+ { "America/Barbados" , 0x004F45 },
+ { "America/Belem" , 0x004FD3 },
+ { "America/Belize" , 0x0050B5 },
+ { "America/Blanc-Sablon" , 0x005225 },
+ { "America/Boa_Vista" , 0x00529A },
+ { "America/Bogota" , 0x005390 },
+ { "America/Boise" , 0x0053F0 },
+ { "America/Buenos_Aires" , 0x005752 },
+ { "America/Cambridge_Bay" , 0x0059FC },
+ { "America/Campo_Grande" , 0x005CFC },
+ { "America/Cancun" , 0x005FCD },
+ { "America/Caracas" , 0x0061E8 },
+ { "America/Catamarca" , 0x006243 },
+ { "America/Cayenne" , 0x006504 },
+ { "America/Cayman" , 0x00655A },
+ { "America/Chicago" , 0x0065A3 },
+ { "America/Chihuahua" , 0x006AA2 },
+ { "America/Coral_Harbour" , 0x006CCC },
+ { "America/Cordoba" , 0x006D52 },
+ { "America/Costa_Rica" , 0x007009 },
+ { "America/Cuiaba" , 0x007087 },
+ { "America/Curacao" , 0x00734E },
+ { "America/Danmarkshavn" , 0x0073A8 },
+ { "America/Dawson" , 0x0074BF },
+ { "America/Dawson_Creek" , 0x0077B6 },
+ { "America/Denver" , 0x00793B },
+ { "America/Detroit" , 0x007CA8 },
+ { "America/Dominica" , 0x007FD3 },
+ { "America/Edmonton" , 0x00801C },
+ { "America/Eirunepe" , 0x008386 },
+ { "America/El_Salvador" , 0x008472 },
+ { "America/Ensenada" , 0x0084DB },
+ { "America/Fort_Wayne" , 0x00894C },
+ { "America/Fortaleza" , 0x008838 },
+ { "America/Glace_Bay" , 0x008BAA },
+ { "America/Godthab" , 0x008ECE },
+ { "America/Goose_Bay" , 0x009178 },
+ { "America/Grand_Turk" , 0x009600 },
+ { "America/Grenada" , 0x0098A3 },
+ { "America/Guadeloupe" , 0x0098EC },
+ { "America/Guatemala" , 0x009935 },
+ { "America/Guayaquil" , 0x0099B2 },
+ { "America/Guyana" , 0x0099FB },
+ { "America/Halifax" , 0x009A70 },
+ { "America/Havana" , 0x009F4C },
+ { "America/Hermosillo" , 0x00A2B3 },
+ { "America/Indiana/Indianapolis" , 0x00A366 },
+ { "America/Indiana/Knox" , 0x00A5C4 },
+ { "America/Indiana/Marengo" , 0x00A929 },
+ { "America/Indiana/Petersburg" , 0x00AB9B },
+ { "America/Indiana/Tell_City" , 0x00B0AC },
+ { "America/Indiana/Vevay" , 0x00B314 },
+ { "America/Indiana/Vincennes" , 0x00B518 },
+ { "America/Indiana/Winamac" , 0x00B780 },
+ { "America/Indianapolis" , 0x00AE4E },
+ { "America/Inuvik" , 0x00BA06 },
+ { "America/Iqaluit" , 0x00BCC7 },
+ { "America/Jamaica" , 0x00BFB1 },
+ { "America/Jujuy" , 0x00C06A },
+ { "America/Juneau" , 0x00C32F },
+ { "America/Kentucky/Louisville" , 0x00C683 },
+ { "America/Kentucky/Monticello" , 0x00CA6C },
+ { "America/Knox_IN" , 0x00CDBF },
+ { "America/La_Paz" , 0x00D124 },
+ { "America/Lima" , 0x00D17F },
+ { "America/Los_Angeles" , 0x00D21B },
+ { "America/Louisville" , 0x00D614 },
+ { "America/Maceio" , 0x00D9FD },
+ { "America/Managua" , 0x00DB1B },
+ { "America/Manaus" , 0x00DBC2 },
+ { "America/Marigot" , 0x00DCAE },
+ { "America/Martinique" , 0x00DCF7 },
+ { "America/Mazatlan" , 0x00DD57 },
+ { "America/Mendoza" , 0x00DF90 },
+ { "America/Menominee" , 0x00E25F },
+ { "America/Merida" , 0x00E58D },
+ { "America/Mexico_City" , 0x00E79C },
+ { "America/Miquelon" , 0x00E9EE },
+ { "America/Moncton" , 0x00EC54 },
+ { "America/Monterrey" , 0x00F0C2 },
+ { "America/Montevideo" , 0x00F2C5 },
+ { "America/Montreal" , 0x00F5CB },
+ { "America/Montserrat" , 0x00FAAF },
+ { "America/Nassau" , 0x00FAF8 },
+ { "America/New_York" , 0x00FE31 },
+ { "America/Nipigon" , 0x010324 },
+ { "America/Nome" , 0x01061E },
+ { "America/Noronha" , 0x010977 },
+ { "America/North_Dakota/Center" , 0x010A8B },
+ { "America/North_Dakota/New_Salem" , 0x010DE8 },
+ { "America/Panama" , 0x011145 },
+ { "America/Pangnirtung" , 0x01118E },
+ { "America/Paramaribo" , 0x011495 },
+ { "America/Phoenix" , 0x01151B },
+ { "America/Port-au-Prince" , 0x01159D },
+ { "America/Port_of_Spain" , 0x01178F },
+ { "America/Porto_Acre" , 0x0116AD },
+ { "America/Porto_Velho" , 0x0117D8 },
+ { "America/Puerto_Rico" , 0x0118BA },
+ { "America/Rainy_River" , 0x011919 },
+ { "America/Rankin_Inlet" , 0x011C13 },
+ { "America/Recife" , 0x011ECF },
+ { "America/Regina" , 0x011FE3 },
+ { "America/Resolute" , 0x012160 },
+ { "America/Rio_Branco" , 0x0122E6 },
+ { "America/Rosario" , 0x0123C8 },
+ { "America/Santiago" , 0x01267F },
+ { "America/Santo_Domingo" , 0x012A0E },
+ { "America/Sao_Paulo" , 0x012AC8 },
+ { "America/Scoresbysund" , 0x012D99 },
+ { "America/Shiprock" , 0x01305C },
+ { "America/St_Barthelemy" , 0x0133C9 },
+ { "America/St_Johns" , 0x013412 },
+ { "America/St_Kitts" , 0x013931 },
+ { "America/St_Lucia" , 0x01397A },
+ { "America/St_Thomas" , 0x0139C3 },
+ { "America/St_Vincent" , 0x013A0C },
+ { "America/Swift_Current" , 0x013A55 },
+ { "America/Tegucigalpa" , 0x013B3C },
+ { "America/Thule" , 0x013BAF },
+ { "America/Thunder_Bay" , 0x013DDA },
+ { "America/Tijuana" , 0x0140F4 },
+ { "America/Toronto" , 0x014451 },
+ { "America/Tortola" , 0x014935 },
+ { "America/Vancouver" , 0x01497E },
+ { "America/Virgin" , 0x014D8B },
+ { "America/Whitehorse" , 0x014DD4 },
+ { "America/Winnipeg" , 0x0150CB },
+ { "America/Yakutat" , 0x0154D9 },
+ { "America/Yellowknife" , 0x015815 },
+ { "Antarctica/Casey" , 0x015AEC },
+ { "Antarctica/Davis" , 0x015B35 },
+ { "Antarctica/DumontDUrville" , 0x015B89 },
+ { "Antarctica/Mawson" , 0x015BE9 },
+ { "Antarctica/McMurdo" , 0x015C33 },
+ { "Antarctica/Palmer" , 0x015F0D },
+ { "Antarctica/Rothera" , 0x016200 },
+ { "Antarctica/South_Pole" , 0x01624A },
+ { "Antarctica/Syowa" , 0x016524 },
+ { "Antarctica/Vostok" , 0x01656E },
+ { "Arctic/Longyearbyen" , 0x0165B8 },
+ { "Asia/Aden" , 0x0168DE },
+ { "Asia/Almaty" , 0x016927 },
+ { "Asia/Amman" , 0x016A8C },
+ { "Asia/Anadyr" , 0x016D40 },
+ { "Asia/Aqtau" , 0x01700C },
+ { "Asia/Aqtobe" , 0x0171CE },
+ { "Asia/Ashgabat" , 0x01736B },
+ { "Asia/Ashkhabad" , 0x01747C },
+ { "Asia/Baghdad" , 0x01758D },
+ { "Asia/Bahrain" , 0x0176F6 },
+ { "Asia/Baku" , 0x017750 },
+ { "Asia/Bangkok" , 0x017A2C },
+ { "Asia/Beirut" , 0x017A75 },
+ { "Asia/Bishkek" , 0x017D76 },
+ { "Asia/Brunei" , 0x017F16 },
+ { "Asia/Calcutta" , 0x017F6C },
+ { "Asia/Choibalsan" , 0x017FD9 },
+ { "Asia/Chongqing" , 0x018127 },
+ { "Asia/Chungking" , 0x0181CA },
+ { "Asia/Colombo" , 0x01826D },
+ { "Asia/Dacca" , 0x0182FD },
+ { "Asia/Damascus" , 0x018380 },
+ { "Asia/Dhaka" , 0x0186C4 },
+ { "Asia/Dili" , 0x018747 },
+ { "Asia/Dubai" , 0x0187C4 },
+ { "Asia/Dushanbe" , 0x01880D },
+ { "Asia/Gaza" , 0x018904 },
+ { "Asia/Harbin" , 0x018C41 },
+ { "Asia/Ho_Chi_Minh" , 0x018CFB },
+ { "Asia/Hong_Kong" , 0x018D67 },
+ { "Asia/Hovd" , 0x018F11 },
+ { "Asia/Irkutsk" , 0x019052 },
+ { "Asia/Istanbul" , 0x019316 },
+ { "Asia/Jakarta" , 0x0196F7 },
+ { "Asia/Jayapura" , 0x019787 },
+ { "Asia/Jerusalem" , 0x0197E6 },
+ { "Asia/Kabul" , 0x019B09 },
+ { "Asia/Kamchatka" , 0x019B4E },
+ { "Asia/Karachi" , 0x019E12 },
+ { "Asia/Kashgar" , 0x019EA7 },
+ { "Asia/Katmandu" , 0x019F57 },
+ { "Asia/Kolkata" , 0x019FB1 },
+ { "Asia/Krasnoyarsk" , 0x01A01E },
+ { "Asia/Kuala_Lumpur" , 0x01A2E2 },
+ { "Asia/Kuching" , 0x01A380 },
+ { "Asia/Kuwait" , 0x01A453 },
+ { "Asia/Macao" , 0x01A49C },
+ { "Asia/Macau" , 0x01A5CB },
+ { "Asia/Magadan" , 0x01A6FA },
+ { "Asia/Makassar" , 0x01A9BE },
+ { "Asia/Manila" , 0x01AA2E },
+ { "Asia/Muscat" , 0x01AAA7 },
+ { "Asia/Nicosia" , 0x01AAF0 },
+ { "Asia/Novosibirsk" , 0x01ADCC },
+ { "Asia/Omsk" , 0x01B09D },
+ { "Asia/Oral" , 0x01B361 },
+ { "Asia/Phnom_Penh" , 0x01B516 },
+ { "Asia/Pontianak" , 0x01B582 },
+ { "Asia/Pyongyang" , 0x01B622 },
+ { "Asia/Qatar" , 0x01B683 },
+ { "Asia/Qyzylorda" , 0x01B6DD },
+ { "Asia/Rangoon" , 0x01B887 },
+ { "Asia/Riyadh" , 0x01B8F3 },
+ { "Asia/Saigon" , 0x01B93C },
+ { "Asia/Sakhalin" , 0x01B9A8 },
+ { "Asia/Samarkand" , 0x01BC81 },
+ { "Asia/Seoul" , 0x01BD9C },
+ { "Asia/Shanghai" , 0x01BE34 },
+ { "Asia/Singapore" , 0x01BED9 },
+ { "Asia/Taipei" , 0x01BF84 },
+ { "Asia/Tashkent" , 0x01C090 },
+ { "Asia/Tbilisi" , 0x01C1A6 },
+ { "Asia/Tehran" , 0x01C354 },
+ { "Asia/Tel_Aviv" , 0x01C5B6 },
+ { "Asia/Thimbu" , 0x01C8D9 },
+ { "Asia/Thimphu" , 0x01C933 },
+ { "Asia/Tokyo" , 0x01C98D },
+ { "Asia/Ujung_Pandang" , 0x01CA0A },
+ { "Asia/Ulaanbaatar" , 0x01CA7A },
+ { "Asia/Ulan_Bator" , 0x01CBBB },
+ { "Asia/Urumqi" , 0x01CCFC },
+ { "Asia/Vientiane" , 0x01CD9F },
+ { "Asia/Vladivostok" , 0x01CE0B },
+ { "Asia/Yakutsk" , 0x01D0D6 },
+ { "Asia/Yekaterinburg" , 0x01D39A },
+ { "Asia/Yerevan" , 0x01D689 },
+ { "Atlantic/Azores" , 0x01D981 },
+ { "Atlantic/Bermuda" , 0x01DE72 },
+ { "Atlantic/Canary" , 0x01E147 },
+ { "Atlantic/Cape_Verde" , 0x01E403 },
+ { "Atlantic/Faeroe" , 0x01E470 },
+ { "Atlantic/Faroe" , 0x01E708 },
+ { "Atlantic/Jan_Mayen" , 0x01E9A0 },
+ { "Atlantic/Madeira" , 0x01ECC6 },
+ { "Atlantic/Reykjavik" , 0x01F1B4 },
+ { "Atlantic/South_Georgia" , 0x01F361 },
+ { "Atlantic/St_Helena" , 0x01F661 },
+ { "Atlantic/Stanley" , 0x01F399 },
+ { "Australia/ACT" , 0x01F6AA },
+ { "Australia/Adelaide" , 0x01F9BB },
+ { "Australia/Brisbane" , 0x01FCCC },
+ { "Australia/Broken_Hill" , 0x01FD6C },
+ { "Australia/Canberra" , 0x020082 },
+ { "Australia/Currie" , 0x020393 },
+ { "Australia/Darwin" , 0x0206A4 },
+ { "Australia/Eucla" , 0x02070C },
+ { "Australia/Hobart" , 0x0207B7 },
+ { "Australia/LHI" , 0x020AF0 },
+ { "Australia/Lindeman" , 0x020D7F },
+ { "Australia/Lord_Howe" , 0x020E38 },
+ { "Australia/Melbourne" , 0x0210C7 },
+ { "Australia/North" , 0x0213D8 },
+ { "Australia/NSW" , 0x021440 },
+ { "Australia/Perth" , 0x021751 },
+ { "Australia/Queensland" , 0x0217FB },
+ { "Australia/South" , 0x02189B },
+ { "Australia/Sydney" , 0x021BAC },
+ { "Australia/Tasmania" , 0x021EBD },
+ { "Australia/Victoria" , 0x0221F6 },
+ { "Australia/West" , 0x022507 },
+ { "Australia/Yancowinna" , 0x0225B1 },
+ { "Brazil/Acre" , 0x0228C7 },
+ { "Brazil/DeNoronha" , 0x0229A9 },
+ { "Brazil/East" , 0x022ABD },
+ { "Brazil/West" , 0x022D8E },
+ { "Canada/Atlantic" , 0x022E7A },
+ { "Canada/Central" , 0x023356 },
+ { "Canada/East-Saskatchewan" , 0x023C48 },
+ { "Canada/Eastern" , 0x023764 },
+ { "Canada/Mountain" , 0x023DC5 },
+ { "Canada/Newfoundland" , 0x02412F },
+ { "Canada/Pacific" , 0x02464E },
+ { "Canada/Saskatchewan" , 0x024A5B },
+ { "Canada/Yukon" , 0x024BD8 },
+ { "CET" , 0x024ECF },
+ { "Chile/Continental" , 0x0251C2 },
+ { "Chile/EasterIsland" , 0x025551 },
+ { "CST6CDT" , 0x025887 },
+ { "Cuba" , 0x025BCC },
+ { "EET" , 0x025F33 },
+ { "Egypt" , 0x0261DA },
+ { "Eire" , 0x026595 },
+ { "EST" , 0x026A9A },
+ { "EST5EDT" , 0x026AD2 },
+ { "Etc/GMT" , 0x026E17 },
+ { "Etc/GMT+0" , 0x026EBF },
+ { "Etc/GMT+1" , 0x026F31 },
+ { "Etc/GMT+10" , 0x026FA6 },
+ { "Etc/GMT+11" , 0x02701C },
+ { "Etc/GMT+12" , 0x027092 },
+ { "Etc/GMT+2" , 0x02717D },
+ { "Etc/GMT+3" , 0x0271F1 },
+ { "Etc/GMT+4" , 0x027265 },
+ { "Etc/GMT+5" , 0x0272D9 },
+ { "Etc/GMT+6" , 0x02734D },
+ { "Etc/GMT+7" , 0x0273C1 },
+ { "Etc/GMT+8" , 0x027435 },
+ { "Etc/GMT+9" , 0x0274A9 },
+ { "Etc/GMT-0" , 0x026E87 },
+ { "Etc/GMT-1" , 0x026EF7 },
+ { "Etc/GMT-10" , 0x026F6B },
+ { "Etc/GMT-11" , 0x026FE1 },
+ { "Etc/GMT-12" , 0x027057 },
+ { "Etc/GMT-13" , 0x0270CD },
+ { "Etc/GMT-14" , 0x027108 },
+ { "Etc/GMT-2" , 0x027143 },
+ { "Etc/GMT-3" , 0x0271B7 },
+ { "Etc/GMT-4" , 0x02722B },
+ { "Etc/GMT-5" , 0x02729F },
+ { "Etc/GMT-6" , 0x027313 },
+ { "Etc/GMT-7" , 0x027387 },
+ { "Etc/GMT-8" , 0x0273FB },
+ { "Etc/GMT-9" , 0x02746F },
+ { "Etc/GMT0" , 0x026E4F },
+ { "Etc/Greenwich" , 0x0274E3 },
+ { "Etc/UCT" , 0x02751B },
+ { "Etc/Universal" , 0x027553 },
+ { "Etc/UTC" , 0x02758B },
+ { "Etc/Zulu" , 0x0275C3 },
+ { "Europe/Amsterdam" , 0x0275FB },
+ { "Europe/Andorra" , 0x027A2D },
+ { "Europe/Athens" , 0x027C9D },
+ { "Europe/Belfast" , 0x027FD4 },
+ { "Europe/Belgrade" , 0x0284FF },
+ { "Europe/Berlin" , 0x0287B7 },
+ { "Europe/Bratislava" , 0x028AFC },
+ { "Europe/Brussels" , 0x028E22 },
+ { "Europe/Bucharest" , 0x02924D },
+ { "Europe/Budapest" , 0x02956B },
+ { "Europe/Chisinau" , 0x0298CD },
+ { "Europe/Copenhagen" , 0x029C4F },
+ { "Europe/Dublin" , 0x029F4D },
+ { "Europe/Gibraltar" , 0x02A452 },
+ { "Europe/Guernsey" , 0x02A89D },
+ { "Europe/Helsinki" , 0x02ADC8 },
+ { "Europe/Isle_of_Man" , 0x02B072 },
+ { "Europe/Istanbul" , 0x02B59D },
+ { "Europe/Jersey" , 0x02B97E },
+ { "Europe/Kaliningrad" , 0x02BEA9 },
+ { "Europe/Kiev" , 0x02C1E9 },
+ { "Europe/Lisbon" , 0x02C4E6 },
+ { "Europe/Ljubljana" , 0x02C9D6 },
+ { "Europe/London" , 0x02CC8E },
+ { "Europe/Luxembourg" , 0x02D1B9 },
+ { "Europe/Madrid" , 0x02D603 },
+ { "Europe/Malta" , 0x02D9B5 },
+ { "Europe/Mariehamn" , 0x02DD62 },
+ { "Europe/Minsk" , 0x02E00C },
+ { "Europe/Monaco" , 0x02E30B },
+ { "Europe/Moscow" , 0x02E73A },
+ { "Europe/Nicosia" , 0x02EA69 },
+ { "Europe/Oslo" , 0x02ED45 },
+ { "Europe/Paris" , 0x02F06B },
+ { "Europe/Podgorica" , 0x02F4A5 },
+ { "Europe/Prague" , 0x02F75D },
+ { "Europe/Riga" , 0x02FA83 },
+ { "Europe/Rome" , 0x02FDBC },
+ { "Europe/Samara" , 0x030173 },
+ { "Europe/San_Marino" , 0x030477 },
+ { "Europe/Sarajevo" , 0x03082E },
+ { "Europe/Simferopol" , 0x030AE6 },
+ { "Europe/Skopje" , 0x030DF7 },
+ { "Europe/Sofia" , 0x0310AF },
+ { "Europe/Stockholm" , 0x03139E },
+ { "Europe/Tallinn" , 0x031641 },
+ { "Europe/Tirane" , 0x03196F },
+ { "Europe/Tiraspol" , 0x031C69 },
+ { "Europe/Uzhgorod" , 0x031FEB },
+ { "Europe/Vaduz" , 0x0322EE },
+ { "Europe/Vatican" , 0x032575 },
+ { "Europe/Vienna" , 0x03292C },
+ { "Europe/Vilnius" , 0x032C4D },
+ { "Europe/Volgograd" , 0x032F80 },
+ { "Europe/Warsaw" , 0x033266 },
+ { "Europe/Zagreb" , 0x03363B },
+ { "Europe/Zaporozhye" , 0x0338F3 },
+ { "Europe/Zurich" , 0x033BFA },
+ { "Factory" , 0x033EA7 },
+ { "GB" , 0x033F0C },
+ { "GB-Eire" , 0x034437 },
+ { "GMT" , 0x034962 },
+ { "GMT+0" , 0x034A0A },
+ { "GMT-0" , 0x0349D2 },
+ { "GMT0" , 0x03499A },
+ { "Greenwich" , 0x034A42 },
+ { "Hongkong" , 0x034A7A },
+ { "HST" , 0x034C24 },
+ { "Iceland" , 0x034C5C },
+ { "Indian/Antananarivo" , 0x034E09 },
+ { "Indian/Chagos" , 0x034E71 },
+ { "Indian/Christmas" , 0x034EC7 },
+ { "Indian/Cocos" , 0x034EFF },
+ { "Indian/Comoro" , 0x034F37 },
+ { "Indian/Kerguelen" , 0x034F80 },
+ { "Indian/Mahe" , 0x034FC9 },
+ { "Indian/Maldives" , 0x035012 },
+ { "Indian/Mauritius" , 0x03505B },
+ { "Indian/Mayotte" , 0x0350A4 },
+ { "Indian/Reunion" , 0x0350ED },
+ { "Iran" , 0x035136 },
+ { "Israel" , 0x035398 },
+ { "Jamaica" , 0x0356BB },
+ { "Japan" , 0x035774 },
+ { "Kwajalein" , 0x0357F1 },
+ { "Libya" , 0x035848 },
+ { "MET" , 0x035936 },
+ { "Mexico/BajaNorte" , 0x035C29 },
+ { "Mexico/BajaSur" , 0x035F86 },
+ { "Mexico/General" , 0x0361BF },
+ { "MST" , 0x036411 },
+ { "MST7MDT" , 0x036449 },
+ { "Navajo" , 0x03678E },
+ { "NZ" , 0x036AFB },
+ { "NZ-CHAT" , 0x036E6D },
+ { "Pacific/Apia" , 0x037149 },
+ { "Pacific/Auckland" , 0x0371A4 },
+ { "Pacific/Chatham" , 0x037516 },
+ { "Pacific/Easter" , 0x0377F2 },
+ { "Pacific/Efate" , 0x037B28 },
+ { "Pacific/Enderbury" , 0x037BE2 },
+ { "Pacific/Fakaofo" , 0x037C35 },
+ { "Pacific/Fiji" , 0x037C6D },
+ { "Pacific/Funafuti" , 0x037CD7 },
+ { "Pacific/Galapagos" , 0x037D0F },
+ { "Pacific/Gambier" , 0x037D6A },
+ { "Pacific/Guadalcanal" , 0x037DB4 },
+ { "Pacific/Guam" , 0x037DFD },
+ { "Pacific/Honolulu" , 0x037E47 },
+ { "Pacific/Johnston" , 0x037EC9 },
+ { "Pacific/Kiritimati" , 0x037F01 },
+ { "Pacific/Kosrae" , 0x037F54 },
+ { "Pacific/Kwajalein" , 0x037F9F },
+ { "Pacific/Majuro" , 0x037FF6 },
+ { "Pacific/Marquesas" , 0x03803B },
+ { "Pacific/Midway" , 0x038085 },
+ { "Pacific/Nauru" , 0x0380F5 },
+ { "Pacific/Niue" , 0x038161 },
+ { "Pacific/Norfolk" , 0x0381B3 },
+ { "Pacific/Noumea" , 0x0381FC },
+ { "Pacific/Pago_Pago" , 0x038280 },
+ { "Pacific/Palau" , 0x0382FD },
+ { "Pacific/Pitcairn" , 0x038335 },
+ { "Pacific/Ponape" , 0x03837E },
+ { "Pacific/Port_Moresby" , 0x0383B7 },
+ { "Pacific/Rarotonga" , 0x0383EF },
+ { "Pacific/Saipan" , 0x0384BF },
+ { "Pacific/Samoa" , 0x038516 },
+ { "Pacific/Tahiti" , 0x038593 },
+ { "Pacific/Tarawa" , 0x0385DD },
+ { "Pacific/Tongatapu" , 0x038616 },
+ { "Pacific/Truk" , 0x038696 },
+ { "Pacific/Wake" , 0x0386CF },
+ { "Pacific/Wallis" , 0x038708 },
+ { "Pacific/Yap" , 0x038740 },
+ { "Poland" , 0x038779 },
+ { "Portugal" , 0x038B4E },
+ { "PRC" , 0x03903E },
+ { "PST8PDT" , 0x0390E3 },
+ { "ROC" , 0x039428 },
+ { "ROK" , 0x039534 },
+ { "Singapore" , 0x0395CC },
+ { "Turkey" , 0x039677 },
+ { "UCT" , 0x039A58 },
+ { "Universal" , 0x039A90 },
+ { "US/Alaska" , 0x039AC8 },
+ { "US/Aleutian" , 0x039E25 },
+ { "US/Arizona" , 0x03A17F },
+ { "US/Central" , 0x03A201 },
+ { "US/East-Indiana" , 0x03ABF3 },
+ { "US/Eastern" , 0x03A700 },
+ { "US/Hawaii" , 0x03AE51 },
+ { "US/Indiana-Starke" , 0x03AED3 },
+ { "US/Michigan" , 0x03B238 },
+ { "US/Mountain" , 0x03B563 },
+ { "US/Pacific" , 0x03B8D0 },
+ { "US/Pacific-New" , 0x03BCC9 },
+ { "US/Samoa" , 0x03C0C2 },
+ { "UTC" , 0x03C13F },
+ { "W-SU" , 0x03C41E },
+ { "WET" , 0x03C177 },
+ { "Zulu" , 0x03C74D },
};
/* This is a generated file, do not modify */
-const unsigned char timelib_timezone_db_data_builtin[242022] = {
+const unsigned char timelib_timezone_db_data_builtin[247685] = {
/* Africa/Abidjan */
@@ -1320,7 +1325,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* America/Argentina/Buenos_Aires */
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, 0x38, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0D, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0D, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1334,19 +1339,38 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xF1, 0x30, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
-0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x01, 0x02, 0x01, 0x02,
+0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x47, 0x77, 0x09, 0xB0,
+0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0,
+0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0,
+0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30,
+0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30,
+0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30,
+0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0,
+0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0,
+0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0,
+0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30,
+0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30,
+0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0,
+0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0,
+0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0,
+0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30,
+0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30,
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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x02, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
-0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
-0x00, 0x04, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5,
+0xD0, 0x00, 0x04, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Argentina/Catamarca */
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, 0x3A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1361,20 +1385,39 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xFF, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xBB, 0xF1, 0x30,
-0x40, 0xD5, 0x0B, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xD5, 0x0B, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57,
-0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00,
/* America/Argentina/ComodRivadavia */
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, 0x3A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1389,20 +1432,39 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xFF, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xBB, 0xF1, 0x30,
-0x40, 0xD5, 0x0B, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xD5, 0x0B, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57,
-0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00,
/* America/Argentina/Cordoba */
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, 0x38, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1416,20 +1478,39 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xFF, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
-0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x01, 0x02, 0x01, 0x02,
+0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x47, 0x77, 0x09, 0xB0,
+0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0,
+0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0,
+0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30,
+0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30,
+0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30,
+0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0,
+0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0,
+0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0,
+0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30,
+0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30,
+0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0,
+0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0,
+0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0,
+0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30,
+0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30,
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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04,
-0x03, 0x04, 0x02, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
-0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
-0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00,
-0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5,
+0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54,
+0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Argentina/Jujuy */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1443,21 +1524,40 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x2A, 0x57, 0xC0,
0x27, 0xE2, 0xDB, 0xB0, 0x28, 0xEE, 0x8A, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
-0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x01, 0x02, 0x01, 0x02,
+0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x47, 0x77, 0x09, 0xB0,
+0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0,
+0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0,
+0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30,
+0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30,
+0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30,
+0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0,
+0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0,
+0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0,
+0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30,
+0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30,
+0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0,
+0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0,
+0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0,
+0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30,
+0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30,
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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x06, 0x05, 0x03, 0x04,
-0x03, 0x04, 0x02, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
-0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
-0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43, 0x4D,
-0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00,
-0x57, 0x41, 0x52, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05,
+0x06, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5,
+0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43,
+0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54,
+0x00, 0x57, 0x41, 0x52, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Argentina/La_Rioja */
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, 0x3B, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1472,20 +1572,39 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xCD, 0xB5, 0xA0, 0x28, 0x26, 0x26, 0x40, 0x29, 0x00, 0xF1, 0x30, 0x29, 0xB0, 0x3A, 0xA0,
0x2A, 0xE0, 0xD3, 0x30, 0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0,
-0x40, 0xBB, 0xF1, 0x30, 0x40, 0xD5, 0x0B, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xBB, 0xF1, 0x30, 0x40, 0xD5, 0x0B, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20,
+0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0,
+0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0,
+0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0,
+0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20,
+0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20,
+0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20,
+0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0,
+0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0,
+0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0,
+0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20,
+0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20,
+0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0,
+0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0,
+0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0,
+0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02,
-0x04, 0x05, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF,
-0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00,
-0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41,
-0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
+0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
+0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00,
+0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Argentina/Mendoza */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1500,20 +1619,39 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x19, 0x34, 0x40,
0x27, 0xCD, 0xC3, 0xB0, 0x28, 0xFA, 0x67, 0xC0, 0x29, 0xB0, 0x48, 0xB0, 0x2A, 0xE0, 0xE1, 0x40,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xB0, 0x13, 0xB0,
-0x41, 0x56, 0x3E, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x41, 0x56, 0x3E, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x05, 0x06, 0x05, 0x06, 0x05, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00,
-0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x57, 0x41, 0x52, 0x53, 0x54, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x06, 0x05, 0x06, 0x05, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54,
+0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x57, 0x41, 0x52, 0x53, 0x54,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Argentina/Rio_Gallegos */
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, 0x3A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1528,20 +1666,39 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xF1, 0x30, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xBB, 0xF1, 0x30,
-0x40, 0xD5, 0x0B, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xD5, 0x0B, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57,
-0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00,
/* America/Argentina/San_Juan */
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, 0x3B, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1556,20 +1713,67 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xCD, 0xB5, 0xA0, 0x28, 0x26, 0x26, 0x40, 0x29, 0x00, 0xF1, 0x30, 0x29, 0xB0, 0x3A, 0xA0,
0x2A, 0xE0, 0xD3, 0x30, 0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0,
-0x40, 0xBA, 0x9F, 0xB0, 0x41, 0x03, 0x30, 0x40, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xBA, 0x9F, 0xB0, 0x41, 0x03, 0x30, 0x40, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20,
+0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0,
+0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0,
+0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0,
+0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20,
+0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20,
+0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20,
+0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0,
+0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0,
+0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0,
+0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20,
+0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20,
+0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0,
+0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0,
+0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0,
+0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02,
-0x04, 0x05, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF,
-0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00,
-0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41,
-0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03,
+0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
+0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
+0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00,
+0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+/* America/Argentina/San_Luis */
+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, 0x3D, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
+0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
+0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
+0xC1, 0x9D, 0x9D, 0x40, 0xC2, 0x3B, 0xC3, 0x30, 0xC3, 0x7E, 0xD0, 0xC0, 0xC4, 0x1C, 0xF6, 0xB0,
+0xC5, 0x60, 0x04, 0x40, 0xC5, 0xFE, 0x2A, 0x30, 0xC7, 0x41, 0x37, 0xC0, 0xC7, 0xE0, 0xAF, 0x30,
+0xC8, 0x81, 0x94, 0x40, 0xCA, 0x4D, 0xA1, 0xB0, 0xCA, 0xEE, 0x86, 0xC0, 0xCE, 0x4D, 0xFF, 0x30,
+0xCE, 0xB0, 0xED, 0xC0, 0xD3, 0x29, 0x35, 0xB0, 0xD4, 0x43, 0x64, 0xC0, 0xF4, 0x3D, 0x08, 0x30,
+0xF4, 0x9F, 0xF6, 0xC0, 0xF5, 0x05, 0x6C, 0x30, 0xF6, 0x32, 0x10, 0x40, 0xF6, 0xE6, 0x9F, 0xB0,
+0xF8, 0x13, 0x43, 0xC0, 0xF8, 0xC7, 0xD3, 0x30, 0xF9, 0xF4, 0x77, 0x40, 0xFA, 0xD3, 0x36, 0xB0,
+0xFB, 0xC3, 0x35, 0xC0, 0xFC, 0xBC, 0x53, 0x30, 0xFD, 0xAC, 0x52, 0x40, 0xFE, 0x9C, 0x35, 0x30,
+0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
+0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
+0x27, 0xCD, 0xB5, 0xA0, 0x28, 0x26, 0x26, 0x40, 0x29, 0x00, 0xF1, 0x30, 0x29, 0xB0, 0x3A, 0xA0,
+0x2A, 0xE0, 0xD3, 0x30, 0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0,
+0x40, 0xBA, 0x9F, 0xB0, 0x41, 0x03, 0x30, 0x40, 0x47, 0x77, 0x09, 0xB0, 0x47, 0x93, 0xFC, 0xA0,
+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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0x03, 0x04, 0xFF, 0xFF, 0xC3,
+0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF,
+0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41,
+0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Argentina/Tucuman */
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, 0x3A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1584,20 +1788,39 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xFF, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xBB, 0xF1, 0x30,
-0x40, 0xCB, 0xD1, 0x40, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xCB, 0xD1, 0x40, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57,
-0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00,
/* America/Argentina/Ushuaia */
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, 0x3A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1612,15 +1835,34 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xF1, 0x30, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xB9, 0x4E, 0x30,
-0x40, 0xD5, 0x0B, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xD5, 0x0B, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57,
-0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00,
/* America/Aruba */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1922,7 +2164,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* America/Buenos_Aires */
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, 0x38, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0D, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0D, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -1936,14 +2178,33 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xF1, 0x30, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
-0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x01, 0x02, 0x01, 0x02,
+0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x47, 0x77, 0x09, 0xB0,
+0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0,
+0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0,
+0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30,
+0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30,
+0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30,
+0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0,
+0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0,
+0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0,
+0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30,
+0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30,
+0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0,
+0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0,
+0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0,
+0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30,
+0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30,
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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x02, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
-0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
-0x00, 0x04, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5,
+0xD0, 0x00, 0x04, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Cambridge_Bay */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -2084,14 +2345,14 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
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, 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,
+0xF6, 0x98, 0xEC, 0x48, 0x47, 0x5B, 0x92, 0x70, 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,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -2106,15 +2367,34 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xFF, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xBB, 0xF1, 0x30,
-0x40, 0xD5, 0x0B, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x40, 0xD5, 0x0B, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57,
-0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00,
+0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00,
/* America/Cayenne */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -2264,7 +2544,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* America/Cordoba */
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, 0x38, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -2278,15 +2558,34 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xFF, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
-0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x01, 0x02, 0x01, 0x02,
+0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x47, 0x77, 0x09, 0xB0,
+0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0,
+0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0,
+0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30,
+0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30,
+0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30,
+0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0,
+0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0,
+0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0,
+0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30,
+0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30,
+0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0,
+0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0,
+0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0,
+0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30,
+0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30,
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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04,
-0x03, 0x04, 0x02, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
-0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
-0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00,
-0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5,
+0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54,
+0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Costa_Rica */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -3132,22 +3431,22 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
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, 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,
+0x45, 0xF3, 0x8C, 0xD0, 0x47, 0x24, 0x17, 0x50, 0x47, 0xDC, 0xA9, 0x50, 0x49, 0x03, 0xF9, 0x50,
+0x49, 0xBC, 0x8B, 0x50, 0x4A, 0xE3, 0xDB, 0x50, 0x4B, 0xA5, 0xA7, 0xD0, 0x4C, 0xCC, 0xF7, 0xD0,
+0x4D, 0x85, 0x89, 0xD0, 0x4E, 0xAC, 0xD9, 0xD0, 0x4F, 0x65, 0x6B, 0xD0, 0x50, 0x8C, 0xBB, 0xD0,
+0x51, 0x45, 0x4D, 0xD0, 0x52, 0x6C, 0x9D, 0xD0, 0x53, 0x25, 0x2F, 0xD0, 0x54, 0x4C, 0x7F, 0xD0,
+0x55, 0x05, 0x11, 0xD0, 0x56, 0x2C, 0x61, 0xD0, 0x56, 0xEE, 0x2E, 0x50, 0x58, 0x15, 0x7E, 0x50,
+0x58, 0xCE, 0x10, 0x50, 0x59, 0xF5, 0x60, 0x50, 0x5A, 0xAD, 0xF2, 0x50, 0x5B, 0xD5, 0x42, 0x50,
+0x5C, 0x8D, 0xD4, 0x50, 0x5D, 0xB5, 0x24, 0x50, 0x5E, 0x6D, 0xB6, 0x50, 0x5F, 0x95, 0x06, 0x50,
+0x60, 0x56, 0xD2, 0xD0, 0x61, 0x7E, 0x22, 0xD0, 0x62, 0x36, 0xB4, 0xD0, 0x63, 0x5E, 0x04, 0xD0,
+0x64, 0x16, 0x96, 0xD0, 0x65, 0x3D, 0xE6, 0xD0, 0x65, 0xF6, 0x78, 0xD0, 0x67, 0x1D, 0xC8, 0xD0,
+0x67, 0xD6, 0x5A, 0xD0, 0x68, 0xFD, 0xAA, 0xD0, 0x69, 0xB6, 0x3C, 0xD0, 0x6A, 0xDD, 0x8C, 0xD0,
+0x6B, 0x9F, 0x59, 0x50, 0x6C, 0xC6, 0xA9, 0x50, 0x6D, 0x7F, 0x3B, 0x50, 0x6E, 0xA6, 0x8B, 0x50,
+0x6F, 0x5F, 0x1D, 0x50, 0x70, 0x86, 0x6D, 0x50, 0x71, 0x3E, 0xFF, 0x50, 0x72, 0x66, 0x4F, 0x50,
+0x73, 0x1E, 0xE1, 0x50, 0x74, 0x46, 0x31, 0x50, 0x75, 0x07, 0xFD, 0xD0, 0x76, 0x2F, 0x4D, 0xD0,
+0x76, 0xE7, 0xDF, 0xD0, 0x78, 0x0F, 0x2F, 0xD0, 0x78, 0xC7, 0xC1, 0xD0, 0x79, 0xEF, 0x11, 0xD0,
+0x7A, 0xA7, 0xA3, 0xD0, 0x7B, 0xCE, 0xF3, 0xD0, 0x7C, 0x87, 0x85, 0xD0, 0x7D, 0xAE, 0xD5, 0xD0,
+0x7E, 0x67, 0x67, 0xD0, 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,
@@ -3674,7 +3973,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* America/Jujuy */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -3688,16 +3987,35 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x2A, 0x57, 0xC0,
0x27, 0xE2, 0xDB, 0xB0, 0x28, 0xEE, 0x8A, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
-0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x01, 0x02, 0x01, 0x02,
+0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x47, 0x77, 0x09, 0xB0,
+0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0,
+0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0,
+0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30,
+0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30,
+0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30,
+0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0,
+0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0,
+0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0,
+0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30,
+0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30,
+0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0,
+0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0,
+0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0,
+0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30,
+0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30,
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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x06, 0x05, 0x03, 0x04,
-0x03, 0x04, 0x02, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
-0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
-0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43, 0x4D,
-0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00,
-0x57, 0x41, 0x52, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05,
+0x06, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5,
+0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43,
+0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54,
+0x00, 0x57, 0x41, 0x52, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Juneau */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -4134,6 +4452,13 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xD0, 0x01, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x09, 0x4C, 0x4D, 0x54, 0x00, 0x41, 0x4D, 0x53,
0x54, 0x00, 0x41, 0x4D, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* America/Marigot */
+0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xD5, 0xE1, 0xB0,
+0x01, 0xFF, 0xFF, 0xC6, 0x50, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
+
/* America/Martinique */
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,
@@ -4184,7 +4509,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* America/Mendoza */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x3A, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -4199,15 +4524,34 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x19, 0x34, 0x40,
0x27, 0xCD, 0xC3, 0xB0, 0x28, 0xFA, 0x67, 0xC0, 0x29, 0xB0, 0x48, 0xB0, 0x2A, 0xE0, 0xE1, 0x40,
0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x40, 0xB0, 0x13, 0xB0,
-0x41, 0x56, 0x3E, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x41, 0x56, 0x3E, 0xC0, 0x47, 0x77, 0x09, 0xB0, 0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0,
+0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0, 0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0,
+0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0, 0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30,
+0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30, 0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30,
+0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30, 0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30,
+0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30, 0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0,
+0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0, 0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0,
+0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0, 0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0,
+0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0, 0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30,
+0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30, 0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30,
+0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30, 0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30,
+0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0, 0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0,
+0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0, 0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0,
+0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0, 0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0,
+0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30, 0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30,
+0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30, 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, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x05, 0x06, 0x05, 0x06, 0x05, 0x03, 0x04, 0x02, 0x04, 0x05, 0x04, 0xFF, 0xFF,
-0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08,
-0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0,
-0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00,
-0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x57, 0x41, 0x52, 0x53, 0x54, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02,
+0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x06, 0x05, 0x06, 0x05, 0x03, 0x04, 0x02, 0x04,
+0x05, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0xFF,
+0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01,
+0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7,
+0xC0, 0x00, 0x0D, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x12, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54,
+0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x57, 0x41, 0x52, 0x53, 0x54,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Menominee */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -5337,7 +5681,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* America/Rosario */
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, 0x38, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
+0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0xA2, 0x92, 0x8F, 0x30,
0xB6, 0x7B, 0x52, 0x40, 0xB7, 0x1A, 0xC9, 0xB0, 0xB8, 0x1E, 0x8F, 0x40, 0xB8, 0xD4, 0x70, 0x30,
0xBA, 0x17, 0x7D, 0xC0, 0xBA, 0xB5, 0xA3, 0xB0, 0xBB, 0xF8, 0xB1, 0x40, 0xBC, 0x96, 0xD7, 0x30,
0xBD, 0xD9, 0xE4, 0xC0, 0xBE, 0x78, 0x0A, 0xB0, 0xBF, 0xBB, 0x18, 0x40, 0xC0, 0x5A, 0x8F, 0xB0,
@@ -5351,15 +5695,34 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0x8C, 0x34, 0x40, 0x07, 0xA3, 0x4A, 0xB0, 0x08, 0x24, 0x6F, 0xA0, 0x23, 0x94, 0xB5, 0xB0,
0x24, 0x10, 0x94, 0xA0, 0x25, 0x37, 0xF2, 0xB0, 0x25, 0xF0, 0x76, 0xA0, 0x27, 0x21, 0x0F, 0x30,
0x27, 0xD0, 0x58, 0xA0, 0x29, 0x00, 0xFF, 0x40, 0x29, 0xB0, 0x3A, 0xA0, 0x2A, 0xE0, 0xD3, 0x30,
-0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x01, 0x02, 0x01, 0x02,
+0x2B, 0x99, 0x57, 0x20, 0x37, 0xF6, 0xC6, 0xB0, 0x38, 0xBF, 0x2A, 0xB0, 0x47, 0x77, 0x09, 0xB0,
+0x47, 0xDC, 0x7F, 0x20, 0x48, 0xE8, 0x2D, 0xB0, 0x49, 0xBC, 0x61, 0x20, 0x4A, 0xC8, 0x0F, 0xB0,
+0x4B, 0xA5, 0x7D, 0xA0, 0x4C, 0xA7, 0xF1, 0xB0, 0x4D, 0x85, 0x5F, 0xA0, 0x4E, 0x87, 0xD3, 0xB0,
+0x4F, 0x65, 0x41, 0xA0, 0x50, 0x70, 0xF0, 0x30, 0x51, 0x45, 0x23, 0xA0, 0x52, 0x50, 0xD2, 0x30,
+0x53, 0x25, 0x05, 0xA0, 0x54, 0x30, 0xB4, 0x30, 0x55, 0x04, 0xE7, 0xA0, 0x56, 0x10, 0x96, 0x30,
+0x56, 0xEE, 0x04, 0x20, 0x57, 0xF0, 0x78, 0x30, 0x58, 0xCD, 0xE6, 0x20, 0x59, 0xD0, 0x5A, 0x30,
+0x5A, 0xAD, 0xC8, 0x20, 0x5B, 0xB9, 0x76, 0xB0, 0x5C, 0x8D, 0xAA, 0x20, 0x5D, 0x99, 0x58, 0xB0,
+0x5E, 0x6D, 0x8C, 0x20, 0x5F, 0x79, 0x3A, 0xB0, 0x60, 0x56, 0xA8, 0xA0, 0x61, 0x59, 0x1C, 0xB0,
+0x62, 0x36, 0x8A, 0xA0, 0x63, 0x38, 0xFE, 0xB0, 0x64, 0x16, 0x6C, 0xA0, 0x65, 0x18, 0xE0, 0xB0,
+0x65, 0xF6, 0x4E, 0xA0, 0x67, 0x01, 0xFD, 0x30, 0x67, 0xD6, 0x30, 0xA0, 0x68, 0xE1, 0xDF, 0x30,
+0x69, 0xB6, 0x12, 0xA0, 0x6A, 0xC1, 0xC1, 0x30, 0x6B, 0x9F, 0x2F, 0x20, 0x6C, 0xA1, 0xA3, 0x30,
+0x6D, 0x7F, 0x11, 0x20, 0x6E, 0x81, 0x85, 0x30, 0x6F, 0x5E, 0xF3, 0x20, 0x70, 0x6A, 0xA1, 0xB0,
+0x71, 0x3E, 0xD5, 0x20, 0x72, 0x4A, 0x83, 0xB0, 0x73, 0x1E, 0xB7, 0x20, 0x74, 0x2A, 0x65, 0xB0,
+0x75, 0x07, 0xD3, 0xA0, 0x76, 0x0A, 0x47, 0xB0, 0x76, 0xE7, 0xB5, 0xA0, 0x77, 0xEA, 0x29, 0xB0,
+0x78, 0xC7, 0x97, 0xA0, 0x79, 0xCA, 0x0B, 0xB0, 0x7A, 0xA7, 0x79, 0xA0, 0x7B, 0xB3, 0x28, 0x30,
+0x7C, 0x87, 0x5B, 0xA0, 0x7D, 0x93, 0x0A, 0x30, 0x7E, 0x67, 0x3D, 0xA0, 0x7F, 0x72, 0xEC, 0x30,
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, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x05, 0x03, 0x04,
-0x03, 0x04, 0x02, 0x04, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04,
-0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5, 0xD0,
-0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54, 0x00,
-0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x05, 0x03, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
+0x03, 0x04, 0x03, 0x04, 0x03, 0xFF, 0xFF, 0xC3, 0xD0, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00,
+0x04, 0xFF, 0xFF, 0xD5, 0xD0, 0x01, 0x08, 0xFF, 0xFF, 0xE3, 0xE0, 0x01, 0x08, 0xFF, 0xFF, 0xD5,
+0xD0, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x0D, 0x43, 0x4D, 0x54, 0x00, 0x41, 0x52, 0x54,
+0x00, 0x41, 0x52, 0x53, 0x54, 0x00, 0x57, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Santiago */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -5389,7 +5752,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, 0x3D, 0xA8, 0xEF, 0xC0, 0x3E, 0x6A, 0xAE, 0x30,
0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, 0x41, 0x68, 0xB3, 0xC0, 0x42, 0x33, 0xAC, 0xB0,
0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, 0x45, 0x31, 0xB2, 0x40, 0x45, 0xF3, 0x70, 0xB0,
-0x47, 0x11, 0x94, 0x40, 0x47, 0xD3, 0x52, 0xB0, 0x48, 0xF1, 0x76, 0x40, 0x49, 0xBC, 0x6F, 0x30,
+0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, 0x48, 0xF1, 0x76, 0x40, 0x49, 0xBC, 0x6F, 0x30,
0x4A, 0xD1, 0x58, 0x40, 0x4B, 0x9C, 0x51, 0x30, 0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0x7C, 0x33, 0x30,
0x4E, 0x91, 0x1C, 0x40, 0x4F, 0x5C, 0x15, 0x30, 0x50, 0x7A, 0x38, 0xC0, 0x51, 0x3B, 0xF7, 0x30,
0x52, 0x5A, 0x1A, 0xC0, 0x53, 0x1B, 0xD9, 0x30, 0x54, 0x39, 0xFC, 0xC0, 0x55, 0x04, 0xF5, 0xB0,
@@ -5586,6 +5949,13 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0xFF, 0xAB, 0xA0, 0x01, 0x0C, 0x4D, 0x44, 0x54, 0x00, 0x4D, 0x53, 0x54, 0x00, 0x4D, 0x57, 0x54,
0x00, 0x4D, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+/* America/St_Barthelemy */
+0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x91, 0xD5, 0xE1, 0xB0,
+0x01, 0xFF, 0xFF, 0xC6, 0x50, 0x00, 0x00, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x4C, 0x4D, 0x54,
+0x00, 0x41, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
+
/* America/St_Johns */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
@@ -6729,7 +7099,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* Asia/Baghdad */
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, 0x71, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0C, 0x9E, 0x30, 0x3C, 0xE0,
+0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0C, 0x9E, 0x30, 0x3C, 0xE0,
0x17, 0x30, 0x68, 0x50, 0x17, 0xFA, 0x0F, 0xC0, 0x18, 0xE8, 0xBD, 0x50, 0x19, 0xDB, 0x43, 0x40,
0x1A, 0xCC, 0x93, 0xD0, 0x1B, 0xBD, 0xC8, 0x40, 0x1C, 0xAD, 0xC7, 0x50, 0x1D, 0x9C, 0x74, 0xE0,
0x1E, 0x8C, 0x65, 0xE0, 0x1F, 0x7C, 0x56, 0xE0, 0x20, 0x6C, 0x47, 0xE0, 0x21, 0x5C, 0x38, 0xE0,
@@ -6743,32 +7113,13 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x3C, 0xA7, 0xA3, 0x00, 0x3D, 0x98, 0xE5, 0x80, 0x3E, 0x88, 0xD6, 0x80, 0x3F, 0x7A, 0x19, 0x00,
0x40, 0x6B, 0x5B, 0x80, 0x41, 0x5C, 0x9E, 0x00, 0x42, 0x4C, 0x8F, 0x00, 0x43, 0x3D, 0xD1, 0x80,
0x44, 0x2D, 0xC2, 0x80, 0x45, 0x1F, 0x05, 0x00, 0x46, 0x0E, 0xF6, 0x00, 0x47, 0x00, 0x38, 0x80,
-0x47, 0xF1, 0x7B, 0x00, 0x48, 0xE2, 0xBD, 0x80, 0x49, 0xD2, 0xAE, 0x80, 0x4A, 0xC3, 0xF1, 0x00,
-0x4B, 0xB3, 0xE2, 0x00, 0x4C, 0xA5, 0x24, 0x80, 0x4D, 0x95, 0x15, 0x80, 0x4E, 0x86, 0x58, 0x00,
-0x4F, 0x77, 0x9A, 0x80, 0x50, 0x68, 0xDD, 0x00, 0x51, 0x58, 0xCE, 0x00, 0x52, 0x4A, 0x10, 0x80,
-0x53, 0x3A, 0x01, 0x80, 0x54, 0x2B, 0x44, 0x00, 0x55, 0x1B, 0x35, 0x00, 0x56, 0x0C, 0x77, 0x80,
-0x56, 0xFD, 0xBA, 0x00, 0x57, 0xEE, 0xFC, 0x80, 0x58, 0xDE, 0xED, 0x80, 0x59, 0xD0, 0x30, 0x00,
-0x5A, 0xC0, 0x21, 0x00, 0x5B, 0xB1, 0x63, 0x80, 0x5C, 0xA1, 0x54, 0x80, 0x5D, 0x92, 0x97, 0x00,
-0x5E, 0x83, 0xD9, 0x80, 0x5F, 0x75, 0x1C, 0x00, 0x60, 0x65, 0x0D, 0x00, 0x61, 0x56, 0x4F, 0x80,
-0x62, 0x46, 0x40, 0x80, 0x63, 0x37, 0x83, 0x00, 0x64, 0x27, 0x74, 0x00, 0x65, 0x18, 0xB6, 0x80,
-0x66, 0x09, 0xF9, 0x00, 0x66, 0xFB, 0x3B, 0x80, 0x67, 0xEB, 0x2C, 0x80, 0x68, 0xDC, 0x6F, 0x00,
-0x69, 0xCC, 0x60, 0x00, 0x6A, 0xBD, 0xA2, 0x80, 0x6B, 0xAD, 0x93, 0x80, 0x6C, 0x9E, 0xD6, 0x00,
-0x6D, 0x90, 0x18, 0x80, 0x6E, 0x81, 0x5B, 0x00, 0x6F, 0x71, 0x4C, 0x00, 0x70, 0x62, 0x8E, 0x80,
-0x71, 0x52, 0x7F, 0x80, 0x72, 0x43, 0xC2, 0x00, 0x73, 0x33, 0xB3, 0x00, 0x74, 0x24, 0xF5, 0x80,
-0x75, 0x16, 0x38, 0x00, 0x76, 0x07, 0x7A, 0x80, 0x76, 0xF7, 0x6B, 0x80, 0x77, 0xE8, 0xAE, 0x00,
-0x78, 0xD8, 0x9F, 0x00, 0x79, 0xC9, 0xE1, 0x80, 0x7A, 0xB9, 0xD2, 0x80, 0x7B, 0xAB, 0x15, 0x00,
-0x7C, 0x9C, 0x57, 0x80, 0x7D, 0x8D, 0x9A, 0x00, 0x7E, 0x7D, 0x8B, 0x00, 0x7F, 0x6E, 0xCD, 0x80,
0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
-0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
-0x03, 0x00, 0x00, 0x29, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, 0x38,
-0x40, 0x01, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, 0x38, 0x40, 0x01, 0x08, 0x42,
-0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x41, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-0x00, 0x00, 0x00, 0x00, 0x00,
+0x03, 0x04, 0x03, 0x04, 0x03, 0x00, 0x00, 0x29, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x00,
+0x04, 0x00, 0x00, 0x38, 0x40, 0x01, 0x08, 0x00, 0x00, 0x2A, 0x30, 0x00, 0x04, 0x00, 0x00, 0x38,
+0x40, 0x01, 0x08, 0x42, 0x4D, 0x54, 0x00, 0x41, 0x53, 0x54, 0x00, 0x41, 0x44, 0x54, 0x00, 0x00,
+0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Asia/Bahrain */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -7028,22 +7379,22 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
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, 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,
+0x46, 0x0C, 0x36, 0xE0, 0x47, 0x2A, 0x3E, 0x50, 0x47, 0xF5, 0x53, 0x60, 0x48, 0xE2, 0x93, 0x50,
+0x49, 0xD5, 0x35, 0x60, 0x4A, 0xC3, 0xC6, 0xD0, 0x4B, 0xB5, 0x17, 0x60, 0x4C, 0xA4, 0xFA, 0x50,
+0x4D, 0x94, 0xF9, 0x60, 0x4E, 0x86, 0x2D, 0xD0, 0x4F, 0x7E, 0x15, 0xE0, 0x50, 0x68, 0xB2, 0xD0,
+0x51, 0x5D, 0xF7, 0xE0, 0x52, 0x49, 0xE6, 0x50, 0x53, 0x3D, 0xD9, 0xE0, 0x54, 0x2B, 0x19, 0xD0,
+0x55, 0x1D, 0xBB, 0xE0, 0x56, 0x0C, 0x4D, 0x50, 0x56, 0xFD, 0x9D, 0xE0, 0x57, 0xEE, 0xD2, 0x50,
+0x58, 0xE6, 0xBA, 0x60, 0x59, 0xD0, 0x05, 0xD0, 0x5A, 0xC6, 0x9C, 0x60, 0x5B, 0xB1, 0x39, 0x50,
+0x5C, 0xA6, 0x7E, 0x60, 0x5D, 0x92, 0x6C, 0xD0, 0x5E, 0x86, 0x60, 0x60, 0x5F, 0x74, 0xF1, 0xD0,
+0x60, 0x66, 0x42, 0x60, 0x61, 0x56, 0x25, 0x50, 0x62, 0x46, 0x24, 0x60, 0x63, 0x37, 0x58, 0xD0,
+0x64, 0x2F, 0x40, 0xE0, 0x65, 0x18, 0x8C, 0x50, 0x66, 0x0F, 0x22, 0xE0, 0x66, 0xFB, 0x11, 0x50,
+0x67, 0xEF, 0x04, 0xE0, 0x68, 0xDC, 0x44, 0xD0, 0x69, 0xCE, 0xE6, 0xE0, 0x6A, 0xBD, 0x78, 0x50,
+0x6B, 0xAE, 0xC8, 0xE0, 0x6C, 0x9E, 0xAB, 0xD0, 0x6D, 0x97, 0xE5, 0x60, 0x6E, 0x81, 0x30, 0xD0,
+0x6F, 0x77, 0xC7, 0x60, 0x70, 0x62, 0x64, 0x50, 0x71, 0x57, 0xA9, 0x60, 0x72, 0x43, 0x97, 0xD0,
+0x73, 0x37, 0x8B, 0x60, 0x74, 0x24, 0xCB, 0x50, 0x75, 0x17, 0x6D, 0x60, 0x76, 0x07, 0x50, 0x50,
+0x76, 0xF7, 0x4F, 0x60, 0x77, 0xE8, 0x83, 0xD0, 0x78, 0xE0, 0x6B, 0xE0, 0x79, 0xC9, 0xB7, 0x50,
+0x7A, 0xC0, 0x4D, 0xE0, 0x7B, 0xAA, 0xEA, 0xD0, 0x7C, 0xA0, 0x2F, 0xE0, 0x7D, 0x8D, 0x6F, 0xD0,
+0x7E, 0x80, 0x11, 0xE0, 0x7F, 0x6E, 0xA3, 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,
@@ -7171,6 +7522,15 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x4D, 0x54, 0x00, 0x43, 0x48, 0x41, 0x54, 0x00, 0x43, 0x53, 0x54, 0x00, 0x43, 0x44, 0x54, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* Asia/Ho_Chi_Minh */
+0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x88, 0x6F, 0x42, 0x80,
+0x91, 0x5F, 0xEE, 0xD0, 0x93, 0x85, 0xB1, 0x90, 0xB7, 0x41, 0xBC, 0x00, 0x01, 0x02, 0x03, 0x02,
+0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0xEC, 0x00, 0x04, 0x00, 0x00, 0x62, 0x70,
+0x00, 0x08, 0x00, 0x00, 0x70, 0x80, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x53, 0x4D, 0x54, 0x00,
+0x49, 0x43, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
/* Asia/Hong_Kong */
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,
@@ -7496,6 +7856,15 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x00, 0x04, 0x00, 0x00, 0x50, 0xDC, 0x00, 0x08, 0x4C, 0x4D, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00,
0x4E, 0x50, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* Asia/Kolkata */
+0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0D, 0xCA, 0xDB, 0x86, 0xB0,
+0xCC, 0x05, 0x71, 0x18, 0xCC, 0x95, 0x32, 0xA8, 0xD2, 0x74, 0x12, 0x98, 0x01, 0x02, 0x03, 0x02,
+0x00, 0x00, 0x52, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x5B, 0x68, 0x00, 0x04, 0x00, 0x00, 0x4D, 0x58,
+0x00, 0x09, 0x00, 0x00, 0x5B, 0x68, 0x01, 0x09, 0x48, 0x4D, 0x54, 0x00, 0x42, 0x55, 0x52, 0x54,
+0x00, 0x49, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
/* Asia/Krasnoyarsk */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
@@ -10602,7 +10971,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, 0x3D, 0xA8, 0xEF, 0xC0, 0x3E, 0x6A, 0xAE, 0x30,
0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, 0x41, 0x68, 0xB3, 0xC0, 0x42, 0x33, 0xAC, 0xB0,
0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, 0x45, 0x31, 0xB2, 0x40, 0x45, 0xF3, 0x70, 0xB0,
-0x47, 0x11, 0x94, 0x40, 0x47, 0xD3, 0x52, 0xB0, 0x48, 0xF1, 0x76, 0x40, 0x49, 0xBC, 0x6F, 0x30,
+0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, 0x48, 0xF1, 0x76, 0x40, 0x49, 0xBC, 0x6F, 0x30,
0x4A, 0xD1, 0x58, 0x40, 0x4B, 0x9C, 0x51, 0x30, 0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0x7C, 0x33, 0x30,
0x4E, 0x91, 0x1C, 0x40, 0x4F, 0x5C, 0x15, 0x30, 0x50, 0x7A, 0x38, 0xC0, 0x51, 0x3B, 0xF7, 0x30,
0x52, 0x5A, 0x1A, 0xC0, 0x53, 0x1B, 0xD9, 0x30, 0x54, 0x39, 0xFC, 0xC0, 0x55, 0x04, 0xF5, 0xB0,
@@ -10657,7 +11026,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x3A, 0xAA, 0xEA, 0x30, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, 0x3D, 0xA8, 0xEF, 0xC0,
0x3E, 0x6A, 0xAE, 0x30, 0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, 0x41, 0x68, 0xB3, 0xC0,
0x42, 0x33, 0xAC, 0xB0, 0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, 0x45, 0x31, 0xB2, 0x40,
-0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xD3, 0x52, 0xB0, 0x48, 0xF1, 0x76, 0x40,
+0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, 0x48, 0xF1, 0x76, 0x40,
0x49, 0xBC, 0x6F, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0x9C, 0x51, 0x30, 0x4C, 0xB1, 0x3A, 0x40,
0x4D, 0x7C, 0x33, 0x30, 0x4E, 0x91, 0x1C, 0x40, 0x4F, 0x5C, 0x15, 0x30, 0x50, 0x7A, 0x38, 0xC0,
0x51, 0x3B, 0xF7, 0x30, 0x52, 0x5A, 0x1A, 0xC0, 0x53, 0x1B, 0xD9, 0x30, 0x54, 0x39, 0xFC, 0xC0,
@@ -10769,22 +11138,22 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
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, 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,
+0x45, 0xF3, 0x8C, 0xD0, 0x47, 0x24, 0x17, 0x50, 0x47, 0xDC, 0xA9, 0x50, 0x49, 0x03, 0xF9, 0x50,
+0x49, 0xBC, 0x8B, 0x50, 0x4A, 0xE3, 0xDB, 0x50, 0x4B, 0xA5, 0xA7, 0xD0, 0x4C, 0xCC, 0xF7, 0xD0,
+0x4D, 0x85, 0x89, 0xD0, 0x4E, 0xAC, 0xD9, 0xD0, 0x4F, 0x65, 0x6B, 0xD0, 0x50, 0x8C, 0xBB, 0xD0,
+0x51, 0x45, 0x4D, 0xD0, 0x52, 0x6C, 0x9D, 0xD0, 0x53, 0x25, 0x2F, 0xD0, 0x54, 0x4C, 0x7F, 0xD0,
+0x55, 0x05, 0x11, 0xD0, 0x56, 0x2C, 0x61, 0xD0, 0x56, 0xEE, 0x2E, 0x50, 0x58, 0x15, 0x7E, 0x50,
+0x58, 0xCE, 0x10, 0x50, 0x59, 0xF5, 0x60, 0x50, 0x5A, 0xAD, 0xF2, 0x50, 0x5B, 0xD5, 0x42, 0x50,
+0x5C, 0x8D, 0xD4, 0x50, 0x5D, 0xB5, 0x24, 0x50, 0x5E, 0x6D, 0xB6, 0x50, 0x5F, 0x95, 0x06, 0x50,
+0x60, 0x56, 0xD2, 0xD0, 0x61, 0x7E, 0x22, 0xD0, 0x62, 0x36, 0xB4, 0xD0, 0x63, 0x5E, 0x04, 0xD0,
+0x64, 0x16, 0x96, 0xD0, 0x65, 0x3D, 0xE6, 0xD0, 0x65, 0xF6, 0x78, 0xD0, 0x67, 0x1D, 0xC8, 0xD0,
+0x67, 0xD6, 0x5A, 0xD0, 0x68, 0xFD, 0xAA, 0xD0, 0x69, 0xB6, 0x3C, 0xD0, 0x6A, 0xDD, 0x8C, 0xD0,
+0x6B, 0x9F, 0x59, 0x50, 0x6C, 0xC6, 0xA9, 0x50, 0x6D, 0x7F, 0x3B, 0x50, 0x6E, 0xA6, 0x8B, 0x50,
+0x6F, 0x5F, 0x1D, 0x50, 0x70, 0x86, 0x6D, 0x50, 0x71, 0x3E, 0xFF, 0x50, 0x72, 0x66, 0x4F, 0x50,
+0x73, 0x1E, 0xE1, 0x50, 0x74, 0x46, 0x31, 0x50, 0x75, 0x07, 0xFD, 0xD0, 0x76, 0x2F, 0x4D, 0xD0,
+0x76, 0xE7, 0xDF, 0xD0, 0x78, 0x0F, 0x2F, 0xD0, 0x78, 0xC7, 0xC1, 0xD0, 0x79, 0xEF, 0x11, 0xD0,
+0x7A, 0xA7, 0xA3, 0xD0, 0x7B, 0xCE, 0xF3, 0xD0, 0x7C, 0x87, 0x85, 0xD0, 0x7D, 0xAE, 0xD5, 0xD0,
+0x7E, 0x67, 0x67, 0xD0, 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,
@@ -15657,7 +16026,7 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
0x3A, 0xAA, 0xEA, 0x30, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x8A, 0xCC, 0x30, 0x3D, 0xA8, 0xEF, 0xC0,
0x3E, 0x6A, 0xAE, 0x30, 0x3F, 0x88, 0xD1, 0xC0, 0x40, 0x53, 0xCA, 0xB0, 0x41, 0x68, 0xB3, 0xC0,
0x42, 0x33, 0xAC, 0xB0, 0x43, 0x48, 0x95, 0xC0, 0x44, 0x13, 0x8E, 0xB0, 0x45, 0x31, 0xB2, 0x40,
-0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xD3, 0x52, 0xB0, 0x48, 0xF1, 0x76, 0x40,
+0x45, 0xF3, 0x70, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xEF, 0x02, 0x30, 0x48, 0xF1, 0x76, 0x40,
0x49, 0xBC, 0x6F, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0x9C, 0x51, 0x30, 0x4C, 0xB1, 0x3A, 0x40,
0x4D, 0x7C, 0x33, 0x30, 0x4E, 0x91, 0x1C, 0x40, 0x4F, 0x5C, 0x15, 0x30, 0x50, 0x7A, 0x38, 0xC0,
0x51, 0x3B, 0xF7, 0x30, 0x52, 0x5A, 0x1A, 0xC0, 0x53, 0x1B, 0xD9, 0x30, 0x54, 0x39, 0xFC, 0xC0,
@@ -17067,4 +17436,4 @@ const unsigned char timelib_timezone_db_data_builtin[242022] = {
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.9", 552, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
+const timelib_tzdb timezonedb_builtin = { "2008.2", 557, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c
index b0cbff966..a4e6996b2 100644
--- a/ext/date/lib/tm2unixtime.c
+++ b/ext/date/lib/tm2unixtime.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tm2unixtime.c,v 1.13.2.3.2.2 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: tm2unixtime.c,v 1.13.2.3.2.4 2008/01/26 16:26:47 derick Exp $ */
#include "timelib.h"
@@ -98,6 +98,7 @@ static void do_adjust_for_weekday(timelib_time* time)
} else {
time->d -= (7 - (abs(time->relative.weekday) - current_dow));
}
+ time->have_weekday_relative = 0;
}
static void do_normalize(timelib_time* time)
@@ -130,6 +131,7 @@ static void do_adjust_relative(timelib_time* time)
do_normalize(time);
memset(&(time->relative), 0, sizeof(time->relative));
+ time->have_relative = 0;
}
static void do_adjust_special_weekday(timelib_time* time)
diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c
index 2de7bcf2e..4b36e9c94 100644
--- a/ext/date/lib/unixtime2tm.c
+++ b/ext/date/lib/unixtime2tm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: unixtime2tm.c,v 1.12.2.4.2.3 2007/07/12 18:58:00 derick Exp $ */
+/* $Id: unixtime2tm.c,v 1.12.2.4.2.4 2007/12/31 07:20:05 sebastian Exp $ */
#include "timelib.h"
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 597271241..25189b5c6 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.c,v 1.43.2.45.2.51 2007/07/12 18:59:05 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.58 2008/04/16 17:21:46 derick Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -266,7 +266,18 @@ struct _php_date_obj {
struct _php_timezone_obj {
zend_object std;
- timelib_tzinfo *tz;
+ int initialized;
+ int type;
+ union {
+ timelib_tzinfo *tz; // TIMELIB_ZONETYPE_ID;
+ timelib_sll utc_offset; // TIMELIB_ZONETYPE_OFFSET
+ struct // TIMELIB_ZONETYPE_ABBR
+ {
+ timelib_sll utc_offset;
+ char *abbr;
+ int dst;
+ } z;
+ } tzi;
};
#define DATE_SET_CONTEXT \
@@ -735,9 +746,9 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
offset->abbr = strdup(t->tz_abbr);
} else if (t->zone_type == TIMELIB_ZONETYPE_OFFSET) {
offset = timelib_time_offset_ctor();
- offset->offset = (t->z - (t->dst * 60)) * -60;
+ offset->offset = (t->z) * -60;
offset->leap_secs = 0;
- offset->is_dst = t->dst;
+ offset->is_dst = 0;
offset->abbr = malloc(9); /* GMT±xxxx\0 */
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
@@ -808,7 +819,26 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
);
break;
case 'T': length = slprintf(buffer, 32, "%s", localtime ? offset->abbr : "GMT"); break;
- case 'e': length = slprintf(buffer, 32, "%s", localtime ? t->tz_info->name : "UTC"); break;
+ case 'e': if (!localtime) {
+ length = slprintf(buffer, 32, "%s", "UTC");
+ } else {
+ switch (t->zone_type) {
+ case TIMELIB_ZONETYPE_ID:
+ length = slprintf(buffer, 32, "%s", t->tz_info->name);
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ length = slprintf(buffer, 32, "%s", offset->abbr);
+ break;
+ case TIMELIB_ZONETYPE_OFFSET:
+ length = slprintf(buffer, 32, "%c%02d:%02d",
+ ((offset->offset < 0) ? '-' : '+'),
+ abs(offset->offset / 3600),
+ abs((offset->offset % 3600) / 60)
+ );
+ break;
+ }
+ }
+ break;
case 'Z': length = slprintf(buffer, 32, "%d", localtime ? offset->offset : 0); break;
/* full date/time */
@@ -1086,7 +1116,7 @@ PHP_FUNCTION(strtotime)
now = timelib_time_ctor();
initial_ts = emalloc(25);
- snprintf(initial_ts, 24, "@%ld", preset_ts);
+ snprintf(initial_ts, 24, "@%ld UTC", preset_ts);
t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
timelib_update_ts(t, tzi);
now->tz_info = tzi;
@@ -1590,7 +1620,21 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
- new_obj->tz = old_obj->tz;
+ new_obj->type = old_obj->type;
+ new_obj->initialized = 1;
+ switch (new_obj->type) {
+ case TIMELIB_ZONETYPE_ID:
+ new_obj->tzi.tz = old_obj->tzi.tz;
+ break;
+ case TIMELIB_ZONETYPE_OFFSET:
+ new_obj->tzi.utc_offset = old_obj->tzi.utc_offset;
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ new_obj->tzi.z.utc_offset = old_obj->tzi.z.utc_offset;
+ new_obj->tzi.z.dst = old_obj->tzi.z.dst;
+ new_obj->tzi.z.abbr = old_obj->tzi.z.abbr;
+ break;
+ }
return new_ov;
}
@@ -1614,6 +1658,9 @@ static void date_object_free_storage_timezone(void *object TSRMLS_DC)
{
php_timezone_obj *intern = (php_timezone_obj *)object;
+ if (intern->type == TIMELIB_ZONETYPE_ABBR) {
+ free(intern->tzi.z.abbr);
+ }
zend_object_std_dtor(&intern->std TSRMLS_CC);
efree(object);
}
@@ -1632,12 +1679,14 @@ static zval * date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
return object;
}
-static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, zval *timezone_object TSRMLS_DC)
+static int date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, zval *timezone_object, int ctor TSRMLS_DC)
{
timelib_time *now;
timelib_tzinfo *tzi;
timelib_error_container *err = NULL;
- int free_tzi = 0;
+ int free_tzi = 0, type = TIMELIB_ZONETYPE_ID, new_dst, errors_found = 0;
+ char *new_abbr;
+ timelib_sll new_offset;
if (dateobj->time) {
if (dateobj->time->tz_info) {
@@ -1646,21 +1695,39 @@ static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int
timelib_time_dtor(dateobj->time);
}
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &err, DATE_TIMEZONEDB);
- if (err) {
- if (err->error_count) {
+
+ if (err && err->error_count) {
+ if (ctor) {
/* spit out the first library error message, at least */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse time string (%s) at position %d (%c): %s", time_str,
- err->error_messages[0].position, err->error_messages[0].character, err->error_messages[0].message);
+ err->error_messages[0].position, err->error_messages[0].character, err->error_messages[0].message);
}
- timelib_error_container_dtor(err);
+ errors_found = 1;
+ }
+ timelib_error_container_dtor(err);
+ if (errors_found) {
+ return 0;
}
if (timezone_object) {
php_timezone_obj *tzobj;
tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
- tzi = timelib_tzinfo_clone(tzobj->tz);
- free_tzi = 1;
+ switch (tzobj->type) {
+ case TIMELIB_ZONETYPE_ID:
+ tzi = timelib_tzinfo_clone(tzobj->tzi.tz);
+ free_tzi = 1;
+ break;
+ case TIMELIB_ZONETYPE_OFFSET:
+ new_offset = tzobj->tzi.utc_offset;
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ new_offset = tzobj->tzi.z.utc_offset;
+ new_dst = tzobj->tzi.z.dst;
+ new_abbr = strdup(tzobj->tzi.z.abbr);
+ break;
+ }
+ type = tzobj->type;
} else if (dateobj->time->tz_info) {
tzi = timelib_tzinfo_clone(dateobj->time->tz_info);
free_tzi = 1;
@@ -1669,8 +1736,20 @@ static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int
}
now = timelib_time_ctor();
- now->tz_info = tzi;
- now->zone_type = TIMELIB_ZONETYPE_ID;
+ now->zone_type = type;
+ switch (type) {
+ case TIMELIB_ZONETYPE_ID:
+ now->tz_info = tzi;
+ break;
+ case TIMELIB_ZONETYPE_OFFSET:
+ now->z = new_offset;
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ now->z = new_offset;
+ now->dst = new_dst;
+ now->tz_abbr = new_abbr;
+ break;
+ }
timelib_unixtime2local(now, (timelib_sll) time(NULL));
timelib_fill_holes(dateobj->time, now, 0);
@@ -1678,13 +1757,15 @@ static void date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int
dateobj->time->have_weekday_relative = dateobj->time->have_relative = 0;
- if (now->tz_info != tzi) {
+ if (type == TIMELIB_ZONETYPE_ID && now->tz_info != tzi) {
timelib_tzinfo_dtor(now->tz_info);
}
if (free_tzi) {
timelib_tzinfo_dtor(tzi);
}
- timelib_time_dtor(now);
+ timelib_time_dtor(now);
+
+ return 1;
}
/* {{{ proto DateTime date_create([string time[, DateTimeZone object]])
@@ -1701,7 +1782,9 @@ PHP_FUNCTION(date_create)
}
date_instantiate(date_ce_date, return_value TSRMLS_CC);
- date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, timezone_object TSRMLS_CC);
+ if (!date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, timezone_object, 0 TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
}
/* }}} */
@@ -1716,7 +1799,7 @@ PHP_METHOD(DateTime, __construct)
php_set_error_handling(EH_THROW, NULL TSRMLS_CC);
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) {
- date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, timezone_object TSRMLS_CC);
+ date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, timezone_object, 1 TSRMLS_CC);
}
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
@@ -1889,10 +1972,24 @@ PHP_FUNCTION(date_timezone_get)
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- if (dateobj->time->is_localtime && dateobj->time->tz_info) {
+ if (dateobj->time->is_localtime/* && dateobj->time->tz_info*/) {
date_instantiate(date_ce_timezone, return_value TSRMLS_CC);
tzobj = (php_timezone_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
- tzobj->tz = timelib_tzinfo_clone(dateobj->time->tz_info);
+ tzobj->initialized = 1;
+ tzobj->type = dateobj->time->zone_type;
+ switch (dateobj->time->zone_type) {
+ case TIMELIB_ZONETYPE_ID:
+ tzobj->tzi.tz = dateobj->time->tz_info;
+ break;
+ case TIMELIB_ZONETYPE_OFFSET:
+ tzobj->tzi.utc_offset = dateobj->time->z;
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ tzobj->tzi.z.utc_offset = dateobj->time->z;
+ tzobj->tzi.z.dst = dateobj->time->dst;
+ tzobj->tzi.z.abbr = strdup(dateobj->time->tz_abbr);
+ break;
+ }
} else {
RETURN_FALSE;
}
@@ -1915,10 +2012,13 @@ PHP_FUNCTION(date_timezone_set)
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
+ if (tzobj->type != TIMELIB_ZONETYPE_ID) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now");
+ }
if (dateobj->time->tz_info) {
timelib_tzinfo_dtor(dateobj->time->tz_info);
}
- timelib_set_timezone(dateobj->time, timelib_tzinfo_clone(tzobj->tz));
+ timelib_set_timezone(dateobj->time, timelib_tzinfo_clone(tzobj->tzi.tz));
timelib_unixtime2local(dateobj->time, dateobj->time->sse);
}
/* }}} */
@@ -1937,10 +2037,20 @@ PHP_FUNCTION(date_offset_get)
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- if (dateobj->time->is_localtime && dateobj->time->tz_info) {
- offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info);
- RETVAL_LONG(offset->offset);
- timelib_time_offset_dtor(offset);
+ if (dateobj->time->is_localtime/* && dateobj->time->tz_info*/) {
+ switch (dateobj->time->zone_type) {
+ case TIMELIB_ZONETYPE_ID:
+ offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info);
+ RETVAL_LONG(offset->offset);
+ timelib_time_offset_dtor(offset);
+ break;
+ case TIMELIB_ZONETYPE_OFFSET:
+ RETVAL_LONG(dateobj->time->z * -60);
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60);
+ break;
+ }
return;
} else {
RETURN_LONG(0);
@@ -2042,6 +2152,7 @@ PHP_FUNCTION(timezone_open)
char *tz;
int tz_len;
timelib_tzinfo *tzi = NULL;
+ php_timezone_obj *tzobj;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) {
RETURN_FALSE;
@@ -2049,7 +2160,10 @@ PHP_FUNCTION(timezone_open)
if (SUCCESS != timezone_initialize(&tzi, tz TSRMLS_CC)) {
RETURN_FALSE;
}
- ((php_timezone_obj *) zend_object_store_get_object(date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC))->tz = tzi;
+ tzobj = zend_object_store_get_object(date_instantiate(date_ce_timezone, return_value TSRMLS_CC) TSRMLS_CC);
+ tzobj->type = TIMELIB_ZONETYPE_ID;
+ tzobj->tzi.tz = tzi;
+ tzobj->initialized = 1;
}
/* }}} */
@@ -2061,11 +2175,17 @@ PHP_METHOD(DateTimeZone, __construct)
char *tz;
int tz_len;
timelib_tzinfo *tzi = NULL;
+ php_timezone_obj *tzobj;
php_set_error_handling(EH_THROW, NULL TSRMLS_CC);
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) {
- ((php_timezone_obj *) zend_object_store_get_object(getThis() TSRMLS_CC))->tz = tzi;
+ tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
+ tzobj->type = TIMELIB_ZONETYPE_ID;
+ tzobj->tzi.tz = tzi;
+ tzobj->initialized = 1;
+ } else {
+ ZVAL_NULL(getThis());
}
}
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
@@ -2084,9 +2204,28 @@ PHP_FUNCTION(timezone_name_get)
RETURN_FALSE;
}
tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
- DATE_CHECK_INITIALIZED(tzobj->tz, DateTimeZone);
+ DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
+
+ switch (tzobj->type) {
+ case TIMELIB_ZONETYPE_ID:
+ RETURN_STRING(tzobj->tzi.tz->name, 1);
+ break;
+ case TIMELIB_ZONETYPE_OFFSET: {
+ char *tmpstr = emalloc(sizeof("UTC+05:00"));
+ timelib_sll utc_offset = tzobj->tzi.utc_offset;
- RETURN_STRING(tzobj->tz->name, 1);
+ snprintf(tmpstr, sizeof("+05:00"), "%c%02d:%02d",
+ utc_offset > 0 ? '-' : '+',
+ abs(utc_offset / 60),
+ abs((utc_offset % 60)));
+
+ RETURN_STRING(tmpstr, 0);
+ }
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ RETURN_STRING(tzobj->tzi.z.abbr, 1);
+ break;
+ }
}
/* }}} */
@@ -2128,13 +2267,23 @@ PHP_FUNCTION(timezone_offset_get)
RETURN_FALSE;
}
tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
- DATE_CHECK_INITIALIZED(tzobj->tz, DateTimeZone);
+ DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
dateobj = (php_date_obj *) zend_object_store_get_object(dateobject TSRMLS_CC);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
- offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tz);
- RETVAL_LONG(offset->offset);
- timelib_time_offset_dtor(offset);
+ switch (tzobj->type) {
+ case TIMELIB_ZONETYPE_ID:
+ offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz);
+ RETVAL_LONG(offset->offset);
+ timelib_time_offset_dtor(offset);
+ break;
+ case TIMELIB_ZONETYPE_OFFSET:
+ RETURN_LONG(tzobj->tzi.utc_offset * -60);
+ break;
+ case TIMELIB_ZONETYPE_ABBR:
+ RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60);
+ break;
+ }
}
/* }}} */
@@ -2151,17 +2300,20 @@ PHP_FUNCTION(timezone_transitions_get)
RETURN_FALSE;
}
tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
- DATE_CHECK_INITIALIZED(tzobj->tz, DateTimeZone);
+ DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
+ if (tzobj->type != TIMELIB_ZONETYPE_ID) {
+ RETURN_FALSE;
+ }
array_init(return_value);
- for (i = 0; i < tzobj->tz->timecnt; ++i) {
+ for (i = 0; i < tzobj->tzi.tz->timecnt; ++i) {
MAKE_STD_ZVAL(element);
array_init(element);
- add_assoc_long(element, "ts", tzobj->tz->trans[i]);
- add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0);
- add_assoc_long(element, "offset", tzobj->tz->type[tzobj->tz->trans_idx[i]].offset);
- add_assoc_bool(element, "isdst", tzobj->tz->type[tzobj->tz->trans_idx[i]].isdst);
- add_assoc_string(element, "abbr", &tzobj->tz->timezone_abbr[tzobj->tz->type[tzobj->tz->trans_idx[i]].abbr_idx], 1);
+ add_assoc_long(element, "ts", tzobj->tzi.tz->trans[i]);
+ add_assoc_string(element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tzi.tz->trans[i], 0 TSRMLS_CC), 0);
+ add_assoc_long(element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset);
+ add_assoc_bool(element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst);
+ add_assoc_string(element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx], 1);
add_next_index_zval(return_value, element);
}
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index ac01af728..79e2785dc 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.h,v 1.17.2.11.2.3 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: php_date.h,v 1.17.2.11.2.4 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef PHP_DATE_H
#define PHP_DATE_H
diff --git a/ext/date/tests/bug40743.phpt b/ext/date/tests/bug40743.phpt
new file mode 100644
index 000000000..f3ce17124
--- /dev/null
+++ b/ext/date/tests/bug40743.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #40743 (DateTime ignores the TimeZone object passed to the constructor)
+--FILE--
+<?php
+$dt = new DateTime('@1200506699', new DateTimeZone('Europe/Berlin'));
+echo $dt->format(DATE_RFC822), "\n";
+echo $dt->format('T e Z'), "\n";
+echo "-----\n";
+
+date_default_timezone_set('America/New_York');
+
+$dt = new DateTime('16 Jan 08 13:04:59');
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('@1200506699');
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('@1200506699');
+$dt->setTimezone( new DateTimeZone( 'America/New_York' ) );
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('@1200506699', new DateTimeZone('Europe/Berlin'));
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('16 Jan 08 13:04:59 America/Chicago');
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+
+$dt = new DateTime('16 Jan 08 13:04:59 America/Chicago', new DateTimeZone('Europe/Berlin'));
+echo $dt->format(DATE_RFC822 . " e T O U"), "\n";
+?>
+--EXPECT--
+Wed, 16 Jan 08 18:04:59 +0000
+GMT+0000 +00:00 0
+-----
+Wed, 16 Jan 08 13:04:59 -0500 America/New_York EST -0500 1200506699
+Wed, 16 Jan 08 18:04:59 +0000 +00:00 GMT+0000 +0000 1200506699
+Wed, 16 Jan 08 13:04:59 -0500 America/New_York EST -0500 1200506699
+Wed, 16 Jan 08 18:04:59 +0000 +00:00 GMT+0000 +0000 1200506699
+Wed, 16 Jan 08 13:04:59 -0600 America/Chicago CST -0600 1200510299
+Wed, 16 Jan 08 13:04:59 -0600 America/Chicago CST -0600 1200510299
diff --git a/ext/date/tests/bug41523-64bit.phpt b/ext/date/tests/bug41523-64bit.phpt
new file mode 100644
index 000000000..9b4e90061
--- /dev/null
+++ b/ext/date/tests/bug41523-64bit.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+var_dump( date_parse('0000-00-00 00:00:00') );
+var_dump( strtotime('0000-00-00 00:00:00') );
+var_dump( $dt = new DateTime('0000-00-00 00:00:00') );
+echo $dt->format( DateTime::ISO8601 ), "\n";
+
+?>
+--EXPECT--
+array(12) {
+ ["year"]=>
+ int(0)
+ ["month"]=>
+ int(0)
+ ["day"]=>
+ int(0)
+ ["hour"]=>
+ int(0)
+ ["minute"]=>
+ int(0)
+ ["second"]=>
+ int(0)
+ ["fraction"]=>
+ float(0)
+ ["warning_count"]=>
+ int(0)
+ ["warnings"]=>
+ array(0) {
+ }
+ ["error_count"]=>
+ int(0)
+ ["errors"]=>
+ array(0) {
+ }
+ ["is_localtime"]=>
+ bool(false)
+}
+int(-62169984000)
+object(DateTime)#1 (0) {
+}
+-0001-11-30T00:00:00+0000
diff --git a/ext/date/tests/bug41523.phpt b/ext/date/tests/bug41523.phpt
index c8aa00fd7..5b0d5bd19 100644
--- a/ext/date/tests/bug41523.phpt
+++ b/ext/date/tests/bug41523.phpt
@@ -1,5 +1,7 @@
--TEST--
-Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30)
+Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
--FILE--
<?php
date_default_timezone_set("UTC");
diff --git a/ext/date/tests/bug41599.phpt b/ext/date/tests/bug41599.phpt
new file mode 100644
index 000000000..e4febe2cd
--- /dev/null
+++ b/ext/date/tests/bug41599.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #41599 (setTime() fails after modify() is used)
+--FILE--
+<?php
+date_default_timezone_set('Europe/London');
+
+$start = new DateTime('2008-01-17 last Monday');
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//good
+
+$start->modify('Tuesday');
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//good
+
+$start->setTime(4, 0, 0);
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//jumped to next Sunday
+
+$start->setTime(8, 0, 0);
+echo $start->format('Y-m-d H:i:s'),PHP_EOL;
+//jumped to next Sunday again
+?>
+--EXPECT--
+2008-01-14 00:00:00
+2008-01-15 00:00:00
+2008-01-15 04:00:00
+2008-01-15 08:00:00
diff --git a/ext/date/tests/bug42910.phpt b/ext/date/tests/bug42910.phpt
new file mode 100644
index 000000000..1bd079081
--- /dev/null
+++ b/ext/date/tests/bug42910.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #42910 (Constructing DateTime with TimeZone Indicator invalidates DateTimeZone)
+--FILE--
+<?php
+ date_default_timezone_set('America/Los_Angeles');
+ $foo = new DateTime('2007-03-11');
+ $bar = new DateTime('2007-03-11T00:00:00-0800');
+
+ print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
+ print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
+
+ $foo->setDate(2007, 03, 12);
+ $bar->setDate(2007, 03, 12);
+
+ print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
+ print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
+
+// --------------
+
+ date_default_timezone_set('Australia/Sydney');
+
+ $date= date_create('2007-11-04 12:00:00+0200');
+ var_dump(date_format($date, 'O e'));
+?>
+--EXPECT--
+2007-03-11T00:00:00-0800 - America/Los_Angeles - 1173600000
+2007-03-11T00:00:00-0800 - -08:00 - 1173600000
+2007-03-12T00:00:00-0700 - America/Los_Angeles - 1173682800
+2007-03-12T00:00:00-0800 - -08:00 - 1173686400
+string(12) "+0200 +02:00"
diff --git a/ext/date/tests/bug43003.phpt b/ext/date/tests/bug43003.phpt
new file mode 100644
index 000000000..8070358b9
--- /dev/null
+++ b/ext/date/tests/bug43003.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #43003 (Invalid timezone reported for DateTime objects constructed using a timestamp)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Oslo');
+
+$oDateTest = new DateTime("@0", new DateTimeZone(date_default_timezone_get()));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest->setTimezone(new DateTimeZone("UTC"));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest->setTimezone(new DateTimeZone(date_default_timezone_get()));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest = new DateTime("@0");
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+
+$oDateTest->setTimezone( new DateTimeZone(date_default_timezone_get()));
+echo $oDateTest->getTimezone()->getName().": " . $oDateTest->format("Y-m-d H:i:s")."\n";
+?>
+--EXPECT--
++00:00: 1970-01-01 00:00:00
+UTC: 1970-01-01 00:00:00
+Europe/Oslo: 1970-01-01 01:00:00
++00:00: 1970-01-01 00:00:00
+Europe/Oslo: 1970-01-01 01:00:00
diff --git a/ext/date/tests/bug43527.phpt b/ext/date/tests/bug43527.phpt
new file mode 100644
index 000000000..cc69def7b
--- /dev/null
+++ b/ext/date/tests/bug43527.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #43527 (DateTime created from a timestamp reports environment timezone)
+--FILE--
+<?php
+date_default_timezone_set("Etc/GMT+1");
+$datetime = new DateTime('Fri, 07 Dec 2007 19:05:14 +1000');
+echo $datetime->getTimezone()->getName(), "\n";
+?>
+--EXPECT--
++10:00
diff --git a/ext/date/tests/bug43808.phpt b/ext/date/tests/bug43808.phpt
new file mode 100644
index 000000000..fe8102199
--- /dev/null
+++ b/ext/date/tests/bug43808.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #43808 (date_create never fails (even when it should))
+--FILE--
+<?php
+$date = date_create('asdfasdf');
+
+if ($date instanceof DateTime) {
+ echo "this is wrong, should be bool";
+}
+
+var_dump( $date );
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/date/tests/bug44742.phpt b/ext/date/tests/bug44742.phpt
new file mode 100644
index 000000000..48952b4e6
--- /dev/null
+++ b/ext/date/tests/bug44742.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #44742 (timezone_offset_get() causes segmentation faults)
+--FILE--
+<?php
+date_default_timezone_set('Europe/London');
+$dates = array(
+ "2008-04-11 00:00:00+0000",
+ "2008-04-11 00:00:00+0200",
+ "2008-04-11 00:00:00+0330",
+ "2008-04-11 00:00:00-0500",
+ "2008-04-11 00:00:00-1130",
+ "2008-04-11 00:00:00 CEST",
+ "2008-04-11 00:00:00 CET",
+ "2008-04-11 00:00:00 UTC",
+ "2008-04-11 00:00:00 America/New_York",
+ "2008-04-11 00:00:00 Europe/Oslo",
+ "2008-04-11 00:00:00 Asia/Singapore",
+);
+foreach ($dates as $date)
+{
+ $date = date_create($date);
+ var_dump(timezone_offset_get(date_timezone_get($date), $date));
+}
+?>
+--EXPECT--
+int(0)
+int(7200)
+int(12600)
+int(-18000)
+int(-41400)
+int(7200)
+int(3600)
+int(0)
+int(-14400)
+int(7200)
+int(28800)
diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt
new file mode 100644
index 000000000..bb3fb2df7
--- /dev/null
+++ b/ext/date/tests/mktime-3-64bit.phpt
@@ -0,0 +1,56 @@
+--TEST--
+mktime() [3] (64-bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK" ?>
+--INI--
+error_reporting=2047
+--FILE--
+<?php
+$tzs = array("America/Toronto", "Europe/Oslo");
+$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001);
+
+foreach ($tzs as $tz) {
+ echo $tz, "\n";
+ date_default_timezone_set($tz);
+ foreach ($years as $year) {
+ printf("Y: %4d - ", $year);
+ $ret = mktime(1, 1, 1, 1, 1, $year);
+ if ($ret == FALSE) {
+ echo "out of range\n";
+ } else {
+ echo date("F ".DATE_ISO8601, $ret), "\n";
+ }
+ }
+ echo "\n";
+}
+?>
+--EXPECT--
+America/Toronto
+Y: 0 - January 2000-01-01T01:01:01-0500
+Y: 69 - January 2069-01-01T01:01:01-0500
+Y: 70 - January 1970-01-01T01:01:01-0500
+Y: 71 - January 1971-01-01T01:01:01-0500
+Y: 99 - January 1999-01-01T01:01:01-0500
+Y: 100 - January 2000-01-01T01:01:01-0500
+Y: 105 - January 2005-01-01T01:01:01-0500
+Y: 1900 - January 1900-01-01T01:01:01-0500
+Y: 1901 - January 1901-01-01T01:01:01-0500
+Y: 1902 - January 1902-01-01T01:01:01-0500
+Y: 1999 - January 1999-01-01T01:01:01-0500
+Y: 2000 - January 2000-01-01T01:01:01-0500
+Y: 2001 - January 2001-01-01T01:01:01-0500
+
+Europe/Oslo
+Y: 0 - January 2000-01-01T01:01:01+0100
+Y: 69 - January 2069-01-01T01:01:01+0100
+Y: 70 - January 1970-01-01T01:01:01+0100
+Y: 71 - January 1971-01-01T01:01:01+0100
+Y: 99 - January 1999-01-01T01:01:01+0100
+Y: 100 - January 2000-01-01T01:01:01+0100
+Y: 105 - January 2005-01-01T01:01:01+0100
+Y: 1900 - January 1900-01-01T01:01:01+0100
+Y: 1901 - January 1901-01-01T01:01:01+0100
+Y: 1902 - January 1902-01-01T01:01:01+0100
+Y: 1999 - January 1999-01-01T01:01:01+0100
+Y: 2000 - January 2000-01-01T01:01:01+0100
+Y: 2001 - January 2001-01-01T01:01:01+0100
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
index 0d19074fc..3201def6c 100644
--- a/ext/date/tests/mktime-3.phpt
+++ b/ext/date/tests/mktime-3.phpt
@@ -1,5 +1,7 @@
--TEST--
-mktime() [3]
+mktime() [3] (32-bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK" ?>
--INI--
error_reporting=2047
--FILE--
diff --git a/ext/date/tests/oo_002.phpt b/ext/date/tests/oo_002.phpt
index e619d9dfe..0cd9187b1 100644
--- a/ext/date/tests/oo_002.phpt
+++ b/ext/date/tests/oo_002.phpt
@@ -6,7 +6,7 @@ date.timezone=Europe/Berlin
<?php
class _d extends DateTime {}
class _t extends DateTimeZone {}
-$d = new _d("1pm Aug 1 GMT");
+$d = new _d("1pm Aug 1 GMT 2007");
var_dump($d->format(DateTime::RFC822));
$c = clone $d;
var_dump($c->format(DateTime::RFC822));
diff --git a/ext/date/tests/strtotime-mysql-64bit.phpt b/ext/date/tests/strtotime-mysql-64bit.phpt
new file mode 100644
index 000000000..38e7f15df
--- /dev/null
+++ b/ext/date/tests/strtotime-mysql-64bit.phpt
@@ -0,0 +1,28 @@
+--TEST--
+strtotime() and mysql timestamps (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('UTC');
+
+/* Format: YYYYMMDDHHMMSS */
+$d[] = '19970523091528';
+$d[] = '20001231185859';
+$d[] = '20800410101010'; // overflow..
+
+foreach($d as $date) {
+ $time = strtotime($date);
+
+ if (is_integer($time)) {
+ var_dump(date('r', $time));
+ } else {
+ var_dump($time);
+ }
+}
+?>
+--EXPECT--
+string(31) "Fri, 23 May 1997 09:15:28 +0000"
+string(31) "Sun, 31 Dec 2000 18:58:59 +0000"
+string(31) "Wed, 10 Apr 2080 10:10:10 +0000"
+
diff --git a/ext/date/tests/strtotime-mysql.phpt b/ext/date/tests/strtotime-mysql.phpt
index 88a8f10fe..e5935bb16 100755
--- a/ext/date/tests/strtotime-mysql.phpt
+++ b/ext/date/tests/strtotime-mysql.phpt
@@ -1,5 +1,7 @@
--TEST--
-strtotime() and mysql timestamps
+strtotime() and mysql timestamps (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
--FILE--
<?php
date_default_timezone_set('UTC');
diff --git a/ext/date/tests/strtotime3-64bit.phpt b/ext/date/tests/strtotime3-64bit.phpt
new file mode 100644
index 000000000..7dc081635
--- /dev/null
+++ b/ext/date/tests/strtotime3-64bit.phpt
@@ -0,0 +1,71 @@
+--TEST--
+strtotime() function (64 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
+--FILE--
+<?php
+date_default_timezone_set('Europe/Lisbon');
+$time = 1150494719; // 16/June/2006
+
+$strs = array(
+ '',
+ " \t\r\n000",
+ 'yesterday',
+ '22:49:12',
+ '22:49:12 bogusTZ',
+ '22.49.12.42GMT',
+ '22.49.12.42bogusTZ',
+ 't0222',
+ 't0222 t0222',
+ '022233',
+ '022233 bogusTZ',
+ '2-3-2004',
+ '2.3.2004',
+ '20060212T23:12:23UTC',
+ '20060212T23:12:23 bogusTZ',
+ '2006167', //pgydotd
+ 'Jan-15-2006', //pgtextshort
+ '2006-Jan-15', //pgtextreverse
+ '10/Oct/2000:13:55:36 +0100', //clf
+ '10/Oct/2000:13:55:36 +00100', //clf
+ '2006',
+ '1986', // year
+ 'JAN',
+ 'January',
+);
+
+foreach ($strs as $str) {
+ $t = strtotime($str, $time);
+ if (is_integer($t)) {
+ var_dump(date(DATE_RFC2822, $t));
+ } else {
+ var_dump($t);
+ }
+}
+
+?>
+--EXPECT--
+bool(false)
+bool(false)
+string(31) "Thu, 15 Jun 2006 00:00:00 +0100"
+string(31) "Fri, 16 Jun 2006 22:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 23:49:12 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 02:22:00 +0100"
+string(31) "Mon, 16 Jun 0222 02:22:00 -0036"
+string(31) "Fri, 16 Jun 2006 02:22:33 +0100"
+bool(false)
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Tue, 02 Mar 2004 00:00:00 +0000"
+string(31) "Sun, 12 Feb 2006 23:12:23 +0000"
+bool(false)
+string(31) "Fri, 16 Jun 2006 00:00:00 +0100"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Sun, 15 Jan 2006 00:00:00 +0000"
+string(31) "Tue, 10 Oct 2000 13:55:36 +0100"
+bool(false)
+string(31) "Fri, 16 Jun 2006 20:06:00 +0100"
+string(31) "Mon, 16 Jun 1986 22:51:59 +0100"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
+string(31) "Mon, 16 Jan 2006 00:00:00 +0000"
diff --git a/ext/date/tests/strtotime3.phpt b/ext/date/tests/strtotime3.phpt
index c5d13d8a6..6aa5640f6 100644
--- a/ext/date/tests/strtotime3.phpt
+++ b/ext/date/tests/strtotime3.phpt
@@ -1,5 +1,7 @@
--TEST--
-strtotime() function
+strtotime() function (32 bit)
+--SKIPIF--
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?>
--FILE--
<?php
date_default_timezone_set('Europe/Lisbon');
diff --git a/ext/date/tests/timestamp-in-dst.phpt b/ext/date/tests/timestamp-in-dst.phpt
new file mode 100644
index 000000000..5b66351e1
--- /dev/null
+++ b/ext/date/tests/timestamp-in-dst.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Format timestamp in DST test
+--INI--
+date.timezone=CEST
+--FILE--
+<?php
+error_reporting(E_ALL); // hide e_strict warning about timezones
+var_dump( date_create( '@1202996091' )->format( 'c' ) );
+?>
+--EXPECT--
+string(25) "2008-02-14T13:34:51+00:00"
diff --git a/ext/dba/config.m4 b/ext/dba/config.m4
index 28295229b..60cb8116f 100644
--- a/ext/dba/config.m4
+++ b/ext/dba/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.70.2.2.2.8 2007/07/19 10:50:16 jani Exp $
+dnl $Id: config.m4,v 1.70.2.2.2.9 2007/12/06 14:17:43 helly Exp $
dnl
dnl Suppose we need FlatFile if no support or only CDB is used.
@@ -274,11 +274,16 @@ AC_DEFUN([PHP_DBA_DB_CHECK],[
# DB4
if test "$PHP_DB4" != "no"; then
PHP_DBA_STD_BEGIN
- for i in $PHP_DB4 /usr/local/BerkeleyDB.4.2 /usr/local/BerkeleyDB.4.1 /usr/local/BerkeleyDB.4.0 /usr/local /usr; do
+ dbdp="/usr/local/BerkeleyDB.4."
+ for i in $PHP_DB4 ${dbdp}6 ${dbdp}5 ${dbdp}4 ${dbdp}3 ${dbdp}2 ${dbdp}1 ${dbdp}0 /usr/local /usr; do
if test -f "$i/db4/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/db4/db.h
break
+ elif test -f "$i/include/db4.6/db.h"; then
+ THIS_PREFIX=$i
+ THIS_INCLUDE=$i/include/db4.6/db.h
+ break
elif test -f "$i/include/db4.5/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db4.5/db.h
@@ -301,7 +306,7 @@ if test "$PHP_DB4" != "no"; then
break
fi
done
- PHP_DBA_DB_CHECK(4, db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
+ PHP_DBA_DB_CHECK(4, db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
fi
PHP_DBA_STD_RESULT(db4,Berkeley DB4)
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index b31ae29ee..ec3bf5e71 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba.c,v 1.111.2.4.2.5 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba.c,v 1.111.2.4.2.6 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c
index 7f1fb275d..c8d2eaa3d 100644
--- a/ext/dba/dba_cdb.c
+++ b/ext/dba/dba_cdb.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_cdb.c,v 1.32.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_cdb.c,v 1.32.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c
index 32171a111..91d408da0 100755
--- a/ext/dba/dba_db1.c
+++ b/ext/dba/dba_db1.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_db1.c,v 1.3.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_db1.c,v 1.3.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c
index 52b72212f..79d835d01 100644
--- a/ext/dba/dba_db2.c
+++ b/ext/dba/dba_db2.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_db2.c,v 1.39.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_db2.c,v 1.39.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
index c74bbf2f4..5fbcdf851 100644
--- a/ext/dba/dba_db3.c
+++ b/ext/dba/dba_db3.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_db3.c,v 1.33.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_db3.c,v 1.33.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
index 44fa4e7b1..b2bdec8e8 100644
--- a/ext/dba/dba_db4.c
+++ b/ext/dba/dba_db4.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_db4.c,v 1.15.2.3.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_db4.c,v 1.15.2.3.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c
index 12f020f7a..a7896be85 100644
--- a/ext/dba/dba_dbm.c
+++ b/ext/dba/dba_dbm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_dbm.c,v 1.29.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_dbm.c,v 1.29.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_flatfile.c b/ext/dba/dba_flatfile.c
index a86bcf6ad..30f8bf4ac 100644
--- a/ext/dba/dba_flatfile.c
+++ b/ext/dba/dba_flatfile.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_flatfile.c,v 1.19.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_flatfile.c,v 1.19.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
index 0792519f0..de915f950 100644
--- a/ext/dba/dba_gdbm.c
+++ b/ext/dba/dba_gdbm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_gdbm.c,v 1.23.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_gdbm.c,v 1.23.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_inifile.c b/ext/dba/dba_inifile.c
index 8263a0307..291258283 100644
--- a/ext/dba/dba_inifile.c
+++ b/ext/dba/dba_inifile.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_inifile.c,v 1.5.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_inifile.c,v 1.5.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c
index 7e1363a66..8414385f6 100644
--- a/ext/dba/dba_ndbm.c
+++ b/ext/dba/dba_ndbm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_ndbm.c,v 1.19.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_ndbm.c,v 1.19.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/dba_qdbm.c b/ext/dba/dba_qdbm.c
index f5b6348d4..da9a0bd4a 100755
--- a/ext/dba/dba_qdbm.c
+++ b/ext/dba/dba_qdbm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_qdbm.c,v 1.4.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: dba_qdbm.c,v 1.4.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c
index f80676ec6..d84214b1c 100644
--- a/ext/dba/libcdb/cdb.c
+++ b/ext/dba/libcdb/cdb.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdb.c,v 1.10.2.1.2.3 2007/04/14 11:15:13 helly Exp $ */
+/* $Id: cdb.c,v 1.10.2.1.2.4 2007/12/31 07:20:05 sebastian Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
@@ -189,6 +189,6 @@ int cdb_find(struct cdb *c, char *key, unsigned int len TSRMLS_DC)
/* {{{ cdb_version */
char *cdb_version()
{
- return "0.75, $Revision: 1.10.2.1.2.3 $";
+ return "0.75, $Revision: 1.10.2.1.2.4 $";
}
/* }}} */
diff --git a/ext/dba/libcdb/cdb.h b/ext/dba/libcdb/cdb.h
index 768335a9c..38af71e28 100644
--- a/ext/dba/libcdb/cdb.h
+++ b/ext/dba/libcdb/cdb.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdb.h,v 1.7.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: cdb.h,v 1.7.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
diff --git a/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c
index 3280fe49d..c68451367 100644
--- a/ext/dba/libcdb/cdb_make.c
+++ b/ext/dba/libcdb/cdb_make.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdb_make.c,v 1.9.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: cdb_make.c,v 1.9.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
@@ -240,5 +240,5 @@ int cdb_make_finish(struct cdb_make *c TSRMLS_DC)
/* {{{ cdb_make_version */
char *cdb_make_version()
{
- return "0.75, $Revision: 1.9.2.1.2.1 $";
+ return "0.75, $Revision: 1.9.2.1.2.2 $";
}
diff --git a/ext/dba/libcdb/cdb_make.h b/ext/dba/libcdb/cdb_make.h
index 2f2bf1105..b93028181 100644
--- a/ext/dba/libcdb/cdb_make.h
+++ b/ext/dba/libcdb/cdb_make.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdb_make.h,v 1.7.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: cdb_make.h,v 1.7.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
diff --git a/ext/dba/libcdb/uint32.c b/ext/dba/libcdb/uint32.c
index 900840fbd..955edbdd0 100644
--- a/ext/dba/libcdb/uint32.c
+++ b/ext/dba/libcdb/uint32.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: uint32.c,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: uint32.c,v 1.6.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
diff --git a/ext/dba/libcdb/uint32.h b/ext/dba/libcdb/uint32.h
index edf28130f..35591e49e 100644
--- a/ext/dba/libcdb/uint32.h
+++ b/ext/dba/libcdb/uint32.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: uint32.h,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: uint32.h,v 1.6.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
/* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c
index 2ee1dc126..7d8b3ff9f 100644
--- a/ext/dba/libflatfile/flatfile.c
+++ b/ext/dba/libflatfile/flatfile.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: flatfile.c,v 1.14.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: flatfile.c,v 1.14.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -307,7 +307,7 @@ datum flatfile_nextkey(flatfile *dba TSRMLS_DC) {
/* {{{ flatfile_version */
char *flatfile_version()
{
- return "1.0, $Revision: 1.14.2.1.2.1 $";
+ return "1.0, $Revision: 1.14.2.1.2.2 $";
}
/* }}} */
diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h
index 0b8660e77..3ec25a396 100644
--- a/ext/dba/libflatfile/flatfile.h
+++ b/ext/dba/libflatfile/flatfile.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: flatfile.h,v 1.11.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: flatfile.h,v 1.11.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef PHP_LIB_FLATFILE_H
#define PHP_LIB_FLATFILE_H
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index e7b9cc463..c87025314 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: inifile.c,v 1.14.2.1.2.3 2007/01/01 19:40:29 iliaa Exp $ */
+/* $Id: inifile.c,v 1.14.2.1.2.4 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -43,7 +43,7 @@
/* {{{ inifile_version */
char *inifile_version()
{
- return "1.0, $Revision: 1.14.2.1.2.3 $";
+ return "1.0, $Revision: 1.14.2.1.2.4 $";
}
/* }}} */
diff --git a/ext/dba/libinifile/inifile.h b/ext/dba/libinifile/inifile.h
index 8ebbc27e9..f50806acb 100644
--- a/ext/dba/libinifile/inifile.h
+++ b/ext/dba/libinifile/inifile.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: inifile.h,v 1.5.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: inifile.h,v 1.5.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef PHP_LIB_INIFILE_H
#define PHP_LIB_INIFILE_H
diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h
index 5e8d08b87..f7fd95d41 100644
--- a/ext/dba/php_dba.h
+++ b/ext/dba/php_dba.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dba.h,v 1.29.2.1.2.1 2007/01/01 09:35:59 sebastian Exp $ */
+/* $Id: php_dba.h,v 1.29.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef PHP_DBA_H
#define PHP_DBA_H
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
index 3a42c4526..aeb950fec 100644
--- a/ext/dbase/dbase.c
+++ b/ext/dbase/dbase.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dbase.c,v 1.74.2.2.2.9 2007/02/25 23:17:12 tony2001 Exp $ */
+/* $Id: dbase.c,v 1.74.2.2.2.10 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c
index 62296bd5e..010fccf87 100644
--- a/ext/dbase/dbf_head.c
+++ b/ext/dbase/dbf_head.c
@@ -160,6 +160,9 @@ int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
case 'D':
dbf->db_flen = 8;
break;
+ case 'L':
+ dbf->db_flen = 1;
+ break;
default:
dbf->db_flen = get_short(dbfield.dbf_flen);
break;
@@ -195,6 +198,12 @@ int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
dbfield.dbf_flen[0] = dbf->db_flen;
dbfield.dbf_flen[1] = dbf->db_fdc;
break;
+ case 'D':
+ dbf->db_flen = 8;
+ break;
+ case 'L':
+ dbf->db_flen = 1;
+ break;
default:
put_short(dbfield.dbf_flen, dbf->db_flen);
}
diff --git a/ext/dbase/php_dbase.h b/ext/dbase/php_dbase.h
index 0fd8ef707..e3e75d234 100644
--- a/ext/dbase/php_dbase.h
+++ b/ext/dbase/php_dbase.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dbase.h,v 1.15.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: php_dbase.h,v 1.15.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef PHP_DBASE_H
#define PHP_DBASE_H
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index 524045d74..a77c8e9ac 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: attr.c,v 1.18.2.2.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: attr.c,v 1.18.2.2.2.4 2008/02/04 15:23:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -30,6 +30,18 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_attr_is_id, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_attr_construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMAttr extends DOMNode
*
@@ -38,8 +50,8 @@
*/
zend_function_entry php_dom_attr_class_functions[] = {
- PHP_FALIAS(isId, dom_attr_is_id, NULL)
- PHP_ME(domattr, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_FALIAS(isId, dom_attr_is_id, arginfo_dom_attr_is_id)
+ PHP_ME(domattr, __construct, arginfo_dom_attr_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index 7c5684d72..d153026e3 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cdatasection.c,v 1.11.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: cdatasection.c,v 1.11.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,13 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_cdatasection_construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMCdataSection extends DOMText
*
@@ -36,7 +43,7 @@
*/
zend_function_entry php_dom_cdatasection_class_functions[] = {
- PHP_ME(domcdatasection, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(domcdatasection, __construct, arginfo_dom_cdatasection_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c
index 22f410c36..20b5a3980 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: characterdata.c,v 1.15.2.1.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: characterdata.c,v 1.15.2.1.2.4 2008/02/04 15:23:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,38 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_substring_data, 0, 0, 2)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, count)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_append_data, 0, 0, 1)
+ ZEND_ARG_INFO(0, arg)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_insert_data, 0, 0, 2)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, arg)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_delete_data, 0, 0, 2)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, count)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_replace_data, 0, 0, 3)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, count)
+ ZEND_ARG_INFO(0, arg)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMCharacterData extends DOMNode
*
@@ -36,11 +68,11 @@
*/
zend_function_entry php_dom_characterdata_class_functions[] = {
- PHP_FALIAS(substringData, dom_characterdata_substring_data, NULL)
- PHP_FALIAS(appendData, dom_characterdata_append_data, NULL)
- PHP_FALIAS(insertData, dom_characterdata_insert_data, NULL)
- PHP_FALIAS(deleteData, dom_characterdata_delete_data, NULL)
- PHP_FALIAS(replaceData, dom_characterdata_replace_data, NULL)
+ PHP_FALIAS(substringData, dom_characterdata_substring_data, arginfo_dom_characterdata_substring_data)
+ PHP_FALIAS(appendData, dom_characterdata_append_data, arginfo_dom_characterdata_append_data)
+ PHP_FALIAS(insertData, dom_characterdata_insert_data, arginfo_dom_characterdata_insert_data)
+ PHP_FALIAS(deleteData, dom_characterdata_delete_data, arginfo_dom_characterdata_delete_data)
+ PHP_FALIAS(replaceData, dom_characterdata_replace_data, arginfo_dom_characterdata_replace_data)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/comment.c b/ext/dom/comment.c
index a52fd094a..94d720352 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: comment.c,v 1.11.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: comment.c,v 1.11.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,13 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_comment_construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMComment extends DOMCharacterData
*
@@ -36,7 +43,7 @@
*/
zend_function_entry php_dom_comment_class_functions[] = {
- PHP_ME(domcomment, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(domcomment, __construct, arginfo_dom_comment_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 3c91c8885..c5d504d2f 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: document.c,v 1.68.2.3.2.5 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: document.c,v 1.68.2.3.2.8 2008/02/04 15:23:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -41,6 +41,182 @@ struct _idsIterator {
#define DOM_LOAD_STRING 0
#define DOM_LOAD_FILE 1
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_element, 0, 0, 1)
+ ZEND_ARG_INFO(0, tagName)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_document_fragment, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_text_node, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_comment, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_cdatasection, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_processing_instruction, 0, 0, 2)
+ ZEND_ARG_INFO(0, target)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_attribute, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_entity_reference, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_elements_by_tag_name, 0, 0, 1)
+ ZEND_ARG_INFO(0, tagName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_import_node, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, importedNode, DOMNode, 0)
+ ZEND_ARG_INFO(0, deep)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_element_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, qualifiedName)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_attribute_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, qualifiedName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_elements_by_tag_name_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_element_by_id, 0, 0, 1)
+ ZEND_ARG_INFO(0, elementId)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_adopt_node, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, source, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_normalize_document, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_rename_node, 0, 0, 3)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, qualifiedName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_load, 0, 0, 1)
+ ZEND_ARG_INFO(0, source)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_save, 0, 0, 1)
+ ZEND_ARG_INFO(0, file)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadxml, 0, 0, 1)
+ ZEND_ARG_INFO(0, source)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savexml, 0, 0, 0)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, version)
+ ZEND_ARG_INFO(0, encoding)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_validate, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_xinclude, 0, 0, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1)
+ ZEND_ARG_INFO(0, source)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1)
+ ZEND_ARG_INFO(0, source)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtmlfile, 0, 0, 1)
+ ZEND_ARG_INFO(0, file)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_schema_validate_file, 0, 0, 1)
+ ZEND_ARG_INFO(0, filename)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_schema_validate_xml, 0, 0, 1)
+ ZEND_ARG_INFO(0, source)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_relaxNG_validate_file, 0, 0, 1)
+ ZEND_ARG_INFO(0, filename)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_relaxNG_validate_xml, 0, 0, 1)
+ ZEND_ARG_INFO(0, source)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_registernodeclass, 0, 0, 2)
+ ZEND_ARG_INFO(0, baseClass)
+ ZEND_ARG_INFO(0, extendedClass)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMDocument extends DOMNode
*
@@ -49,43 +225,43 @@ struct _idsIterator {
*/
zend_function_entry php_dom_document_class_functions[] = {
- PHP_FALIAS(createElement, dom_document_create_element, NULL)
- PHP_FALIAS(createDocumentFragment, dom_document_create_document_fragment, NULL)
- PHP_FALIAS(createTextNode, dom_document_create_text_node, NULL)
- PHP_FALIAS(createComment, dom_document_create_comment, NULL)
- PHP_FALIAS(createCDATASection, dom_document_create_cdatasection, NULL)
- PHP_FALIAS(createProcessingInstruction, dom_document_create_processing_instruction, NULL)
- PHP_FALIAS(createAttribute, dom_document_create_attribute, NULL)
- PHP_FALIAS(createEntityReference, dom_document_create_entity_reference, NULL)
- PHP_FALIAS(getElementsByTagName, dom_document_get_elements_by_tag_name, NULL)
- PHP_FALIAS(importNode, dom_document_import_node, NULL)
- PHP_FALIAS(createElementNS, dom_document_create_element_ns, NULL)
- PHP_FALIAS(createAttributeNS, dom_document_create_attribute_ns, NULL)
- PHP_FALIAS(getElementsByTagNameNS, dom_document_get_elements_by_tag_name_ns, NULL)
- PHP_FALIAS(getElementById, dom_document_get_element_by_id, NULL)
- PHP_FALIAS(adoptNode, dom_document_adopt_node, NULL)
- PHP_FALIAS(normalizeDocument, dom_document_normalize_document, NULL)
- PHP_FALIAS(renameNode, dom_document_rename_node, NULL)
- PHP_ME(domdocument, load, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_FALIAS(save, dom_document_save, NULL)
- PHP_ME(domdocument, loadXML, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_FALIAS(saveXML, dom_document_savexml, NULL)
- PHP_ME(domdocument, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_FALIAS(validate, dom_document_validate, NULL)
- PHP_FALIAS(xinclude, dom_document_xinclude, NULL)
+ PHP_FALIAS(createElement, dom_document_create_element, arginfo_dom_document_create_element)
+ PHP_FALIAS(createDocumentFragment, dom_document_create_document_fragment, arginfo_dom_document_create_document_fragment)
+ PHP_FALIAS(createTextNode, dom_document_create_text_node, arginfo_dom_document_create_text_node)
+ PHP_FALIAS(createComment, dom_document_create_comment, arginfo_dom_document_create_comment)
+ PHP_FALIAS(createCDATASection, dom_document_create_cdatasection, arginfo_dom_document_create_cdatasection)
+ PHP_FALIAS(createProcessingInstruction, dom_document_create_processing_instruction, arginfo_dom_document_create_processing_instruction)
+ PHP_FALIAS(createAttribute, dom_document_create_attribute, arginfo_dom_document_create_attribute)
+ PHP_FALIAS(createEntityReference, dom_document_create_entity_reference, arginfo_dom_document_create_entity_reference)
+ PHP_FALIAS(getElementsByTagName, dom_document_get_elements_by_tag_name, arginfo_dom_document_get_elements_by_tag_name)
+ PHP_FALIAS(importNode, dom_document_import_node, arginfo_dom_document_import_node)
+ PHP_FALIAS(createElementNS, dom_document_create_element_ns, arginfo_dom_document_create_element_ns)
+ PHP_FALIAS(createAttributeNS, dom_document_create_attribute_ns, arginfo_dom_document_create_attribute_ns)
+ PHP_FALIAS(getElementsByTagNameNS, dom_document_get_elements_by_tag_name_ns, arginfo_dom_document_get_elements_by_tag_name_ns)
+ PHP_FALIAS(getElementById, dom_document_get_element_by_id, arginfo_dom_document_get_element_by_id)
+ PHP_FALIAS(adoptNode, dom_document_adopt_node, arginfo_dom_document_adopt_node)
+ PHP_FALIAS(normalizeDocument, dom_document_normalize_document, arginfo_dom_document_normalize_document)
+ PHP_FALIAS(renameNode, dom_document_rename_node, arginfo_dom_document_rename_node)
+ PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_FALIAS(save, dom_document_save, arginfo_dom_document_save)
+ PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_FALIAS(saveXML, dom_document_savexml, arginfo_dom_document_savexml)
+ PHP_ME(domdocument, __construct, arginfo_dom_document_construct, ZEND_ACC_PUBLIC)
+ PHP_FALIAS(validate, dom_document_validate, arginfo_dom_document_validate)
+ PHP_FALIAS(xinclude, dom_document_xinclude, arginfo_dom_document_xinclude)
#if defined(LIBXML_HTML_ENABLED)
- PHP_ME(domdocument, loadHTML, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domdocument, loadHTMLFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_FALIAS(saveHTML, dom_document_save_html, NULL)
- PHP_FALIAS(saveHTMLFile, dom_document_save_html_file, NULL)
+ PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_FALIAS(saveHTML, dom_document_save_html, arginfo_dom_document_savehtml)
+ PHP_FALIAS(saveHTMLFile, dom_document_save_html_file, arginfo_dom_document_savehtmlfile)
#endif /* defined(LIBXML_HTML_ENABLED) */
#if defined(LIBXML_SCHEMAS_ENABLED)
- PHP_FALIAS(schemaValidate, dom_document_schema_validate_file, NULL)
- PHP_FALIAS(schemaValidateSource, dom_document_schema_validate_xml, NULL)
- PHP_FALIAS(relaxNGValidate, dom_document_relaxNG_validate_file, NULL)
- PHP_FALIAS(relaxNGValidateSource, dom_document_relaxNG_validate_xml, NULL)
+ PHP_FALIAS(schemaValidate, dom_document_schema_validate_file, arginfo_dom_document_schema_validate_file)
+ PHP_FALIAS(schemaValidateSource, dom_document_schema_validate_xml, arginfo_dom_document_schema_validate_xml)
+ PHP_FALIAS(relaxNGValidate, dom_document_relaxNG_validate_file, arginfo_dom_document_relaxNG_validate_file)
+ PHP_FALIAS(relaxNGValidateSource, dom_document_relaxNG_validate_xml, arginfo_dom_document_relaxNG_validate_xml)
#endif
- PHP_ME(domdocument, registerNodeClass, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, registerNodeClass, arginfo_dom_document_registernodeclass, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -1737,6 +1913,10 @@ static void php_dom_remove_xinclude_nodes(xmlNodePtr cur TSRMLS_DC) {
/* XML_XINCLUDE_END node will be a sibling of XML_XINCLUDE_START */
while(cur && cur->type != XML_XINCLUDE_END) {
+ /* remove xinclude processing nodes from recursive xincludes */
+ if (cur->type == XML_ELEMENT_NODE) {
+ php_dom_remove_xinclude_nodes(cur->children TSRMLS_CC);
+ }
cur = cur->next;
}
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index 3f5c3cabb..feaa8b52a 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documentfragment.c,v 1.15.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: documentfragment.c,v 1.15.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,17 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_documentfragement_construct, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_documentfragement_appendXML, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMDocumentFragment extends DOMNode
*
@@ -36,8 +47,8 @@
*/
zend_function_entry php_dom_documentfragment_class_functions[] = {
- PHP_ME(domdocumentfragment, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(domdocumentfragment, appendXML, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocumentfragment, __construct, arginfo_dom_documentfragement_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocumentfragment, appendXML, arginfo_dom_documentfragement_appendXML, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index 68b5f69f0..db4fa4833 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: documenttype.c,v 1.15.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: documenttype.c,v 1.15.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/dom_ce.h b/ext/dom/dom_ce.h
index a05dc777c..14c832863 100644
--- a/ext/dom/dom_ce.h
+++ b/ext/dom/dom_ce.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_ce.h,v 1.8.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: dom_ce.h,v 1.8.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef DOM_CE_H
#define DOM_CE_H
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index 9a8a930c7..df791c8a5 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_fe.h,v 1.14.2.1.2.4 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: dom_fe.h,v 1.14.2.1.2.5 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef DOM_FE_H
#define DOM_FE_H
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index 1bd90a4f5..ef660cf4f 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_iterators.c,v 1.9.2.3.2.5 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: dom_iterators.c,v 1.9.2.3.2.6 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/dom_properties.h b/ext/dom/dom_properties.h
index 3eed63a17..27ad5c1bd 100644
--- a/ext/dom/dom_properties.h
+++ b/ext/dom/dom_properties.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dom_properties.h,v 1.7.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: dom_properties.h,v 1.7.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifndef DOM_PROPERTIES_H
#define DOM_PROPERTIES_H
diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c
index 27e1dfb3f..21e14dd4b 100644
--- a/ext/dom/domconfiguration.c
+++ b/ext/dom/domconfiguration.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domconfiguration.c,v 1.5.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domconfiguration.c,v 1.5.2.1.2.3 2008/02/04 15:23:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,25 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_set_parameter, 0, 0, 2)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_OBJ_INFO(0, value, DOMUserData, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_get_parameter, 0, 0, 0)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_can_set_parameter, 0, 0, 0)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_OBJ_INFO(0, value, DOMUserData, 0)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class domdomconfiguration
*
@@ -36,9 +55,9 @@
*/
zend_function_entry php_dom_domconfiguration_class_functions[] = {
- PHP_FALIAS(setParameter, dom_domconfiguration_set_parameter, NULL)
- PHP_FALIAS(getParameter, dom_domconfiguration_get_parameter, NULL)
- PHP_FALIAS(canSetParameter, dom_domconfiguration_can_set_parameter, NULL)
+ PHP_FALIAS(setParameter, dom_domconfiguration_set_parameter, arginfo_dom_configuration_set_parameter)
+ PHP_FALIAS(getParameter, dom_domconfiguration_get_parameter, arginfo_dom_configuration_get_parameter)
+ PHP_FALIAS(canSetParameter, dom_domconfiguration_can_set_parameter, arginfo_dom_configuration_can_set_parameter)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c
index 3e5d8af34..4fae3eeb7 100644
--- a/ext/dom/domerror.c
+++ b/ext/dom/domerror.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerror.c,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domerror.c,v 1.6.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c
index 9a353cebd..493aa38f9 100644
--- a/ext/dom/domerrorhandler.c
+++ b/ext/dom/domerrorhandler.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domerrorhandler.c,v 1.5.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domerrorhandler.c,v 1.5.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,13 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_domerrorhandler_handle_error, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, error, DOMError, 0)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class domerrorhandler
*
@@ -36,7 +43,7 @@
*/
zend_function_entry php_dom_domerrorhandler_class_functions[] = {
- PHP_FALIAS(handleError, dom_domerrorhandler_handle_error, NULL)
+ PHP_FALIAS(handleError, dom_domerrorhandler_handle_error, arginfo_dom_domerrorhandler_handle_error)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index b55bd67c9..0bd87ece2 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domexception.c,v 1.11.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domexception.c,v 1.11.2.1.2.2 2007/12/31 07:20:05 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index 76d7f00b3..890a5abab 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementation.c,v 1.15.2.2.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domimplementation.c,v 1.15.2.2.2.4 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,6 +27,32 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_get_feature, 0, 0, 2)
+ ZEND_ARG_INFO(0, feature)
+ ZEND_ARG_INFO(0, version)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_has_feature, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_create_documenttype, 0, 0, 3)
+ ZEND_ARG_INFO(0, qualifiedName)
+ ZEND_ARG_INFO(0, publicId)
+ ZEND_ARG_INFO(0, systemId)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_create_document, 0, 0, 3)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, qualifiedName)
+ ZEND_ARG_OBJ_INFO(0, docType, DOMDocumentType, 0)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMImplementation
*
@@ -35,10 +61,10 @@
*/
zend_function_entry php_dom_domimplementation_class_functions[] = {
- PHP_ME(domimplementation, getFeature, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, hasFeature, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, createDocumentType, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, createDocument, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/domimplementationlist.c b/ext/dom/domimplementationlist.c
index 3b0966dae..d65e2beb6 100644
--- a/ext/dom/domimplementationlist.c
+++ b/ext/dom/domimplementationlist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementationlist.c,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domimplementationlist.c,v 1.6.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,13 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationlist_item, 0, 0, 1)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class domimplementationlist
*
@@ -36,7 +43,7 @@
*/
zend_function_entry php_dom_domimplementationlist_class_functions[] = {
- PHP_FALIAS(item, dom_domimplementationlist_item, NULL)
+ PHP_FALIAS(item, dom_domimplementationlist_item, arginfo_dom_implementationlist_item)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c
index 6553bdeef..3bc4d2b9c 100644
--- a/ext/dom/domimplementationsource.c
+++ b/ext/dom/domimplementationsource.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domimplementationsource.c,v 1.5.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domimplementationsource.c,v 1.5.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,18 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementation, 0, 0, 1)
+ ZEND_ARG_INFO(0, features)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementations, 0, 0, 1)
+ ZEND_ARG_INFO(0, features)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class domimplementationsource
*
@@ -36,8 +48,8 @@
*/
zend_function_entry php_dom_domimplementationsource_class_functions[] = {
- PHP_FALIAS(getDomimplementation, dom_domimplementationsource_get_domimplementation, NULL)
- PHP_FALIAS(getDomimplementations, dom_domimplementationsource_get_domimplementations, NULL)
+ PHP_FALIAS(getDomimplementation, dom_domimplementationsource_get_domimplementation, arginfo_dom_implementationsource_getdomimplementation)
+ PHP_FALIAS(getDomimplementations, dom_domimplementationsource_get_domimplementations, arginfo_dom_implementationsource_getdomimplementations)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c
index 52627a1e3..fd915a9d1 100644
--- a/ext/dom/domlocator.c
+++ b/ext/dom/domlocator.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domlocator.c,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domlocator.c,v 1.6.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c
index 4a720e8cd..c902bbaf9 100644
--- a/ext/dom/domstringlist.c
+++ b/ext/dom/domstringlist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: domstringlist.c,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: domstringlist.c,v 1.6.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,13 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_stringlist_item, 0, 0, 1)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class domstringlist
*
@@ -36,7 +43,7 @@
*/
zend_function_entry php_dom_domstringlist_class_functions[] = {
- PHP_FALIAS(item, dom_domstringlist_item, NULL)
+ PHP_FALIAS(item, dom_domstringlist_item, arginfo_dom_stringlist_item)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 4d9303f50..5f6614de7 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: element.c,v 1.36.2.4.2.8 2007/05/04 19:30:59 rrichards Exp $ */
+/* $Id: element.c,v 1.36.2.4.2.10 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,117 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute, 0, 0, 2)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_node, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_node, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, newAttr, DOMAttr, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute_node, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, oldAttr, DOMAttr, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_elements_by_tag_name, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_ns, 0, 0, 3)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, qualifiedName)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_node_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_node_ns, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, newAttr, DOMAttr, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_elements_by_tag_name_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_has_attribute, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_has_attribute_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute, 0, 0, 2)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, isId)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute_ns, 0, 0, 3)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ ZEND_ARG_INFO(0, isId)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute_node, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, attr, DOMAttr, 0)
+ ZEND_ARG_INFO(0, isId)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_INFO(0, uri)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMElement extends DOMNode
*
@@ -36,25 +147,25 @@
*/
zend_function_entry php_dom_element_class_functions[] = {
- PHP_FALIAS(getAttribute, dom_element_get_attribute, NULL)
- PHP_FALIAS(setAttribute, dom_element_set_attribute, NULL)
- PHP_FALIAS(removeAttribute, dom_element_remove_attribute, NULL)
- PHP_FALIAS(getAttributeNode, dom_element_get_attribute_node, NULL)
- PHP_FALIAS(setAttributeNode, dom_element_set_attribute_node, NULL)
- PHP_FALIAS(removeAttributeNode, dom_element_remove_attribute_node, NULL)
- PHP_FALIAS(getElementsByTagName, dom_element_get_elements_by_tag_name, NULL)
- PHP_FALIAS(getAttributeNS, dom_element_get_attribute_ns, NULL)
- PHP_FALIAS(setAttributeNS, dom_element_set_attribute_ns, NULL)
- PHP_FALIAS(removeAttributeNS, dom_element_remove_attribute_ns, NULL)
- PHP_FALIAS(getAttributeNodeNS, dom_element_get_attribute_node_ns, NULL)
- PHP_FALIAS(setAttributeNodeNS, dom_element_set_attribute_node_ns, NULL)
- PHP_FALIAS(getElementsByTagNameNS, dom_element_get_elements_by_tag_name_ns, NULL)
- PHP_FALIAS(hasAttribute, dom_element_has_attribute, NULL)
- PHP_FALIAS(hasAttributeNS, dom_element_has_attribute_ns, NULL)
- PHP_FALIAS(setIdAttribute, dom_element_set_id_attribute, NULL)
- PHP_FALIAS(setIdAttributeNS, dom_element_set_id_attribute_ns, NULL)
- PHP_FALIAS(setIdAttributeNode, dom_element_set_id_attribute_node, NULL)
- PHP_ME(domelement, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_FALIAS(getAttribute, dom_element_get_attribute, arginfo_dom_element_get_attribute)
+ PHP_FALIAS(setAttribute, dom_element_set_attribute, arginfo_dom_element_set_attribute)
+ PHP_FALIAS(removeAttribute, dom_element_remove_attribute, arginfo_dom_element_remove_attribute)
+ PHP_FALIAS(getAttributeNode, dom_element_get_attribute_node, arginfo_dom_element_get_attribute_node)
+ PHP_FALIAS(setAttributeNode, dom_element_set_attribute_node, arginfo_dom_element_set_attribute_node)
+ PHP_FALIAS(removeAttributeNode, dom_element_remove_attribute_node, arginfo_dom_element_remove_attribute_node)
+ PHP_FALIAS(getElementsByTagName, dom_element_get_elements_by_tag_name, arginfo_dom_element_get_elements_by_tag_name)
+ PHP_FALIAS(getAttributeNS, dom_element_get_attribute_ns, arginfo_dom_element_get_attribute_ns)
+ PHP_FALIAS(setAttributeNS, dom_element_set_attribute_ns, arginfo_dom_element_set_attribute_ns)
+ PHP_FALIAS(removeAttributeNS, dom_element_remove_attribute_ns, arginfo_dom_element_remove_attribute_ns)
+ PHP_FALIAS(getAttributeNodeNS, dom_element_get_attribute_node_ns, arginfo_dom_element_get_attribute_node_ns)
+ PHP_FALIAS(setAttributeNodeNS, dom_element_set_attribute_node_ns, arginfo_dom_element_set_attribute_node_ns)
+ PHP_FALIAS(getElementsByTagNameNS, dom_element_get_elements_by_tag_name_ns, arginfo_dom_element_get_elements_by_tag_name_ns)
+ PHP_FALIAS(hasAttribute, dom_element_has_attribute, arginfo_dom_element_has_attribute)
+ PHP_FALIAS(hasAttributeNS, dom_element_has_attribute_ns, arginfo_dom_element_has_attribute_ns)
+ PHP_FALIAS(setIdAttribute, dom_element_set_id_attribute, arginfo_dom_element_set_id_attribute)
+ PHP_FALIAS(setIdAttributeNS, dom_element_set_id_attribute_ns, arginfo_dom_element_set_id_attribute_ns)
+ PHP_FALIAS(setIdAttributeNode, dom_element_set_id_attribute_node, arginfo_dom_element_set_id_attribute_node)
+ PHP_ME(domelement, __construct, arginfo_dom_element_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/entity.c b/ext/dom/entity.c
index b89a2286d..8781367ca 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entity.c,v 1.9.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: entity.c,v 1.9.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c
index d15540627..740a29ebd 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: entityreference.c,v 1.12.2.1.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: entityreference.c,v 1.12.2.1.2.4 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,13 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_entityreference_construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMEntityReference extends DOMNode
*
@@ -36,7 +43,7 @@
*/
zend_function_entry php_dom_entityreference_class_functions[] = {
- PHP_ME(domentityreference, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(domentityreference, __construct, arginfo_dom_entityreference_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index 1e4212106..75885e101 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namednodemap.c,v 1.15.2.2.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: namednodemap.c,v 1.15.2.2.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,45 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item, 0, 0, 0)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_item, 0, 0, 0)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item_ns, 0, 0, 0)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item_ns, 0, 0, 0)
+ ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item_ns, 0, 0, 0)
+ ZEND_ARG_INFO(0, namespaceURI)
+ ZEND_ARG_INFO(0, localName)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMNamedNodeMap
*
@@ -36,13 +75,13 @@
*/
zend_function_entry php_dom_namednodemap_class_functions[] = {
- PHP_FALIAS(getNamedItem, dom_namednodemap_get_named_item, NULL)
- PHP_FALIAS(setNamedItem, dom_namednodemap_set_named_item, NULL)
- PHP_FALIAS(removeNamedItem, dom_namednodemap_remove_named_item, NULL)
- PHP_FALIAS(item, dom_namednodemap_item, NULL)
- PHP_FALIAS(getNamedItemNS, dom_namednodemap_get_named_item_ns, NULL)
- PHP_FALIAS(setNamedItemNS, dom_namednodemap_set_named_item_ns, NULL)
- PHP_FALIAS(removeNamedItemNS, dom_namednodemap_remove_named_item_ns, NULL)
+ PHP_FALIAS(getNamedItem, dom_namednodemap_get_named_item, arginfo_dom_namednodemap_get_named_item)
+ PHP_FALIAS(setNamedItem, dom_namednodemap_set_named_item, arginfo_dom_namednodemap_set_named_item)
+ PHP_FALIAS(removeNamedItem, dom_namednodemap_remove_named_item, arginfo_dom_namednodemap_remove_named_item)
+ PHP_FALIAS(item, dom_namednodemap_item, arginfo_dom_namednodemap_item)
+ PHP_FALIAS(getNamedItemNS, dom_namednodemap_get_named_item_ns, arginfo_dom_namednodemap_get_named_item_ns)
+ PHP_FALIAS(setNamedItemNS, dom_namednodemap_set_named_item_ns, arginfo_dom_namednodemap_set_named_item_ns)
+ PHP_FALIAS(removeNamedItemNS, dom_namednodemap_remove_named_item_ns, arginfo_dom_namednodemap_remove_named_item_ns)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c
index 43edb9b8c..93b4778ec 100644
--- a/ext/dom/namelist.c
+++ b/ext/dom/namelist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: namelist.c,v 1.7.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: namelist.c,v 1.7.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,18 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_name, 0, 0, 1)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_namespace_uri, 0, 0, 1)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMNameList
*
@@ -36,8 +48,8 @@
*/
zend_function_entry php_dom_namelist_class_functions[] = {
- PHP_FALIAS(getName, dom_namelist_get_name, NULL)
- PHP_FALIAS(getNamespaceURI, dom_namelist_get_namespace_uri, NULL)
+ PHP_FALIAS(getName, dom_namelist_get_name, arginfo_dom_namelist_get_name)
+ PHP_FALIAS(getNamespaceURI, dom_namelist_get_namespace_uri, arginfo_dom_namelist_get_namespace_uri)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/node.c b/ext/dom/node.c
index ce04c182f..d02f20a14 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: node.c,v 1.37.2.3.2.8 2007/05/04 19:30:59 rrichards Exp $ */
+/* $Id: node.c,v 1.37.2.3.2.11 2008/01/30 06:48:20 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,6 +27,122 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_insert_before, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
+ ZEND_ARG_OBJ_INFO(0, refChild, DOMNode, 1)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_replace_child, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
+ ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_remove_child, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_append_child, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_has_child_nodes, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_clone_node, 0, 0, 1)
+ ZEND_ARG_INFO(0, deep)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_normalize, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_supported, 0, 0, 2)
+ ZEND_ARG_INFO(0, feature)
+ ZEND_ARG_INFO(0, version)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_has_attributes, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_compare_document_position, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, other, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_same_node, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, other, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_lookup_prefix, 0, 0, 1)
+ ZEND_ARG_INFO(0, namespaceURI)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_default_namespace, 0, 0, 1)
+ ZEND_ARG_INFO(0, namespaceURI)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_lookup_namespace_uri, 0, 0, 1)
+ ZEND_ARG_INFO(0, prefix)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_equal_node, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_feature, 0, 0, 2)
+ ZEND_ARG_INFO(0, feature)
+ ZEND_ARG_INFO(0, version)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_set_user_data, 0, 0, 3)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_OBJ_INFO(0, data, DOMUserData, 0)
+ ZEND_ARG_INFO(0, handler)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_user_data, 0, 0, 1)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getNodePath, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14N, 0, 0, 0)
+ ZEND_ARG_INFO(0, exclusive)
+ ZEND_ARG_INFO(0, with_comments)
+ ZEND_ARG_ARRAY_INFO(0, xpath, 1)
+ ZEND_ARG_ARRAY_INFO(0, ns_prefixes, 1)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14NFile, 0, 0, 1)
+ ZEND_ARG_INFO(0, uri)
+ ZEND_ARG_INFO(0, exclusive)
+ ZEND_ARG_INFO(0, with_comments)
+ ZEND_ARG_ARRAY_INFO(0, xpath, 1)
+ ZEND_ARG_ARRAY_INFO(0, ns_prefixes, 1)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMNode
*
@@ -35,27 +151,27 @@
*/
zend_function_entry php_dom_node_class_functions[] = {
- PHP_FALIAS(insertBefore, dom_node_insert_before, NULL)
- PHP_FALIAS(replaceChild, dom_node_replace_child, NULL)
- PHP_FALIAS(removeChild, dom_node_remove_child, NULL)
- PHP_FALIAS(appendChild, dom_node_append_child, NULL)
- PHP_FALIAS(hasChildNodes, dom_node_has_child_nodes, NULL)
- PHP_FALIAS(cloneNode, dom_node_clone_node, NULL)
- PHP_FALIAS(normalize, dom_node_normalize, NULL)
- PHP_FALIAS(isSupported, dom_node_is_supported, NULL)
- PHP_FALIAS(hasAttributes, dom_node_has_attributes, NULL)
- PHP_FALIAS(compareDocumentPosition, dom_node_compare_document_position, NULL)
- PHP_FALIAS(isSameNode, dom_node_is_same_node, NULL)
- PHP_FALIAS(lookupPrefix, dom_node_lookup_prefix, NULL)
- PHP_FALIAS(isDefaultNamespace, dom_node_is_default_namespace, NULL)
- PHP_FALIAS(lookupNamespaceUri, dom_node_lookup_namespace_uri, NULL)
- PHP_FALIAS(isEqualNode, dom_node_is_equal_node, NULL)
- PHP_FALIAS(getFeature, dom_node_get_feature, NULL)
- PHP_FALIAS(setUserData, dom_node_set_user_data, NULL)
- PHP_FALIAS(getUserData, dom_node_get_user_data, NULL)
- PHP_ME(domnode, getNodePath, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(domnode, C14N, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(domnode, C14NFile, NULL, ZEND_ACC_PUBLIC)
+ PHP_FALIAS(insertBefore, dom_node_insert_before, arginfo_dom_node_insert_before)
+ PHP_FALIAS(replaceChild, dom_node_replace_child, arginfo_dom_node_replace_child)
+ PHP_FALIAS(removeChild, dom_node_remove_child, arginfo_dom_node_remove_child)
+ PHP_FALIAS(appendChild, dom_node_append_child, arginfo_dom_node_append_child)
+ PHP_FALIAS(hasChildNodes, dom_node_has_child_nodes, arginfo_dom_node_has_child_nodes)
+ PHP_FALIAS(cloneNode, dom_node_clone_node, arginfo_dom_node_clone_node)
+ PHP_FALIAS(normalize, dom_node_normalize, arginfo_dom_node_normalize)
+ PHP_FALIAS(isSupported, dom_node_is_supported, arginfo_dom_node_is_supported)
+ PHP_FALIAS(hasAttributes, dom_node_has_attributes, arginfo_dom_node_has_attributes)
+ PHP_FALIAS(compareDocumentPosition, dom_node_compare_document_position, arginfo_dom_node_compare_document_position)
+ PHP_FALIAS(isSameNode, dom_node_is_same_node, arginfo_dom_node_is_same_node)
+ PHP_FALIAS(lookupPrefix, dom_node_lookup_prefix, arginfo_dom_node_lookup_prefix)
+ PHP_FALIAS(isDefaultNamespace, dom_node_is_default_namespace, arginfo_dom_node_is_default_namespace)
+ PHP_FALIAS(lookupNamespaceUri, dom_node_lookup_namespace_uri, arginfo_dom_node_lookup_namespace_uri)
+ PHP_FALIAS(isEqualNode, dom_node_is_equal_node, arginfo_dom_node_is_equal_node)
+ PHP_FALIAS(getFeature, dom_node_get_feature, arginfo_dom_node_get_feature)
+ PHP_FALIAS(setUserData, dom_node_set_user_data, arginfo_dom_node_set_user_data)
+ PHP_FALIAS(getUserData, dom_node_get_user_data, arginfo_dom_node_get_user_data)
+ PHP_ME(domnode, getNodePath, arginfo_dom_node_getNodePath, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, C14N, arginfo_dom_node_C14N, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, C14NFile, arginfo_dom_node_C14NFile, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index c496a7865..fbd6bfd1c 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: nodelist.c,v 1.17.2.2.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: nodelist.c,v 1.17.2.2.2.4 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,13 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_nodelist_item, 0, 0, 1)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMNodeList
*
@@ -36,7 +43,7 @@
*/
zend_function_entry php_dom_nodelist_class_functions[] = {
- PHP_FALIAS(item, dom_nodelist_item, NULL)
+ PHP_FALIAS(item, dom_nodelist_item, arginfo_dom_nodelist_item)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/notation.c b/ext/dom/notation.c
index baf7cccb6..5009bfbe4 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: notation.c,v 1.9.2.2.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: notation.c,v 1.9.2.2.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index e84185e8e..f994fc08f 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c,v 1.73.2.12.2.12 2007/08/30 16:32:34 rrichards Exp $ */
+/* $Id: php_dom.c,v 1.73.2.12.2.13 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index d801f4877..6f82067ad 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.h,v 1.28.2.1.2.4 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: php_dom.h,v 1.28.2.1.2.5 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef PHP_DOM_H
#define PHP_DOM_H
diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c
index 291a7e280..cbfb29861 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: processinginstruction.c,v 1.17.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: processinginstruction.c,v 1.17.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,14 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_processinginstruction_construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMProcessingInstruction extends DOMNode
*
@@ -36,7 +44,7 @@
*/
zend_function_entry php_dom_processinginstruction_class_functions[] = {
- PHP_ME(domprocessinginstruction, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(domprocessinginstruction, __construct, arginfo_dom_processinginstruction_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/string_extend.c b/ext/dom/string_extend.c
index 0a3db5367..60a522f1b 100644
--- a/ext/dom/string_extend.c
+++ b/ext/dom/string_extend.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string_extend.c,v 1.5.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: string_extend.c,v 1.5.2.1.2.3 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,18 @@
#include "php_dom.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset16, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset32)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset32, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset16)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class domstringextend
*
@@ -36,8 +48,8 @@
*/
zend_function_entry php_dom_string_extend_class_functions[] = {
- PHP_FALIAS(findOffset16, dom_string_extend_find_offset16, NULL)
- PHP_FALIAS(findOffset32, dom_string_extend_find_offset32, NULL)
+ PHP_FALIAS(findOffset16, dom_string_extend_find_offset16, arginfo_dom_string_extend_find_offset16)
+ PHP_FALIAS(findOffset32, dom_string_extend_find_offset32, arginfo_dom_string_extend_find_offset32)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/tests/bug36756.phpt b/ext/dom/tests/bug36756.phpt
index af7488d3f..4e47b86e4 100644
--- a/ext/dom/tests/bug36756.phpt
+++ b/ext/dom/tests/bug36756.phpt
@@ -31,5 +31,5 @@ child
Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d
-Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d
+Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d
nodeType:
diff --git a/ext/dom/tests/bug38474.phpt b/ext/dom/tests/bug38474.phpt
index 7febd22d3..5c1c1abd1 100644
--- a/ext/dom/tests/bug38474.phpt
+++ b/ext/dom/tests/bug38474.phpt
@@ -1,7 +1,12 @@
--TEST--
Bug #38474 (getAttribute select attribute by order, even when prefixed) (OK to fail with libxml2 < 2.6.2x)
--SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (version_compare(LIBXML_DOTTED_VERSION, "2.6.20", "<")) {
+ print "skip libxml version " . LIBXML_DOTTED_VERSION;
+}
+?>
--FILE--
<?php
$xml = '<node xmlns:pre="http://foo.com/tr/pre"
diff --git a/ext/dom/tests/bug43364.phpt b/ext/dom/tests/bug43364.phpt
new file mode 100644
index 000000000..0df581b7a
--- /dev/null
+++ b/ext/dom/tests/bug43364.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #43364 (recursive xincludes don't remove internal xml nodes properly)
+--FILE--
+<?php
+function loopElements($nodes)
+{
+ $count = 0;
+ foreach($nodes as $node) {
+ if($node instanceof DOMElement) {
+ $count++;
+ if($node->childNodes->length > 0) {
+ $count += loopElements($node->childNodes);
+ }
+ }
+ }
+ return $count;
+}
+
+$xml = <<<DOC
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xi="http://www.w3.org/2001/XInclude">
+ <a>
+ <a_child1>ac1</a_child1>
+ <a_child2>ac2</a_child2>
+ </a>
+ <b><xi:include xpointer="xpointer(/root/a)" /></b>
+ <c><xi:include xpointer="xpointer(/root/b)" /></c>
+</root>
+DOC;
+
+$doc = new DomDocument();
+$doc->loadXml($xml);
+$doc->xinclude();
+
+$count = loopElements(array($doc->documentElement));
+
+var_dump($count);
+?>
+--EXPECT--
+int(13)
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 6cc47bdda..82f871d4e 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: text.c,v 1.23.2.1.2.4 2007/05/14 11:52:35 rrichards Exp $ */
+/* $Id: text.c,v 1.23.2.1.2.6 2008/02/04 15:23:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,6 +28,27 @@
#include "php_dom.h"
#include "dom_ce.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_split_text, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_is_whitespace_in_element_content, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_replace_whole_text, 0, 0, 1)
+ ZEND_ARG_INFO(0, content)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class DOMText extends DOMCharacterData
*
@@ -36,11 +57,11 @@
*/
zend_function_entry php_dom_text_class_functions[] = {
- PHP_FALIAS(splitText, dom_text_split_text, NULL)
- PHP_FALIAS(isWhitespaceInElementContent, dom_text_is_whitespace_in_element_content, NULL)
- PHP_FALIAS(isElementContentWhitespace, dom_text_is_whitespace_in_element_content, NULL)
- PHP_FALIAS(replaceWholeText, dom_text_replace_whole_text, NULL)
- PHP_ME(domtext, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_FALIAS(splitText, dom_text_split_text, arginfo_dom_text_split_text)
+ PHP_FALIAS(isWhitespaceInElementContent, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
+ PHP_FALIAS(isElementContentWhitespace, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
+ PHP_FALIAS(replaceWholeText, dom_text_replace_whole_text, arginfo_dom_text_replace_whole_text)
+ PHP_ME(domtext, __construct, arginfo_dom_text_construct, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c
index ae36fcf3c..0dd169329 100644
--- a/ext/dom/typeinfo.c
+++ b/ext/dom/typeinfo.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: typeinfo.c,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: typeinfo.c,v 1.6.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/userdatahandler.c b/ext/dom/userdatahandler.c
index 797f206a8..3a43fd6cb 100644
--- a/ext/dom/userdatahandler.c
+++ b/ext/dom/userdatahandler.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userdatahandler.c,v 1.6.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: userdatahandler.c,v 1.6.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index fbdf64439..a96861697 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml_common.h,v 1.23.2.1.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: xml_common.h,v 1.23.2.1.2.3 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef PHP_XML_COMMON_H
#define PHP_XML_COMMON_H
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index e953de198..9910e4e25 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xpath.c,v 1.26.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: xpath.c,v 1.26.2.1.2.3 2008/01/29 15:55:29 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -36,11 +36,36 @@
#if defined(LIBXML_XPATH_ENABLED)
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_construct, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_register_ns, 0, 0, 2)
+ ZEND_ARG_INFO(0, prefix)
+ ZEND_ARG_INFO(0, uri)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_query, 0, 0, 1)
+ ZEND_ARG_INFO(0, expr)
+ ZEND_ARG_OBJ_INFO(0, context, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_evaluate, 0, 0, 1)
+ ZEND_ARG_INFO(0, expr)
+ ZEND_ARG_OBJ_INFO(0, context, DOMNode, 0)
+ZEND_END_ARG_INFO();
+/* }}} */
+
zend_function_entry php_dom_xpath_class_functions[] = {
- PHP_ME(domxpath, __construct, NULL, ZEND_ACC_PUBLIC)
- PHP_FALIAS(registerNamespace, dom_xpath_register_ns, NULL)
- PHP_FALIAS(query, dom_xpath_query, NULL)
- PHP_FALIAS(evaluate, dom_xpath_evaluate, NULL)
+ PHP_ME(domxpath, __construct, arginfo_dom_xpath_construct, ZEND_ACC_PUBLIC)
+ PHP_FALIAS(registerNamespace, dom_xpath_register_ns, arginfo_dom_xpath_register_ns)
+ PHP_FALIAS(query, dom_xpath_query, arginfo_dom_xpath_query)
+ PHP_FALIAS(evaluate, dom_xpath_evaluate, arginfo_dom_xpath_evaluate)
{NULL, NULL, NULL}
};
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 34b6058cf..c347f6b12 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: exif.c,v 1.173.2.5.2.20 2007/06/10 20:12:45 iliaa Exp $ */
+/* $Id: exif.c,v 1.173.2.5.2.25 2008/03/12 17:33:14 iliaa Exp $ */
/* ToDos
*
@@ -142,7 +142,7 @@ zend_function_entry exif_functions[] = {
};
/* }}} */
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.173.2.5.2.20 2007/06/10 20:12:45 iliaa Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.173.2.5.2.25 2008/03/12 17:33:14 iliaa Exp $"
/* {{{ PHP_MINFO_FUNCTION
*/
@@ -241,12 +241,21 @@ PHP_MSHUTDOWN_FUNCTION(exif)
}
/* }}} */
+/* {{{ exif dependencies */
+static zend_module_dep exif_module_deps[] = {
+ ZEND_MOD_REQUIRED("standard")
+#if EXIF_USE_MBSTRING
+ ZEND_MOD_REQUIRED("mbstring")
+#endif
+ {NULL, NULL, NULL}
+};
+/* }}} */
+
/* {{{ exif_module_entry
*/
zend_module_entry exif_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
+ STANDARD_MODULE_HEADER_EX, NULL,
+ exif_module_deps,
"exif",
exif_functions,
PHP_MINIT(exif),
@@ -2868,7 +2877,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
/* exception are IFD pointers */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, byte_count, offset_val+byte_count, IFDlength);
}
- return TRUE;
+ return FALSE;
}
if (byte_count>sizeof(cbuf)) {
/* mark as outside range and get buffer */
diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h
index 289c00b7c..c020dfe3b 100644
--- a/ext/exif/php_exif.h
+++ b/ext/exif/php_exif.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_exif.h,v 1.14.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: php_exif.h,v 1.14.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#if HAVE_EXIF
extern zend_module_entry exif_module_entry;
diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c
index bc97574e3..e919f88f4 100644
--- a/ext/fbsql/php_fbsql.c
+++ b/ext/fbsql/php_fbsql.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_fbsql.c,v 1.114.2.3.2.6 2007/02/24 02:17:24 helly Exp $ */
+/* $Id: php_fbsql.c,v 1.114.2.3.2.7 2007/12/31 07:20:06 sebastian Exp $ */
/* TODO:
*
diff --git a/ext/fbsql/php_fbsql.h b/ext/fbsql/php_fbsql.h
index ba09d8819..a8c82ba43 100644
--- a/ext/fbsql/php_fbsql.h
+++ b/ext/fbsql/php_fbsql.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_fbsql.h,v 1.31.2.1.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: php_fbsql.h,v 1.31.2.1.2.3 2007/12/31 07:20:06 sebastian Exp $ */
#define HAVE_FBSQL 1
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c
index a5360cfc2..91c4f91e7 100644
--- a/ext/fdf/fdf.c
+++ b/ext/fdf/fdf.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fdf.c,v 1.89.2.2.2.9 2007/03/05 21:54:46 stas Exp $ */
+/* $Id: fdf.c,v 1.89.2.2.2.10 2007/12/31 07:20:06 sebastian Exp $ */
/* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from
http://beta1.adobe.com/ada/acrosdk/forms.html. */
diff --git a/ext/fdf/php_fdf.h b/ext/fdf/php_fdf.h
index dd7945817..c9161582b 100644
--- a/ext/fdf/php_fdf.h
+++ b/ext/fdf/php_fdf.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_fdf.h,v 1.22.2.1.2.1 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: php_fdf.h,v 1.22.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef PHP_FDF_H
#define PHP_FDF_H
diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c
index e72377e17..4405347d9 100644
--- a/ext/filter/callback_filter.c
+++ b/ext/filter/callback_filter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: callback_filter.c,v 1.9.2.4 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: callback_filter.c,v 1.9.2.5 2007/12/31 07:20:06 sebastian Exp $ */
#include "php_filter.h"
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index ba6367d5c..e26a747f9 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter.c,v 1.52.2.39 2007/04/04 20:50:26 pajoye Exp $ */
+/* $Id: filter.c,v 1.52.2.42 2008/02/24 18:34:30 felipe Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -275,7 +275,7 @@ PHP_MINFO_FUNCTION(filter)
{
php_info_print_table_start();
php_info_print_table_row( 2, "Input Validation and Filtering", "enabled" );
- php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.39 $");
+ php_info_print_table_row( 2, "Revision", "$Revision: 1.52.2.42 $");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -322,7 +322,7 @@ static void php_zval_filter(zval **value, long filter, long flags, zval *options
filter_func.function(*value, flags, options, charset TSRMLS_CC);
if (
- options &&
+ options && (Z_TYPE_P(options) == IS_ARRAY || Z_TYPE_P(options) == IS_OBJECT) &&
((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_PP(value) == IS_NULL) ||
(!(flags & FILTER_NULL_ON_FAILURE) && Z_TYPE_PP(value) == IS_BOOL && Z_LVAL_PP(value) == 0)) &&
zend_hash_exists(HASH_OF(options), "default", sizeof("default"))
@@ -453,15 +453,16 @@ static void php_zval_filter_recursive(zval **value, long filter, long flags, zva
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(value), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_PP(value), (void **) &element, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)) {
-
- if (Z_TYPE_PP(element) == IS_ARRAY) {
- Z_ARRVAL_PP(element)->nApplyCount++;
- php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
- Z_ARRVAL_PP(element)->nApplyCount--;
- } else {
- php_zval_filter(element, filter, flags, options, charset, copy TSRMLS_CC);
- }
+ zend_hash_move_forward_ex(Z_ARRVAL_PP(value), &pos)
+ ) {
+ SEPARATE_ZVAL_IF_NOT_REF(element);
+ if (Z_TYPE_PP(element) == IS_ARRAY) {
+ Z_ARRVAL_PP(element)->nApplyCount++;
+ php_zval_filter_recursive(element, filter, flags, options, charset, copy TSRMLS_CC);
+ Z_ARRVAL_PP(element)->nApplyCount--;
+ } else {
+ php_zval_filter(element, filter, flags, options, charset, copy TSRMLS_CC);
+ }
}
} else {
php_zval_filter(value, filter, flags, options, charset, copy TSRMLS_CC);
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index 6ae79afb5..e8e8fcf3a 100644
--- a/ext/filter/filter_private.h
+++ b/ext/filter/filter_private.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filter_private.h,v 1.12.2.9 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: filter_private.h,v 1.12.2.10 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef FILTER_PRIVATE_H
#define FILTER_PRIVATE_H
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 4463f4e0d..103d5a51e 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: logical_filters.c,v 1.1.2.22 2007/05/03 23:38:27 iliaa Exp $ */
+/* $Id: logical_filters.c,v 1.1.2.24 2008/03/18 23:32:42 iliaa Exp $ */
#include "php_filter.h"
#include "filter_private.h"
@@ -469,7 +469,7 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
/* From http://cvs.php.net/co.php/pear/HTML_QuickForm/QuickForm/Rule/Email.php?r=1.4 */
- const char regexp[] = "/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\\-])+\\.)+[A-Za-z\\-]+))$/D";
+ const char regexp[] = "/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9])(([A-Za-z0-9\\-])*([A-Za-z0-9]))?\\.)+[A-Za-z\\-]+))$/D";
pcre *re = NULL;
pcre_extra *pcre_extra = NULL;
diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h
index f4b0133d7..a1dd54a3e 100644
--- a/ext/filter/php_filter.h
+++ b/ext/filter/php_filter.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_filter.h,v 1.10.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: php_filter.h,v 1.10.2.3 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef PHP_FILTER_H
#define PHP_FILTER_H
diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
index 17f33c3a2..132ae86f7 100644
--- a/ext/filter/sanitizing_filters.c
+++ b/ext/filter/sanitizing_filters.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sanitizing_filters.c,v 1.11.2.9 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: sanitizing_filters.c,v 1.11.2.10 2007/12/31 07:20:06 sebastian Exp $ */
#include "php_filter.h"
#include "filter_private.h"
diff --git a/ext/filter/tests/052.phpt b/ext/filter/tests/052.phpt
new file mode 100644
index 000000000..257613e9d
--- /dev/null
+++ b/ext/filter/tests/052.phpt
@@ -0,0 +1,73 @@
+--TEST--
+filter_var() / filter_var_array() and passed data integrity
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+function filter_cb($var)
+{
+ return 1;
+}
+
+$data = array ('bar' => array ('fu<script>bar', 'bar<script>fu') );
+var_dump(filter_var($data, FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY));
+var_dump($data);
+var_dump(filter_var($data, FILTER_CALLBACK, array('options' => 'filter_cb')));
+var_dump($data);
+var_dump(filter_var_array($data, array('bar' => array('filter' => FILTER_CALLBACK, 'options' => 'filter_cb'))));
+var_dump($data);
+--EXPECT--
+array(1) {
+ ["bar"]=>
+ array(2) {
+ [0]=>
+ string(5) "fubar"
+ [1]=>
+ string(5) "barfu"
+ }
+}
+array(1) {
+ ["bar"]=>
+ array(2) {
+ [0]=>
+ string(13) "fu<script>bar"
+ [1]=>
+ string(13) "bar<script>fu"
+ }
+}
+array(1) {
+ ["bar"]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+array(1) {
+ ["bar"]=>
+ array(2) {
+ [0]=>
+ string(13) "fu<script>bar"
+ [1]=>
+ string(13) "bar<script>fu"
+ }
+}
+array(1) {
+ ["bar"]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+array(1) {
+ ["bar"]=>
+ array(2) {
+ [0]=>
+ string(13) "fu<script>bar"
+ [1]=>
+ string(13) "bar<script>fu"
+ }
+}
diff --git a/ext/filter/tests/053.phpt b/ext/filter/tests/053.phpt
new file mode 100644
index 000000000..218f7fd01
--- /dev/null
+++ b/ext/filter/tests/053.phpt
@@ -0,0 +1,15 @@
+--TEST--
+filter_var() - using callback
+--FILE--
+<?php
+
+function filter_test($str) { return FALSE; }
+filter_var('durty/boy', FILTER_CALLBACK, array(
+ 'options' => 'filter_test',
+));
+
+print "Done\n";
+
+?>
+--EXPECTF--
+Done
diff --git a/ext/filter/tests/bug44445.phpt b/ext/filter/tests/bug44445.phpt
new file mode 100644
index 000000000..36a864141
--- /dev/null
+++ b/ext/filter/tests/bug44445.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #44445 (email validator does not handle domains starting/ending with a -)
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(filter_var("foo@-foo.com",FILTER_VALIDATE_EMAIL));
+var_dump(filter_var("foo@foo-.com",FILTER_VALIDATE_EMAIL));
+?>
+--EXPECT--
+bool(false)
+bool(false)
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index ad998d0cd..cdc73b546 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftp.c,v 1.112.2.4.2.9 2007/06/07 08:59:00 tony2001 Exp $ */
+/* $Id: ftp.c,v 1.112.2.4.2.10 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
index fcfb72089..d9f3fd197 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftp.h,v 1.43.2.1.2.2 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: ftp.h,v 1.43.2.1.2.3 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef FTP_H
#define FTP_H
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index 2b55f8e0d..69d947efa 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ftp.c,v 1.103.2.2.2.2 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_ftp.c,v 1.103.2.2.2.3 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h
index 8498bfe5d..309f6780f 100644
--- a/ext/ftp/php_ftp.h
+++ b/ext/ftp/php_ftp.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ftp.h,v 1.29.2.1.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_ftp.h,v 1.29.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef _INCLUDED_FTP_H
#define _INCLUDED_FTP_H
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index b12a7ecf9..541ed86e9 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.312.2.20.2.32 2007/09/11 21:03:48 pajoye Exp $ */
+/* $Id: gd.c,v 1.312.2.20.2.34 2008/04/04 17:39:52 felipe Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -2813,7 +2813,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
}
}
- if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) {
+ if (argc >= 2 && Z_STRLEN_PP(file)) {
PHP_GD_CHECK_OPEN_BASEDIR(fn, "Invalid filename");
fp = VCWD_FOPEN(fn, "wb");
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index 773462f99..cd721b3f9 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd_ctx.c,v 1.22.2.5.2.3 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: gd_ctx.c,v 1.22.2.5.2.4 2007/12/31 07:20:06 sebastian Exp $ */
#include "php_gd.h"
diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c
index 49a540c42..e543f2fe2 100644
--- a/ext/gd/libgd/gdft.c
+++ b/ext/gd/libgd/gdft.c
@@ -947,7 +947,8 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
/* EAM DEBUG */
#if (defined(FREETYPE_MAJOR) && ((FREETYPE_MAJOR == 2 && ((FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 3) || FREETYPE_MINOR > 1) || FREETYPE_MAJOR > 2)))
- if (font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL && strcmp(font->face->family_name, "Symbol") == 0) {
+ if (font->face->family_name && font->face->charmap->encoding &&
+ font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL && strcmp(font->face->family_name, "Symbol") == 0) {
/* I do not know the significance of the constant 0xf000.
* It was determined by inspection of the character codes
* stored in Microsoft font symbol.
diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c
index 30ed3cf4a..6e7f473a9 100644
--- a/ext/gd/libgd/xbm.c
+++ b/ext/gd/libgd/xbm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xbm.c,v 1.7.2.2.2.2 2007/08/09 12:08:29 mattias Exp $ */
+/* $Id: xbm.c,v 1.7.2.2.2.3 2007/12/31 07:20:06 sebastian Exp $ */
#include <stdio.h>
#include <math.h>
diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h
index 05ccab1d3..6c981f3ce 100644
--- a/ext/gd/php_gd.h
+++ b/ext/gd/php_gd.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_gd.h,v 1.59.2.3.2.5 2007/04/17 15:31:45 pajoye Exp $ */
+/* $Id: php_gd.h,v 1.59.2.3.2.6 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef PHP_GD_H
#define PHP_GD_H
diff --git a/ext/gd/tests/gd_info_basic.phpt b/ext/gd/tests/gd_info_basic.phpt
new file mode 100644
index 000000000..61a2304e8
--- /dev/null
+++ b/ext/gd/tests/gd_info_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+gd_info()
+--SKIPIF--
+<?php
+ if (!function_exists('gd_info')) {
+ die('skip gd_info() not available');
+ }
+?>
+--FILE--
+<?php
+
+/* Prototype : array gd_info ( void )
+ * Description: Retrieve information about the currently installed GD library
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+ echo "basic test of gd_info() function\n";
+
+ var_dump(gd_info());
+
+ echo "\nDone\n";
+?>
+--EXPECTF--
+basic test of gd_info() function
+array(%d) {
+%a
+}
+
+Done
diff --git a/ext/gd/tests/image_type_to_mime_type_basic.phpt b/ext/gd/tests/image_type_to_mime_type_basic.phpt
new file mode 100644
index 000000000..7384c4632
--- /dev/null
+++ b/ext/gd/tests/image_type_to_mime_type_basic.phpt
@@ -0,0 +1,64 @@
+--TEST--
+image_type_to_mime_type()
+--SKIPIF--
+<?php
+ if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available');
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+
+/* Prototype : string image_type_to_mime_type ( int $imagetype )
+ * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype.
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "Starting image_type_to_mime_type() test\n\n";
+
+$image_types = array (
+ IMAGETYPE_GIF,
+ IMAGETYPE_JPEG,
+ IMAGETYPE_PNG,
+ IMAGETYPE_SWF,
+ IMAGETYPE_PSD,
+ IMAGETYPE_BMP,
+ IMAGETYPE_TIFF_II,
+ IMAGETYPE_TIFF_MM,
+ IMAGETYPE_JPC,
+ IMAGETYPE_JP2,
+ IMAGETYPE_JPX,
+ IMAGETYPE_JB2,
+ IMAGETYPE_IFF,
+ IMAGETYPE_WBMP,
+ IMAGETYPE_JPEG2000,
+ IMAGETYPE_XBM
+);
+
+ foreach($image_types as $image_type) {
+ var_dump(image_type_to_mime_type($image_type));
+ }
+
+echo "\nDone image_type_to_mime_type() test\n";
+?>
+--EXPECT--
+Starting image_type_to_mime_type() test
+
+string(9) "image/gif"
+string(10) "image/jpeg"
+string(9) "image/png"
+string(29) "application/x-shockwave-flash"
+string(9) "image/psd"
+string(9) "image/bmp"
+string(10) "image/tiff"
+string(10) "image/tiff"
+string(24) "application/octet-stream"
+string(9) "image/jp2"
+string(24) "application/octet-stream"
+string(24) "application/octet-stream"
+string(9) "image/iff"
+string(18) "image/vnd.wap.wbmp"
+string(24) "application/octet-stream"
+string(9) "image/xbm"
+
+Done image_type_to_mime_type() test \ No newline at end of file
diff --git a/ext/gd/tests/imagecopyresampled_basic.phpt b/ext/gd/tests/imagecopyresampled_basic.phpt
new file mode 100644
index 000000000..12ac15511
--- /dev/null
+++ b/ext/gd/tests/imagecopyresampled_basic.phpt
@@ -0,0 +1,71 @@
+--TEST--
+imagecopyresampled()
+--SKIPIF--
+<?php
+ if (!function_exists('imagecopyresampled')) die('skip imagecopyresampled() not available');
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+
+/* Prototype : bool imagecopyresampled ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h )
+ * Description: Copy and resize part of an image with resampling.
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "Simple test of imagecopyresampled() function\n";
+
+$dest_lge = dirname(realpath(__FILE__)) . '/imagelarge.png';
+$dest_sml = dirname(realpath(__FILE__)) . '/imagesmall.png';
+
+// create a blank image
+$image_lge = imagecreatetruecolor(400, 300);
+
+// set the background color to black
+$bg = imagecolorallocate($image_lge, 0, 0, 0);
+
+// fill polygon with blue
+$col_ellipse = imagecolorallocate($image_lge, 0, 255, 0);
+
+// draw the eclipse
+imagefilledellipse($image_lge, 200, 150, 300, 200, $col_ellipse);
+
+// output the picture to a file
+imagepng($image_lge, $dest_lge);
+
+// Get new dimensions
+$percent = 0.5; // new image 50% of orginal
+list($width, $height) = getimagesize($dest_lge);
+echo "Size of orginal: width=". $width . " height=" . $height . "\n";
+
+$new_width = $width * $percent;
+$new_height = $height * $percent;
+
+// Resample
+$image_sml = imagecreatetruecolor($new_width, $new_height);
+imagecopyresampled($image_sml, $image_lge, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
+
+imagepng($image_sml, $dest_sml);
+
+list($width, $height) = getimagesize($dest_sml);
+echo "Size of copy: width=". $width . " height=" . $height . "\n";
+
+imagedestroy($image_lge);
+imagedestroy($image_sml);
+
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+ $dest_lge = dirname(realpath(__FILE__)) . '/imagelarge.png';
+ $dest_sml = dirname(realpath(__FILE__)) . '/imagesmall.png';
+ @unlink($dest_lge);
+ @unlink($dest_sml);
+?>
+--EXPECT--
+Simple test of imagecopyresampled() function
+Size of orginal: width=400 height=300
+Size of copy: width=200 height=150
+Done
diff --git a/ext/gd/tests/imagedashedline_basic.phpt b/ext/gd/tests/imagedashedline_basic.phpt
new file mode 100644
index 000000000..1d6797520
--- /dev/null
+++ b/ext/gd/tests/imagedashedline_basic.phpt
@@ -0,0 +1,78 @@
+--TEST--
+imagedashedline()
+--SKIPIF--
+<?php
+ if (!function_exists('imagedashedline')) die('skip imagedashedline() not available');
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+
+/* Prototype : bool imagedashedline ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )
+ * Description: Draws a dashed line.
+ * This function is deprecated. Use combination of imagesetstyle() and imageline() instead.
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+
+echo "Simple test of imagedashedline() function\n";
+
+$dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
+
+// create a blank image
+$image = imagecreatetruecolor(250, 250);
+
+// set the background color to black
+$bg = imagecolorallocate($image, 0, 0, 0);
+
+// red dashed lines
+$col_line = imagecolorallocate($image, 255, 0, 0);
+
+// draw a couple of vertical dashed lines
+imagedashedline($image, 100, 20, 100, 230, $col_line );
+imagedashedline($image, 150, 20, 150, 230, $col_line );
+
+// output the picture to a file
+imagepng($image, $dest);
+
+//check color of a point on edge..
+$col1 = imagecolorat($image, 100, 230);
+// ..and a point on background
+$col2 = imagecolorat($image, 5, 5);
+
+$color1 = imagecolorsforindex($image, $col1);
+$color2 = imagecolorsforindex($image, $col2);
+var_dump($color1, $color2);
+
+imagedestroy($image);
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+ $dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
+ @unlink($dest);
+?>
+--EXPECT--
+Simple test of imagedashedline() function
+array(4) {
+ ["red"]=>
+ int(255)
+ ["green"]=>
+ int(0)
+ ["blue"]=>
+ int(0)
+ ["alpha"]=>
+ int(0)
+}
+array(4) {
+ ["red"]=>
+ int(0)
+ ["green"]=>
+ int(0)
+ ["blue"]=>
+ int(0)
+ ["alpha"]=>
+ int(0)
+}
+Done
diff --git a/ext/gd/tests/imagefilledpolygon_basic.phpt b/ext/gd/tests/imagefilledpolygon_basic.phpt
new file mode 100644
index 000000000..6871a28b7
--- /dev/null
+++ b/ext/gd/tests/imagefilledpolygon_basic.phpt
@@ -0,0 +1,102 @@
+--TEST--
+imagefilledpolygon()
+--SKIPIF--
+<?php
+ if (!function_exists('imagefilledpolygon')) die('skip imagefilledpolygon() not available');
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+
+/* Prototype : bool imagefilledpolygon ( resource $image , array $points , int $num_points , int $color )
+ * Description: Draws a filled polygon.
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+echo "Simple test of imagefilledpolygon() function\n";
+
+$dest = dirname(realpath(__FILE__)) . '/imagefilledpolygon.png';
+
+$points = array(
+ 40, 50,
+ 20, 240,
+ 60, 60,
+ 240, 20,
+ 50, 40,
+ 10, 10
+ );
+
+// create a blank image
+$image = imagecreatetruecolor(250, 250);
+
+// set the background color to black
+$bg = imagecolorallocate($image, 0, 0, 0);
+
+// fill polygon with green
+$col_poly = imagecolorallocate($image, 0, 255, 0);
+
+// draw the polygon
+imagefilledpolygon($image, $points, count($points)/2, $col_poly);
+
+// output the picture to a file
+imagepng($image, $dest);
+
+// get it back
+$image_in = imagecreatefrompng($dest);
+
+//check color of a point on edge..
+$col1 = imagecolorat($image_in, 40, 50);
+//.. a point in filled body
+$col2 = imagecolorat($image_in, 15, 15);
+// ..and a point on background
+$col3 = imagecolorat($image_in, 5, 5);
+
+$color1 = imagecolorsforindex($image_in, $col1);
+$color2 = imagecolorsforindex($image_in, $col2);
+$color3 = imagecolorsforindex($image_in, $col3);
+var_dump($color1, $color2, $color3);
+
+imagedestroy($image);
+imagedestroy($image_in);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+ $dest = dirname(realpath(__FILE__)) . '/imagefilledpolygon.png';
+ @unlink($dest);
+?>
+--EXPECT--
+Simple test of imagefilledpolygon() function
+array(4) {
+ ["red"]=>
+ int(0)
+ ["green"]=>
+ int(255)
+ ["blue"]=>
+ int(0)
+ ["alpha"]=>
+ int(0)
+}
+array(4) {
+ ["red"]=>
+ int(0)
+ ["green"]=>
+ int(255)
+ ["blue"]=>
+ int(0)
+ ["alpha"]=>
+ int(0)
+}
+array(4) {
+ ["red"]=>
+ int(0)
+ ["green"]=>
+ int(0)
+ ["blue"]=>
+ int(0)
+ ["alpha"]=>
+ int(0)
+}
+Done
diff --git a/ext/gd/tests/imagepolygon_basic.phpt b/ext/gd/tests/imagepolygon_basic.phpt
new file mode 100644
index 000000000..5c79cdf5b
--- /dev/null
+++ b/ext/gd/tests/imagepolygon_basic.phpt
@@ -0,0 +1,80 @@
+--TEST--
+imageploygon()
+--SKIPIF--
+<?php
+ if (!function_exists('imagepolygon')) die('skip imagepolygon() not available');
+ require_once('skipif_imagetype.inc');
+?>
+--FILE--
+<?php
+
+/* Prototype : bool imagepolygon ( resource $image , array $points , int $num_points , int $color )
+ * Description: Draws a polygon.
+ * Source code: ext/standard/image.c
+ * Alias to functions:
+ */
+
+
+echo "Simple test of imagepolygon() function\n";
+
+$dest = dirname(realpath(__FILE__)) . '/imagepolygon.png';
+
+// create a blank image
+$image = imagecreatetruecolor(400, 300);
+
+// set the background color to black
+$bg = imagecolorallocate($image, 0, 0, 0);
+
+// draw a red polygon
+$col_poly = imagecolorallocate($image, 255, 0, 0);
+
+// draw the polygon
+imagepolygon($image, array (
+ 0, 0,
+ 100, 200,
+ 300, 200
+ ),
+ 3,
+ $col_poly);
+
+// output the picture to a file
+imagepng($image, $dest);
+
+$col1 = imagecolorat($image, 100, 200);
+$col2 = imagecolorat($image, 100, 100);
+$color1 = imagecolorsforindex($image, $col1);
+$color2 = imagecolorsforindex($image, $col2);
+var_dump($color1, $color2);
+
+imagedestroy($image);
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+ $dest = dirname(realpath(__FILE__)) . '/imagepolygon.png';
+ @unlink($dest);
+?>
+--EXPECT--
+Simple test of imagepolygon() function
+array(4) {
+ ["red"]=>
+ int(255)
+ ["green"]=>
+ int(0)
+ ["blue"]=>
+ int(0)
+ ["alpha"]=>
+ int(0)
+}
+array(4) {
+ ["red"]=>
+ int(0)
+ ["green"]=>
+ int(0)
+ ["blue"]=>
+ int(0)
+ ["alpha"]=>
+ int(0)
+}
+Done
diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c
index 6dea6d082..71bd68a7f 100644
--- a/ext/gettext/gettext.c
+++ b/ext/gettext/gettext.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gettext.c,v 1.46.2.2.2.4 2007/01/16 14:42:38 tony2001 Exp $ */
+/* $Id: gettext.c,v 1.46.2.2.2.5 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/gettext/php_gettext.h b/ext/gettext/php_gettext.h
index 285db2e03..f75f53427 100644
--- a/ext/gettext/php_gettext.h
+++ b/ext/gettext/php_gettext.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_gettext.h,v 1.20.2.1.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_gettext.h,v 1.20.2.1.2.2 2007/12/31 07:20:06 sebastian Exp $ */
#ifndef PHP_GETTEXT_H
#define PHP_GETTEXT_H
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 6610a8c00..09f468d1b 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
index 22b4abcf4..ff8c66625 100644
--- a/ext/gmp/php_gmp.h
+++ b/ext/gmp/php_gmp.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 0edecb7fc..8a5e2bf70 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash.c,v 1.18.2.5.2.7 2007/02/27 03:28:16 iliaa Exp $ */
+/* $Id: hash.c,v 1.18.2.5.2.8 2007/12/31 07:20:06 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/hash/hash_adler32.c b/ext/hash/hash_adler32.c
index 60ff1e817..9dc5dc4b2 100644
--- a/ext/hash/hash_adler32.c
+++ b/ext/hash/hash_adler32.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_adler32.c,v 1.3.2.4.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_adler32.c,v 1.3.2.4.2.3 2007/12/31 07:20:06 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_adler32.h"
diff --git a/ext/hash/hash_crc32.c b/ext/hash/hash_crc32.c
index 7ef5a4f21..f13c5d45e 100644
--- a/ext/hash/hash_crc32.c
+++ b/ext/hash/hash_crc32.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_crc32.c,v 1.2.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_crc32.c,v 1.2.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_crc32.h"
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index 87b8dcfeb..c860c347c 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_gost.c,v 1.2.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_gost.c,v 1.2.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_gost.h"
diff --git a/ext/hash/hash_haval.c b/ext/hash/hash_haval.c
index 312220dca..04557f634 100644
--- a/ext/hash/hash_haval.c
+++ b/ext/hash/hash_haval.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_haval.c,v 1.4.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_haval.c,v 1.4.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_haval.h"
diff --git a/ext/hash/hash_md.c b/ext/hash/hash_md.c
index 28b459657..85347db26 100644
--- a/ext/hash/hash_md.c
+++ b/ext/hash/hash_md.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_md.c,v 1.6.2.4.2.3 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_md.c,v 1.6.2.4.2.4 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_md.h"
diff --git a/ext/hash/hash_ripemd.c b/ext/hash/hash_ripemd.c
index 4cdc4f78d..e656431ae 100644
--- a/ext/hash/hash_ripemd.c
+++ b/ext/hash/hash_ripemd.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_ripemd.c,v 1.5.2.3.2.3 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_ripemd.c,v 1.5.2.3.2.4 2007/12/31 07:20:07 sebastian Exp $ */
/* Heavily borrowed from md5.c & sha1.c of PHP archival fame
Note that ripemd laughs in the face of logic and uses
diff --git a/ext/hash/hash_salsa.c b/ext/hash/hash_salsa.c
index a95a350d0..9cc84ce8b 100644
--- a/ext/hash/hash_salsa.c
+++ b/ext/hash/hash_salsa.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_salsa.c,v 1.3.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_salsa.c,v 1.3.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_salsa.h"
diff --git a/ext/hash/hash_sha.c b/ext/hash/hash_sha.c
index 6b9b04f5e..74aef1544 100644
--- a/ext/hash/hash_sha.c
+++ b/ext/hash/hash_sha.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_sha.c,v 1.10.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_sha.c,v 1.10.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_sha.h"
diff --git a/ext/hash/hash_snefru.c b/ext/hash/hash_snefru.c
index 829701a52..412698502 100644
--- a/ext/hash/hash_snefru.c
+++ b/ext/hash/hash_snefru.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_snefru.c,v 1.3.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_snefru.c,v 1.3.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_snefru.h"
diff --git a/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index 161e7651a..906ad5ab0 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_tiger.c,v 1.4.2.4.2.3 2007/09/04 18:46:21 tony2001 Exp $ */
+/* $Id: hash_tiger.c,v 1.4.2.4.2.4 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
#include "php_hash_tiger.h"
diff --git a/ext/hash/hash_whirlpool.c b/ext/hash/hash_whirlpool.c
index 08224e3df..8b6c7ed27 100644
--- a/ext/hash/hash_whirlpool.c
+++ b/ext/hash/hash_whirlpool.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_whirlpool.c,v 1.3.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_whirlpool.c,v 1.3.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#include "php_hash.h"
diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h
index 919146a97..2c863f722 100644
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash.h,v 1.13.2.7.2.3 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: php_hash.h,v 1.13.2.7.2.4 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_H
#define PHP_HASH_H
diff --git a/ext/hash/php_hash_adler32.h b/ext/hash/php_hash_adler32.h
index b0e367588..36f56de72 100644
--- a/ext/hash/php_hash_adler32.h
+++ b/ext/hash/php_hash_adler32.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_adler32.h,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_adler32.h,v 1.3.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_ADLER32_H
#define PHP_HASH_ADLER32_H
diff --git a/ext/hash/php_hash_crc32.h b/ext/hash/php_hash_crc32.h
index f5662c564..0a74fb884 100644
--- a/ext/hash/php_hash_crc32.h
+++ b/ext/hash/php_hash_crc32.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_crc32.h,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_crc32.h,v 1.3.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_CRC32_H
#define PHP_HASH_CRC32_H
diff --git a/ext/hash/php_hash_crc32_tables.h b/ext/hash/php_hash_crc32_tables.h
index 760ce7b30..ba9ad1b1b 100644
--- a/ext/hash/php_hash_crc32_tables.h
+++ b/ext/hash/php_hash_crc32_tables.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_crc32_tables.h,v 1.2.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_crc32_tables.h,v 1.2.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
static const php_hash_uint32 crc32_table[] = { 0x0,
0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
diff --git a/ext/hash/php_hash_gost.h b/ext/hash/php_hash_gost.h
index acc40f6db..a54286e36 100644
--- a/ext/hash/php_hash_gost.h
+++ b/ext/hash/php_hash_gost.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_gost.h,v 1.2.2.4.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_gost.h,v 1.2.2.4.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_GOST_H
#define PHP_HASH_GOST_H
diff --git a/ext/hash/php_hash_haval.h b/ext/hash/php_hash_haval.h
index 5bf8eacb3..8b8672a54 100644
--- a/ext/hash/php_hash_haval.h
+++ b/ext/hash/php_hash_haval.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_haval.h,v 1.2.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_haval.h,v 1.2.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_HAVAL_H
#define PHP_HASH_HAVAL_H
diff --git a/ext/hash/php_hash_md.h b/ext/hash/php_hash_md.h
index a19d77aa0..adff1e7e4 100644
--- a/ext/hash/php_hash_md.h
+++ b/ext/hash/php_hash_md.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_md.h,v 1.2.2.4.2.2 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_md.h,v 1.2.2.4.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_MD_H
#define PHP_HASH_MD_H
diff --git a/ext/hash/php_hash_ripemd.h b/ext/hash/php_hash_ripemd.h
index 4cb55a638..18180e0e1 100644
--- a/ext/hash/php_hash_ripemd.h
+++ b/ext/hash/php_hash_ripemd.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_ripemd.h,v 1.2.2.3.2.2 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_ripemd.h,v 1.2.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_RIPEMD_H
#define PHP_HASH_RIPEMD_H
diff --git a/ext/hash/php_hash_salsa.h b/ext/hash/php_hash_salsa.h
index 501b243ba..dad09c78a 100644
--- a/ext/hash/php_hash_salsa.h
+++ b/ext/hash/php_hash_salsa.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_salsa.h,v 1.4.2.4.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_salsa.h,v 1.4.2.4.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_SALSA_H
#define PHP_HASH_SALSA_H
diff --git a/ext/hash/php_hash_sha.h b/ext/hash/php_hash_sha.h
index 6cd6c86f9..1fd952b23 100644
--- a/ext/hash/php_hash_sha.h
+++ b/ext/hash/php_hash_sha.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_sha.h,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_sha.h,v 1.3.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_SHA_H
#define PHP_HASH_SHA_H
diff --git a/ext/hash/php_hash_snefru.h b/ext/hash/php_hash_snefru.h
index 21af83dc9..bc99fda11 100644
--- a/ext/hash/php_hash_snefru.h
+++ b/ext/hash/php_hash_snefru.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_snefru.h,v 1.2.2.4.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_snefru.h,v 1.2.2.4.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_SNEFRU_H
#define PHP_HASH_SNEFRU_H
diff --git a/ext/hash/php_hash_snefru_tables.h b/ext/hash/php_hash_snefru_tables.h
index 5acb54353..ed461a7df 100644
--- a/ext/hash/php_hash_snefru_tables.h
+++ b/ext/hash/php_hash_snefru_tables.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_snefru_tables.h,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_snefru_tables.h,v 1.3.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
static const php_hash_uint32 tables[16][256]= {
diff --git a/ext/hash/php_hash_tiger.h b/ext/hash/php_hash_tiger.h
index da6ad3b8b..338ead529 100644
--- a/ext/hash/php_hash_tiger.h
+++ b/ext/hash/php_hash_tiger.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_tiger.h,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_tiger.h,v 1.3.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_TIGER_H
#define PHP_HASH_TIGER_H
diff --git a/ext/hash/php_hash_tiger_tables.h b/ext/hash/php_hash_tiger_tables.h
index 3591f93b5..2fba9a4ff 100644
--- a/ext/hash/php_hash_tiger_tables.h
+++ b/ext/hash/php_hash_tiger_tables.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_tiger_tables.h,v 1.2.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_tiger_tables.h,v 1.2.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#define t1 (table)
#define t2 (table+256)
diff --git a/ext/hash/php_hash_types.h b/ext/hash/php_hash_types.h
index d4d61d841..c7a7b0e42 100644
--- a/ext/hash/php_hash_types.h
+++ b/ext/hash/php_hash_types.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_types.h,v 1.2.2.4.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_types.h,v 1.2.2.4.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_TYPES_H
#define PHP_HASH_TYPES_H
diff --git a/ext/hash/php_hash_whirlpool.h b/ext/hash/php_hash_whirlpool.h
index d56005b0e..aed8f0480 100644
--- a/ext/hash/php_hash_whirlpool.h
+++ b/ext/hash/php_hash_whirlpool.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_whirlpool.h,v 1.2.2.4.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_whirlpool.h,v 1.2.2.4.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_WHIRLPOOL_H
#define PHP_HASH_WHIRLPOOL_H
diff --git a/ext/hash/php_hash_whirlpool_tables.h b/ext/hash/php_hash_whirlpool_tables.h
index e3e31554d..69aa4293f 100644
--- a/ext/hash/php_hash_whirlpool_tables.h
+++ b/ext/hash/php_hash_whirlpool_tables.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_hash_whirlpool_tables.h,v 1.1.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash_whirlpool_tables.h,v 1.1.2.3.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_HASH_WHIRLPOOL_TABLES_H
#define PHP_HASH_WHIRLPOOL_TABLES_H
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 19710c90f..d7b4b4524 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.124.2.8.2.22 2007/11/01 19:13:49 tony2001 Exp $ */
+/* $Id: iconv.c,v 1.124.2.8.2.23 2007/12/31 07:20:07 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 03d17c0e7..975ae0c55 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Revision: 1.28.2.2.2.2 $ */
+/* $Revision: 1.28.2.2.2.3 $ */
#ifndef PHP_ICONV_H
#define PHP_ICONV_H
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 8b057a835..b93100d67 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -26,7 +26,7 @@
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.208.2.7.2.26 2007/07/31 00:31:10 stas Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.31 2008/04/17 11:04:49 felipe Exp $ */
#define IMAP41
@@ -792,7 +792,11 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#ifdef SET_MAXLOGINTRIALS
if (myargc == 5) {
convert_to_long_ex(retries);
- mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) Z_LVAL_PP(retries));
+ if (Z_LVAL_PP(retries) < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING ,"Retries must be greater or equal to 0");
+ } else {
+ mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) Z_LVAL_PP(retries));
+ }
}
#endif
@@ -1051,6 +1055,7 @@ PHP_FUNCTION(imap_setacl)
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
convert_to_string_ex(mailbox);
+ convert_to_string_ex(id);
convert_to_string_ex(rights);
RETURN_BOOL(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights)));
@@ -1582,8 +1587,8 @@ PHP_FUNCTION(imap_headerinfo)
convert_to_long_ex(msgno);
if (myargc >= 3) {
convert_to_long_ex(fromlength);
- if (Z_LVAL_PP(fromlength) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "From length has to be greater than or equal to 0");
+ if (Z_LVAL_PP(fromlength) < 0 || Z_LVAL_PP(fromlength) >= MAILTMPLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "From length has to be between 1 and %i", MAILTMPLEN);
RETURN_FALSE;
}
} else {
@@ -1591,8 +1596,8 @@ PHP_FUNCTION(imap_headerinfo)
}
if (myargc >= 4) {
convert_to_long_ex(subjectlength);
- if (Z_LVAL_PP(subjectlength) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject length has to be greater than or equal to 0");
+ if (Z_LVAL_PP(subjectlength) < 0 || Z_LVAL_PP(subjectlength) >= MAILTMPLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject length has to be between 1 and %i", MAILTMPLEN);
RETURN_FALSE;
}
} else {
@@ -3036,8 +3041,8 @@ PHP_FUNCTION(imap_mail_compose)
}
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(body));
- if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter cannot be empty");
+ if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) != SUCCESS || Z_TYPE_PP(data) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter must be a non-empty array");
RETURN_FALSE;
}
diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h
index e6ebd2ad7..06ca89ac5 100644
--- a/ext/imap/php_imap.h
+++ b/ext/imap/php_imap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.h,v 1.32.2.2.2.1 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: php_imap.h,v 1.32.2.2.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_IMAP_H
#define PHP_IMAP_H
diff --git a/ext/interbase/ibase_blobs.c b/ext/interbase/ibase_blobs.c
index 98e686781..ce994aed7 100644
--- a/ext/interbase/ibase_blobs.c
+++ b/ext/interbase/ibase_blobs.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ibase_blobs.c,v 1.9.2.1.2.3 2007/02/24 02:17:24 helly Exp $ */
+/* $Id: ibase_blobs.c,v 1.9.2.1.2.4 2007/12/31 07:20:07 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c
index 74d131759..6a9f13d50 100644
--- a/ext/interbase/ibase_events.c
+++ b/ext/interbase/ibase_events.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ibase_events.c,v 1.8.2.1.2.1 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: ibase_events.c,v 1.8.2.1.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/interbase/ibase_query.c b/ext/interbase/ibase_query.c
index b9e1c5581..b1062ef95 100644
--- a/ext/interbase/ibase_query.c
+++ b/ext/interbase/ibase_query.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ibase_query.c,v 1.23.2.1.2.10 2007/06/07 08:59:00 tony2001 Exp $ */
+/* $Id: ibase_query.c,v 1.23.2.1.2.11 2007/12/31 07:20:07 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/interbase/ibase_service.c b/ext/interbase/ibase_service.c
index 8e424ed10..d3d18c848 100644
--- a/ext/interbase/ibase_service.c
+++ b/ext/interbase/ibase_service.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ibase_service.c,v 1.11.2.2.2.5 2007/03/06 00:24:00 stas Exp $ */
+/* $Id: ibase_service.c,v 1.11.2.2.2.6 2007/12/31 07:20:07 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
index f75ef8b4f..47d0d3e9a 100644
--- a/ext/interbase/interbase.c
+++ b/ext/interbase/interbase.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.225.2.4.2.7 2007/02/28 10:37:07 bjori Exp $ */
+/* $Id: interbase.c,v 1.225.2.4.2.8 2007/12/31 07:20:07 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/interbase/php_ibase_includes.h b/ext/interbase/php_ibase_includes.h
index 45c26eaf3..57195e132 100755
--- a/ext/interbase/php_ibase_includes.h
+++ b/ext/interbase/php_ibase_includes.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ibase_includes.h,v 1.16.2.1.2.1 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: php_ibase_includes.h,v 1.16.2.1.2.3 2008/01/23 01:22:57 iliaa Exp $ */
#ifndef PHP_IBASE_INCLUDES_H
#define PHP_IBASE_INCLUDES_H
@@ -30,7 +30,7 @@
#endif
#ifndef METADATALENGTH
-#define METADATALENGTH 32
+#define METADATALENGTH 68
#endif
#define RESET_ERRMSG do { IBG(errmsg)[0] = '\0'; IBG(sql_code) = 0; } while (0)
diff --git a/ext/interbase/php_ibase_udf.c b/ext/interbase/php_ibase_udf.c
index c07af4343..4237222e5 100644
--- a/ext/interbase/php_ibase_udf.c
+++ b/ext/interbase/php_ibase_udf.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ibase_udf.c,v 1.9.2.1.2.2 2007/03/12 23:21:41 iliaa Exp $ */
+/* $Id: php_ibase_udf.c,v 1.9.2.1.2.3 2007/12/31 07:20:07 sebastian Exp $ */
/**
* This UDF library adds the ability to call PHP functions from SQL
diff --git a/ext/interbase/php_interbase.h b/ext/interbase/php_interbase.h
index 0d443133f..7437abff1 100644
--- a/ext/interbase/php_interbase.h
+++ b/ext/interbase/php_interbase.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_interbase.h,v 1.71.2.1.2.1 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: php_interbase.h,v 1.71.2.1.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_INTERBASE_H
#define PHP_INTERBASE_H
diff --git a/ext/json/json.c b/ext/json/json.c
index 393d41f5e..e7bb805e7 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: json.c,v 1.9.2.20 2007/10/01 15:23:15 iliaa Exp $ */
+/* $Id: json.c,v 1.9.2.21 2007/12/31 07:20:07 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index e9e6395a0..27ef7a0ac 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_json.h,v 1.8.2.2 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: php_json.h,v 1.8.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_JSON_H
#define PHP_JSON_H
diff --git a/ext/json/tests/005.phpt b/ext/json/tests/005.phpt
index f6a8977d1..01a307f4a 100644
--- a/ext/json/tests/005.phpt
+++ b/ext/json/tests/005.phpt
@@ -13,15 +13,11 @@ var_dump(json_encode($a));
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
array(1) {
[0]=>
- array(1) {
- [0]=>
- *RECURSION*
+ array(0) {
}
}
-
-Warning: json_encode(): recursion detected in %s on line %d
-string(8) "[[null]]"
+string(4) "[[]]"
Done
diff --git a/ext/json/tests/bug41567.phpt b/ext/json/tests/bug41567.phpt
index 5553df397..5a141003e 100644
--- a/ext/json/tests/bug41567.phpt
+++ b/ext/json/tests/bug41567.phpt
@@ -10,6 +10,8 @@ var_dump(json_decode($a));
echo "Done\n";
?>
+--INI--
+precision=14
--EXPECT--
float(123456789.12345)
Done
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index f6e3c8739..eb70b483b 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -23,7 +23,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ldap.c,v 1.161.2.3.2.11 2007/07/17 09:09:42 jani Exp $ */
+/* $Id: ldap.c,v 1.161.2.3.2.12 2007/12/31 07:20:07 sebastian Exp $ */
#define IS_EXT_MODULE
#ifdef HAVE_CONFIG_H
@@ -322,7 +322,7 @@ PHP_MINFO_FUNCTION(ldap)
php_info_print_table_start();
php_info_print_table_row(2, "LDAP Support", "enabled");
- php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.161.2.3.2.11 2007/07/17 09:09:42 jani Exp $");
+ php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.161.2.3.2.12 2007/12/31 07:20:07 sebastian Exp $");
if (LDAPG(max_links) == -1) {
snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
index 9b0627cf7..c401c3c28 100644
--- a/ext/ldap/php_ldap.h
+++ b/ext/ldap/php_ldap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ldap.h,v 1.32.2.1.2.2 2007/07/13 01:24:16 jani Exp $ */
+/* $Id: php_ldap.h,v 1.32.2.1.2.3 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_LDAP_H
#define PHP_LDAP_H
diff --git a/ext/ldap/tests/ldap_dn2ufn.phpt b/ext/ldap/tests/ldap_dn2ufn.phpt
new file mode 100644
index 000000000..50e4572d3
--- /dev/null
+++ b/ext/ldap/tests/ldap_dn2ufn.phpt
@@ -0,0 +1,33 @@
+--TEST--
+ldap_dn2ufn() test
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+/* Convert valid DN */
+var_dump(ldap_dn2ufn("cn=bob,dc=example,dc=com"));
+
+/* Convert valid DN */
+var_dump(ldap_dn2ufn("cn=bob,ou=users,dc=example,dc=com"));
+
+/* Convert DN with < > characters */
+var_dump(ldap_dn2ufn("cn=<bob>,dc=example,dc=com"));
+
+/* Too many parameters */
+ldap_dn2ufn("cn=bob,dc=example,dc=com", 1);
+
+/* Bad DN value */
+var_dump(ldap_dn2ufn("bob,dc=example,dc=com"));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+string(16) "bob, example.com"
+string(23) "bob, users, example.com"
+bool(false)
+
+Warning: Wrong parameter count for ldap_dn2ufn() in %s on line %d
+bool(false)
+Done
diff --git a/ext/ldap/tests/ldap_explode_dn.phpt b/ext/ldap/tests/ldap_explode_dn.phpt
new file mode 100644
index 000000000..f713ca31f
--- /dev/null
+++ b/ext/ldap/tests/ldap_explode_dn.phpt
@@ -0,0 +1,94 @@
+--TEST--
+ldap_explode_dn() test
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+/* Explode with attributes */
+var_dump(ldap_explode_dn("cn=bob,dc=example,dc=com", 0));
+
+/* Explode with attributes */
+var_dump(ldap_explode_dn("cn=bob,ou=users,dc=example,dc=com", 0));
+
+/* Explode without attributes */
+var_dump(ldap_explode_dn("cn=bob,dc=example,dc=com", 1));
+
+/* Explode without attributes */
+var_dump(ldap_explode_dn("cn=bob,ou=users,dc=example,dc=com", 1));
+
+/* Explode with attributes and < > characters */
+var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 0));
+
+/* Explode without attributes and < > characters */
+var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 1));
+
+/* Too few parameters */
+ldap_explode_dn("cn=bob,dc=example,dc=com");
+
+/* Too many parameters */
+ldap_explode_dn("cn=bob,dc=example,dc=com", 1, 1);
+
+/* Bad DN value with attributes */
+var_dump(ldap_explode_dn("bob,dc=example,dc=com", 0));
+
+/* Bad DN value without attributes */
+var_dump(ldap_explode_dn("bob,dc=example,dc=com", 1));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+array(4) {
+ ["count"]=>
+ int(3)
+ [0]=>
+ string(6) "cn=bob"
+ [1]=>
+ string(10) "dc=example"
+ [2]=>
+ string(6) "dc=com"
+}
+array(5) {
+ ["count"]=>
+ int(4)
+ [0]=>
+ string(6) "cn=bob"
+ [1]=>
+ string(8) "ou=users"
+ [2]=>
+ string(10) "dc=example"
+ [3]=>
+ string(6) "dc=com"
+}
+array(4) {
+ ["count"]=>
+ int(3)
+ [0]=>
+ string(3) "bob"
+ [1]=>
+ string(7) "example"
+ [2]=>
+ string(3) "com"
+}
+array(5) {
+ ["count"]=>
+ int(4)
+ [0]=>
+ string(3) "bob"
+ [1]=>
+ string(5) "users"
+ [2]=>
+ string(7) "example"
+ [3]=>
+ string(3) "com"
+}
+bool(false)
+bool(false)
+
+Warning: Wrong parameter count for ldap_explode_dn() in %s on line %d
+
+Warning: Wrong parameter count for ldap_explode_dn() in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/ldap/tests/skipif.inc b/ext/ldap/tests/skipif.inc
new file mode 100644
index 000000000..d3494284b
--- /dev/null
+++ b/ext/ldap/tests/skipif.inc
@@ -0,0 +1,5 @@
+<?php
+if (!extension_loaded('ldap')){
+ die('skip ldap extension not available');
+}
+?>
diff --git a/ext/libxml/config.w32 b/ext/libxml/config.w32
index 963960364..37ddac1ef 100644
--- a/ext/libxml/config.w32
+++ b/ext/libxml/config.w32
@@ -1,16 +1,16 @@
-// $Id: config.w32,v 1.8 2005/02/25 22:59:26 fmk Exp $
+// $Id: config.w32,v 1.8.4.1 2008/01/11 13:37:24 rrichards Exp $
// vim:ft=javascript
ARG_WITH("libxml", "LibXML support", "yes");
if (PHP_LIBXML == "yes") {
- if (CHECK_LIB("libxml2_a.lib;libxml2.lib", "libxml") &&
+ if (CHECK_LIB("libxml2_a_dll.lib;libxml2_a.lib", "libxml") &&
CHECK_LIB("iconv_a.lib;iconv.lib", "libxml") &&
CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS")) {
EXTENSION("libxml", "libxml.c", false /* never shared */);
AC_DEFINE("HAVE_LIBXML", 1, "LibXML support");
- ADD_FLAG("CFLAGS_LIBXML", "/D LIBXML_STATIC ");
+ ADD_FLAG("CFLAGS_LIBXML", "/D LIBXML_STATIC /D LIBXML_STATIC_FOR_DLL ");
if (!PHP_LIBXML_SHARED) {
ADD_DEF_FILE("ext\\libxml\\php_libxml2.def");
}
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 923194833..a715c5403 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: libxml.c,v 1.32.2.7.2.15 2007/08/01 11:43:05 tony2001 Exp $ */
+/* $Id: libxml.c,v 1.32.2.7.2.17 2008/01/30 15:29:51 rrichards Exp $ */
#define IS_EXT_MODULE
@@ -141,24 +141,6 @@ zend_module_entry libxml_module_entry = {
/* }}} */
/* {{{ internal functions for interoperability */
-static int php_libxml_dec_node(php_libxml_node_ptr *nodeptr)
-{
- int ret_refcount;
-
- ret_refcount = --nodeptr->refcount;
- if (ret_refcount == 0) {
- if (nodeptr->node != NULL && nodeptr->node->type != XML_DOCUMENT_NODE) {
- nodeptr->node->_private = NULL;
- }
- /* node is destroyed by another object. reset ret_refcount to 1 and node to NULL
- so the php_libxml_node_ptr is detroyed when the object is destroyed */
- nodeptr->refcount = 1;
- nodeptr->node = NULL;
- }
-
- return ret_refcount;
-}
-
static int php_libxml_clear_object(php_libxml_node_object *object TSRMLS_DC)
{
if (object->properties) {
@@ -179,7 +161,10 @@ static int php_libxml_unregister_node(xmlNodePtr nodep TSRMLS_DC)
if (wrapper) {
php_libxml_clear_object(wrapper TSRMLS_CC);
} else {
- php_libxml_dec_node(nodeptr);
+ if (nodeptr->node != NULL && nodeptr->node->type != XML_DOCUMENT_NODE) {
+ nodeptr->node->_private = NULL;
+ }
+ nodeptr->node = NULL;
}
}
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index f2af8c800..d5707178b 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_libxml.h,v 1.15.2.2.2.6 2007/08/01 11:43:05 tony2001 Exp $ */
+/* $Id: php_libxml.h,v 1.15.2.2.2.7 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef PHP_LIBXML_H
#define PHP_LIBXML_H
diff --git a/ext/libxml/php_libxml2.def b/ext/libxml/php_libxml2.def
index ef21f5e64..9557b3e34 100644
--- a/ext/libxml/php_libxml2.def
+++ b/ext/libxml/php_libxml2.def
@@ -1,1543 +1,1544 @@
-EXPORTS
-__docbDefaultSAXHandler
-__htmlDefaultSAXHandler
-__oldXMLWDcompatibility
-__xmlBufferAllocScheme
-__xmlDefaultBufferSize
-__xmlDefaultSAXHandler
-__xmlDefaultSAXLocator
-__xmlDeregisterNodeDefaultValue
-__xmlDoValidityCheckingDefaultValue
-xmlFree DATA
-__xmlGenericError
-__xmlGenericErrorContext
-__xmlGetWarningsDefaultValue
-__xmlIndentTreeOutput
-xmlIsBaseCharGroup DATA
-xmlIsCharGroup DATA
-xmlIsCombiningGroup DATA
-xmlIsDigitGroup DATA
-xmlIsExtenderGroup DATA
-xmlIsIdeographicGroup DATA
-xmlIsPubidChar_tab DATA
-__xmlKeepBlanksDefaultValue
-xmlLastError DATA
-__xmlLineNumbersDefaultValue
-__xmlLoadExtDtdDefaultValue
-xmlMalloc DATA
-xmlMallocAtomic DATA
-xmlMemStrdup DATA
-xmlOutputBufferCreateFilenameValue DATA
-__xmlParserDebugEntities
-xmlParserInputBufferCreateFilenameValue DATA
-xmlParserMaxDepth DATA
-__xmlParserVersion
-__xmlPedanticParserDefaultValue
-xmlRealloc DATA
-__xmlRegisterNodeDefaultValue
-__xmlSaveNoEmptyTags
-xmlStringComment DATA
-xmlStringText DATA
-xmlStringTextNoenc DATA
-xmlStructuredError DATA
-__xmlSubstituteEntitiesDefaultValue
-__xmlTreeIndentString
-xmlXPathNAN DATA
-xmlXPathNINF DATA
-xmlXPathPINF DATA
-UTF8ToHtml
-UTF8Toisolat1
-attribute
-attributeDecl
-cdataBlock
-characters
-checkNamespace
-comment
-docbCreateFileParserCtxt
-docbCreatePushParserCtxt
-docbDefaultSAXHandlerInit
-docbEncodeEntities
-docbFreeParserCtxt
-docbParseChunk
-docbParseDoc
-docbParseDocument
-docbParseFile
-docbSAXParseDoc
-docbSAXParseFile
-elementDecl
-endDocument
-endElement
-entityDecl
-externalSubset
-getColumnNumber
-getEntity
-getLineNumber
-getNamespace
-getParameterEntity
-getPublicId
-getSystemId
-globalNamespace
-hasExternalSubset
-hasInternalSubset
-htmlAttrAllowed
-htmlAutoCloseTag
-htmlCreateFileParserCtxt
-htmlCreateMemoryParserCtxt
-htmlCreatePushParserCtxt
-htmlCtxtReadDoc
-htmlCtxtReadFd
-htmlCtxtReadFile
-htmlCtxtReadIO
-htmlCtxtReadMemory
-htmlCtxtReset
-htmlCtxtUseOptions
-htmlDefaultSAXHandlerInit
-htmlDocContentDumpFormatOutput
-htmlDocContentDumpOutput
-htmlDocDump
-htmlDocDumpMemory
-htmlElementAllowedHere
-htmlElementStatusHere
-htmlEncodeEntities
-htmlEntityLookup
-htmlEntityValueLookup
-htmlFreeParserCtxt
-htmlGetMetaEncoding
-htmlHandleOmittedElem
-htmlInitAutoClose
-htmlIsAutoClosed
-htmlIsBooleanAttr
-htmlIsScriptAttribute
-htmlNewDoc
-htmlNewDocNoDtD
-htmlNodeDump
-htmlNodeDumpFile
-htmlNodeDumpFileFormat
-htmlNodeDumpFormatOutput
-htmlNodeDumpOutput
-htmlNodeStatus
-htmlParseCharRef
-htmlParseChunk
-htmlParseDoc
-htmlParseDocument
-htmlParseElement
-htmlParseEntityRef
-htmlParseFile
-htmlReadDoc
-htmlReadFd
-htmlReadFile
-htmlReadIO
-htmlReadMemory
-htmlSAXParseDoc
-htmlSAXParseFile
-htmlSaveFile
-htmlSaveFileEnc
-htmlSaveFileFormat
-htmlSetMetaEncoding
-htmlTagLookup
-ignorableWhitespace
-initGenericErrorDefaultFunc
-initdocbDefaultSAXHandler
-inithtmlDefaultSAXHandler
-initxmlDefaultSAXHandler
-inputPop
-inputPush
-internalSubset
-isStandalone
-isolat1ToUTF8
-namePop
-namePush
-namespaceDecl
-nodePop
-nodePush
-notationDecl
-processingInstruction
-reference
-resolveEntity
-setDocumentLocator
-setNamespace
-startDocument
-startElement
-unparsedEntityDecl
-valuePop
-valuePush
-xmlACatalogAdd
-xmlACatalogDump
-xmlACatalogRemove
-xmlACatalogResolve
-xmlACatalogResolvePublic
-xmlACatalogResolveSystem
-xmlACatalogResolveURI
-xmlAddAttributeDecl
-xmlAddChild
-xmlAddChildList
-xmlAddDocEntity
-xmlAddDtdEntity
-xmlAddElementDecl
-xmlAddEncodingAlias
-xmlAddID
-xmlAddNextSibling
-xmlAddNotationDecl
-xmlAddPrevSibling
-xmlAddRef
-xmlAddSibling
-xmlAllocOutputBuffer
-xmlAllocParserInputBuffer
-xmlAttrSerializeTxtContent
-xmlAutomataCompile
-xmlAutomataGetInitState
-xmlAutomataIsDeterminist
-xmlAutomataNewAllTrans
-xmlAutomataNewCountTrans
-xmlAutomataNewCountTrans2
-xmlAutomataNewCountedTrans
-xmlAutomataNewCounter
-xmlAutomataNewCounterTrans
-xmlAutomataNewEpsilon
-xmlAutomataNewOnceTrans
-xmlAutomataNewOnceTrans2
-xmlAutomataNewState
-xmlAutomataNewTransition
-xmlAutomataNewTransition2
-xmlAutomataSetFinalState
-xmlBoolToText
-xmlBufferAdd
-xmlBufferAddHead
-xmlBufferCCat
-xmlBufferCat
-xmlBufferContent
-xmlBufferCreate
-xmlBufferCreateSize
-xmlBufferCreateStatic
-xmlBufferDump
-xmlBufferEmpty
-xmlBufferFree
-xmlBufferGrow
-xmlBufferLength
-xmlBufferResize
-xmlBufferSetAllocationScheme
-xmlBufferShrink
-xmlBufferWriteCHAR
-xmlBufferWriteChar
-xmlBufferWriteQuotedString
-xmlBuildQName
-xmlBuildRelativeURI
-xmlBuildURI
-xmlByteConsumed
-xmlC14NDocDumpMemory
-xmlC14NDocSave
-xmlC14NDocSaveTo
-xmlC14NExecute
-xmlCanonicPath
-xmlCatalogAdd
-xmlCatalogAddLocal
-xmlCatalogCleanup
-xmlCatalogConvert
-xmlCatalogDump
-xmlCatalogFreeLocal
-xmlCatalogGetDefaults
-xmlCatalogGetPublic
-xmlCatalogGetSystem
-xmlCatalogIsEmpty
-xmlCatalogLocalResolve
-xmlCatalogLocalResolveURI
-xmlCatalogRemove
-xmlCatalogResolve
-xmlCatalogResolvePublic
-xmlCatalogResolveSystem
-xmlCatalogResolveURI
-xmlCatalogSetDebug
-xmlCatalogSetDefaultPrefer
-xmlCatalogSetDefaults
-xmlCharEncCloseFunc
-xmlCharEncFirstLine
-xmlCharEncInFunc
-xmlCharEncOutFunc
-xmlCharInRange
-xmlCharStrdup
-xmlCharStrndup
-xmlCheckFilename
-xmlCheckHTTPInput
-xmlCheckLanguageID
-xmlCheckUTF8
-xmlCheckVersion
-xmlCleanupCharEncodingHandlers
-xmlCleanupEncodingAliases
-xmlCleanupGlobals
-xmlCleanupInputCallbacks
-xmlCleanupMemory
-xmlCleanupOutputCallbacks
-xmlCleanupParser
-xmlCleanupPredefinedEntities
-xmlCleanupThreads
-xmlClearNodeInfoSeq
-xmlClearParserCtxt
-xmlConvertSGMLCatalog
-xmlCopyAttributeTable
-xmlCopyChar
-xmlCopyCharMultiByte
-xmlCopyDoc
-xmlCopyDtd
-xmlCopyElementContent
-xmlCopyElementTable
-xmlCopyEntitiesTable
-xmlCopyEnumeration
-xmlCopyError
-xmlCopyNamespace
-xmlCopyNamespaceList
-xmlCopyNode
-xmlCopyNodeList
-xmlCopyNotationTable
-xmlCopyProp
-xmlCopyPropList
-xmlCreateDocParserCtxt
-xmlCreateEntitiesTable
-xmlCreateEntityParserCtxt
-xmlCreateEnumeration
-xmlCreateFileParserCtxt
-xmlCreateIOParserCtxt
-xmlCreateIntSubset
-xmlCreateMemoryParserCtxt
-xmlCreatePushParserCtxt
-xmlCreateURI
-xmlCreateURLParserCtxt
-xmlCtxtGetLastError
-xmlCtxtReadDoc
-xmlCtxtReadFd
-xmlCtxtReadFile
-xmlCtxtReadIO
-xmlCtxtReadMemory
-xmlCtxtReset
-xmlCtxtResetLastError
-xmlCtxtResetPush
-xmlCtxtUseOptions
-xmlCurrentChar
-xmlDebugCheckDocument
-xmlDebugDumpAttr
-xmlDebugDumpAttrList
-xmlDebugDumpDTD
-xmlDebugDumpDocument
-xmlDebugDumpDocumentHead
-xmlDebugDumpEntities
-xmlDebugDumpNode
-xmlDebugDumpNodeList
-xmlDebugDumpOneNode
-xmlDebugDumpString
-xmlDecodeEntities
-xmlDefaultSAXHandlerInit
-xmlDelEncodingAlias
-xmlDeregisterNodeDefault
-xmlDetectCharEncoding
-xmlDictCreate
-xmlDictCreateSub
-xmlDictFree
-xmlDictLookup
-xmlDictOwns
-xmlDictQLookup
-xmlDictReference
-xmlDictSize
-xmlDocCopyNode
-xmlDocCopyNodeList
-xmlDocDump
-xmlDocDumpFormatMemory
-xmlDocDumpFormatMemoryEnc
-xmlDocDumpMemory
-xmlDocDumpMemoryEnc
-xmlDocFormatDump
-xmlDocGetRootElement
-xmlDocSetRootElement
-xmlDumpAttributeDecl
-xmlDumpAttributeTable
-xmlDumpElementDecl
-xmlDumpElementTable
-xmlDumpEntitiesTable
-xmlDumpEntityDecl
-xmlDumpNotationDecl
-xmlDumpNotationTable
-xmlElemDump
-xmlEncodeEntities
-xmlEncodeEntitiesReentrant
-xmlEncodeSpecialChars
-xmlErrMemory
-xmlFileClose
-xmlFileMatch
-xmlFileOpen
-xmlFileRead
-xmlFindCharEncodingHandler
-xmlFreeAttributeTable
-xmlFreeAutomata
-xmlFreeCatalog
-xmlFreeDoc
-xmlFreeDtd
-xmlFreeElementContent
-xmlFreeElementTable
-xmlFreeEntitiesTable
-xmlFreeEnumeration
-xmlFreeIDTable
-xmlFreeInputStream
-xmlFreeMutex
-xmlFreeNode
-xmlFreeNodeList
-xmlFreeNotationTable
-xmlFreeNs
-xmlFreeNsList
-xmlFreeParserCtxt
-xmlFreeParserInputBuffer
-xmlFreePattern
-xmlFreePatternList
-xmlFreeProp
-xmlFreePropList
-xmlFreeRMutex
-xmlFreeRefTable
-xmlFreeTextReader
-xmlFreeTextWriter
-xmlFreeURI
-xmlFreeValidCtxt
-xmlGcMemGet
-xmlGcMemSetup
-xmlGetBufferAllocationScheme
-xmlGetCharEncodingHandler
-xmlGetCharEncodingName
-xmlGetCompressMode
-xmlGetDocCompressMode
-xmlGetDocEntity
-xmlGetDtdAttrDesc
-xmlGetDtdElementDesc
-xmlGetDtdEntity
-xmlGetDtdNotationDesc
-xmlGetDtdQAttrDesc
-xmlGetDtdQElementDesc
-xmlGetEncodingAlias
-xmlGetExternalEntityLoader
-xmlGetFeature
-xmlGetFeaturesList
-xmlGetGlobalState
-xmlGetID
-xmlGetIntSubset
-xmlGetLastChild
-xmlGetLastError
-xmlGetLineNo
-xmlGetNoNsProp
-xmlGetNodePath
-xmlGetNsList
-xmlGetNsProp
-xmlGetParameterEntity
-xmlGetPredefinedEntity
-xmlGetProp
-xmlGetRefs
-xmlGetThreadId
-xmlGetUTF8Char
-xmlHandleEntity
-xmlHasNsProp
-xmlHasProp
-xmlHashAddEntry
-xmlHashAddEntry2
-xmlHashAddEntry3
-xmlHashCopy
-xmlHashCreate
-xmlHashFree
-xmlHashLookup
-xmlHashLookup2
-xmlHashLookup3
-xmlHashQLookup
-xmlHashQLookup2
-xmlHashQLookup3
-xmlHashRemoveEntry
-xmlHashRemoveEntry2
-xmlHashRemoveEntry3
-xmlHashScan
-xmlHashScan3
-xmlHashScanFull
-xmlHashScanFull3
-xmlHashSize
-xmlHashUpdateEntry
-xmlHashUpdateEntry2
-xmlHashUpdateEntry3
-xmlIOFTPClose
-xmlIOFTPMatch
-xmlIOFTPOpen
-xmlIOFTPRead
-xmlIOHTTPClose
-xmlIOHTTPMatch
-xmlIOHTTPOpen
-xmlIOHTTPOpenW
-xmlIOHTTPRead
-xmlIOParseDTD
-xmlInitCharEncodingHandlers
-xmlInitGlobals
-xmlInitMemory
-xmlInitNodeInfoSeq
-xmlInitParser
-xmlInitParserCtxt
-xmlInitThreads
-xmlInitializeCatalog
-xmlInitializeGlobalState
-xmlInitializePredefinedEntities
-xmlIsBaseChar
-xmlIsBlank
-xmlIsBlankNode
-xmlIsChar
-xmlIsCombining
-xmlIsDigit
-xmlIsExtender
-xmlIsID
-xmlIsIdeographic
-xmlIsLetter
-xmlIsMainThread
-xmlIsMixedElement
-xmlIsPubidChar
-xmlIsRef
-xmlIsXHTML
-xmlKeepBlanksDefault
-xmlLineNumbersDefault
-xmlLinkGetData
-xmlListAppend
-xmlListClear
-xmlListCopy
-xmlListCreate
-xmlListDelete
-xmlListDup
-xmlListEmpty
-xmlListEnd
-xmlListFront
-xmlListInsert
-xmlListMerge
-xmlListPopBack
-xmlListPopFront
-xmlListPushBack
-xmlListPushFront
-xmlListRemoveAll
-xmlListRemoveFirst
-xmlListRemoveLast
-xmlListReverse
-xmlListReverseSearch
-xmlListReverseWalk
-xmlListSearch
-xmlListSize
-xmlListSort
-xmlListWalk
-xmlLoadACatalog
-xmlLoadCatalog
-xmlLoadCatalogs
-xmlLoadExternalEntity
-xmlLoadSGMLSuperCatalog
-xmlLockLibrary
-xmlLsCountNode
-xmlLsOneNode
-xmlMallocAtomicLoc
-xmlMallocLoc
-xmlMemBlocks
-xmlMemDisplay
-xmlMemFree
-xmlMemGet
-xmlMemMalloc
-xmlMemRealloc
-xmlMemSetup
-xmlMemShow
-xmlMemStrdupLoc
-xmlMemUsed
-xmlMemoryDump
-xmlMemoryStrdup
-xmlModuleClose
-xmlModuleFree
-xmlModuleOpen
-xmlModuleSymbol
-xmlMutexLock
-xmlMutexUnlock
-xmlNamespaceParseNCName
-xmlNamespaceParseNSDef
-xmlNamespaceParseQName
-xmlNanoFTPCheckResponse
-xmlNanoFTPCleanup
-xmlNanoFTPClose
-xmlNanoFTPCloseConnection
-xmlNanoFTPConnect
-xmlNanoFTPConnectTo
-xmlNanoFTPCwd
-xmlNanoFTPDele
-xmlNanoFTPFreeCtxt
-xmlNanoFTPGet
-xmlNanoFTPGetConnection
-xmlNanoFTPGetResponse
-xmlNanoFTPGetSocket
-xmlNanoFTPInit
-xmlNanoFTPList
-xmlNanoFTPNewCtxt
-xmlNanoFTPOpen
-xmlNanoFTPProxy
-xmlNanoFTPQuit
-xmlNanoFTPRead
-xmlNanoFTPScanProxy
-xmlNanoFTPUpdateURL
-xmlNanoHTTPAuthHeader
-xmlNanoHTTPCleanup
-xmlNanoHTTPClose
-xmlNanoHTTPContentLength
-xmlNanoHTTPEncoding
-xmlNanoHTTPFetch
-xmlNanoHTTPInit
-xmlNanoHTTPMethod
-xmlNanoHTTPMethodRedir
-xmlNanoHTTPMimeType
-xmlNanoHTTPOpen
-xmlNanoHTTPOpenRedir
-xmlNanoHTTPRead
-xmlNanoHTTPRedir
-xmlNanoHTTPReturnCode
-xmlNanoHTTPSave
-xmlNanoHTTPScanProxy
-xmlNewAutomata
-xmlNewCDataBlock
-xmlNewCatalog
-xmlNewCharEncodingHandler
-xmlNewCharRef
-xmlNewChild
-xmlNewComment
-xmlNewDoc
-xmlNewDocComment
-xmlNewDocFragment
-xmlNewDocNode
-xmlNewDocNodeEatName
-xmlNewDocPI
-xmlNewDocProp
-xmlNewDocRawNode
-xmlNewDocText
-xmlNewDocTextLen
-xmlNewDtd
-xmlNewElementContent
-xmlNewEntityInputStream
-xmlNewGlobalNs
-xmlNewIOInputStream
-xmlNewInputFromFile
-xmlNewInputStream
-xmlNewMutex
-xmlNewNode
-xmlNewNodeEatName
-xmlNewNs
-xmlNewNsProp
-xmlNewNsPropEatName
-xmlNewPI
-xmlNewParserCtxt
-xmlNewProp
-xmlNewRMutex
-xmlNewReference
-xmlNewStringInputStream
-xmlNewText
-xmlNewTextChild
-xmlNewTextLen
-xmlNewTextReader
-xmlNewTextReaderFilename
-xmlNewTextWriter
-xmlNewTextWriterDoc
-xmlNewTextWriterFilename
-xmlNewTextWriterMemory
-xmlNewTextWriterPushParser
-xmlNewTextWriterTree
-xmlNewValidCtxt
-xmlNextChar
-xmlNoNetExternalEntityLoader
-xmlNodeAddContent
-xmlNodeAddContentLen
-xmlNodeBufGetContent
-xmlNodeDump
-xmlNodeDumpOutput
-xmlNodeGetBase
-xmlNodeGetContent
-xmlNodeGetLang
-xmlNodeGetSpacePreserve
-xmlNodeIsText
-xmlNodeListGetRawString
-xmlNodeListGetString
-xmlNodeSetBase
-xmlNodeSetContent
-xmlNodeSetContentLen
-xmlNodeSetLang
-xmlNodeSetName
-xmlNodeSetSpacePreserve
-xmlNormalizeURIPath
-xmlNormalizeWindowsPath
-xmlOutputBufferClose
-xmlOutputBufferCreateFd
-xmlOutputBufferCreateFile
-xmlOutputBufferCreateFilename
-xmlOutputBufferCreateFilenameDefault
-xmlOutputBufferCreateIO
-xmlOutputBufferFlush
-xmlOutputBufferWrite
-xmlOutputBufferWriteEscape
-xmlOutputBufferWriteString
-xmlParseAttValue
-xmlParseAttribute
-xmlParseAttributeListDecl
-xmlParseAttributeType
-xmlParseBalancedChunkMemory
-xmlParseBalancedChunkMemoryRecover
-xmlParseCDSect
-xmlParseCatalogFile
-xmlParseCharData
-xmlParseCharEncoding
-xmlParseCharRef
-xmlParseChunk
-xmlParseComment
-xmlParseContent
-xmlParseCtxtExternalEntity
-xmlParseDTD
-xmlParseDefaultDecl
-xmlParseDoc
-xmlParseDocTypeDecl
-xmlParseDocument
-xmlParseElement
-xmlParseElementChildrenContentDecl
-xmlParseElementContentDecl
-xmlParseElementDecl
-xmlParseElementMixedContentDecl
-xmlParseEncName
-xmlParseEncodingDecl
-xmlParseEndTag
-xmlParseEntity
-xmlParseEntityDecl
-xmlParseEntityRef
-xmlParseEntityValue
-xmlParseEnumeratedType
-xmlParseEnumerationType
-xmlParseExtParsedEnt
-xmlParseExternalEntity
-xmlParseExternalID
-xmlParseExternalSubset
-xmlParseFile
-xmlParseInNodeContext
-xmlParseMarkupDecl
-xmlParseMemory
-xmlParseMisc
-xmlParseName
-xmlParseNamespace
-xmlParseNmtoken
-xmlParseNotationDecl
-xmlParseNotationType
-xmlParsePEReference
-xmlParsePI
-xmlParsePITarget
-xmlParsePubidLiteral
-xmlParseQuotedString
-xmlParseReference
-xmlParseSDDecl
-xmlParseStartTag
-xmlParseSystemLiteral
-xmlParseTextDecl
-xmlParseURI
-xmlParseURIReference
-xmlParseVersionInfo
-xmlParseVersionNum
-xmlParseXMLDecl
-xmlParserAddNodeInfo
-xmlParserError
-xmlParserFindNodeInfo
-xmlParserFindNodeInfoIndex
-xmlParserGetDirectory
-xmlParserHandlePEReference
-xmlParserHandleReference
-xmlParserInputBufferCreateFd
-xmlParserInputBufferCreateFile
-xmlParserInputBufferCreateFilename
-xmlParserInputBufferCreateFilenameDefault
-xmlParserInputBufferCreateIO
-xmlParserInputBufferCreateMem
-xmlParserInputBufferCreateStatic
-xmlParserInputBufferGrow
-xmlParserInputBufferPush
-xmlParserInputBufferRead
-xmlParserInputGrow
-xmlParserInputRead
-xmlParserInputShrink
-xmlParserPrintFileContext
-xmlParserPrintFileInfo
-xmlParserValidityError
-xmlParserValidityWarning
-xmlParserWarning
-xmlPatternMatch
-xmlPatterncompile
-xmlPedanticParserDefault
-xmlPopInput
-xmlPopInputCallbacks
-xmlPrintURI
-xmlPushInput
-xmlRMutexLock
-xmlRMutexUnlock
-xmlReadDoc
-xmlReadFd
-xmlReadFile
-xmlReadIO
-xmlReadMemory
-xmlReaderForDoc
-xmlReaderForFd
-xmlReaderForFile
-xmlReaderForIO
-xmlReaderForMemory
-xmlReaderNewDoc
-xmlReaderNewFd
-xmlReaderNewFile
-xmlReaderNewIO
-xmlReaderNewMemory
-xmlReaderNewWalker
-xmlReaderWalker
-xmlReallocLoc
-xmlReconciliateNs
-xmlRecoverDoc
-xmlRecoverFile
-xmlRecoverMemory
-xmlRegExecPushString
-xmlRegExecPushString2
-xmlRegFreeExecCtxt
-xmlRegFreeRegexp
-xmlRegNewExecCtxt
-xmlRegexpCompile
-xmlRegexpExec
-xmlRegexpIsDeterminist
-xmlRegexpPrint
-xmlRegisterCharEncodingHandler
-xmlRegisterDefaultInputCallbacks
-xmlRegisterDefaultOutputCallbacks
-xmlRegisterHTTPPostCallbacks
-xmlRegisterInputCallbacks
-xmlRegisterNodeDefault
-xmlRegisterOutputCallbacks
-xmlRelaxNGCleanupTypes
-xmlRelaxNGDump
-xmlRelaxNGDumpTree
-xmlRelaxNGFree
-xmlRelaxNGFreeParserCtxt
-xmlRelaxNGFreeValidCtxt
-xmlRelaxNGGetParserErrors
-xmlRelaxNGGetValidErrors
-xmlRelaxNGInitTypes
-xmlRelaxNGNewDocParserCtxt
-xmlRelaxNGNewMemParserCtxt
-xmlRelaxNGNewParserCtxt
-xmlRelaxNGNewValidCtxt
-xmlRelaxNGParse
-xmlRelaxNGSetParserErrors
-xmlRelaxNGSetValidErrors
-xmlRelaxNGValidateDoc
-xmlRelaxNGValidateFullElement
-xmlRelaxNGValidatePopElement
-xmlRelaxNGValidatePushCData
-xmlRelaxNGValidatePushElement
-xmlRelaxParserSetFlag
-xmlRemoveID
-xmlRemoveProp
-xmlRemoveRef
-xmlReplaceNode
-xmlResetError
-xmlResetLastError
-xmlSAX2AttributeDecl
-xmlSAX2CDataBlock
-xmlSAX2Characters
-xmlSAX2Comment
-xmlSAX2ElementDecl
-xmlSAX2EndDocument
-xmlSAX2EndElement
-xmlSAX2EndElementNs
-xmlSAX2EntityDecl
-xmlSAX2ExternalSubset
-xmlSAX2GetColumnNumber
-xmlSAX2GetEntity
-xmlSAX2GetLineNumber
-xmlSAX2GetParameterEntity
-xmlSAX2GetPublicId
-xmlSAX2GetSystemId
-xmlSAX2HasExternalSubset
-xmlSAX2HasInternalSubset
-xmlSAX2IgnorableWhitespace
-xmlSAX2InitDefaultSAXHandler
-xmlSAX2InitDocbDefaultSAXHandler
-xmlSAX2InitHtmlDefaultSAXHandler
-xmlSAX2InternalSubset
-xmlSAX2IsStandalone
-xmlSAX2NotationDecl
-xmlSAX2ProcessingInstruction
-xmlSAX2Reference
-xmlSAX2ResolveEntity
-xmlSAX2SetDocumentLocator
-xmlSAX2StartDocument
-xmlSAX2StartElement
-xmlSAX2StartElementNs
-xmlSAX2UnparsedEntityDecl
-xmlSAXDefaultVersion
-xmlSAXParseDTD
-xmlSAXParseDoc
-xmlSAXParseEntity
-xmlSAXParseFile
-xmlSAXParseFileWithData
-xmlSAXParseMemory
-xmlSAXParseMemoryWithData
-xmlSAXUserParseFile
-xmlSAXUserParseMemory
-xmlSAXVersion
-xmlSaveClose
-xmlSaveDoc
-xmlSaveFile
-xmlSaveFileEnc
-xmlSaveFileTo
-xmlSaveFlush
-xmlSaveFormatFile
-xmlSaveFormatFileEnc
-xmlSaveFormatFileTo
-xmlSaveSetAttrEscape
-xmlSaveSetEscape
-xmlSaveToFd
-xmlSaveToFilename
-xmlSaveToIO
-xmlSaveTree
-xmlSaveUri
-xmlScanName
-xmlSchemaCheckFacet
-xmlSchemaCleanupTypes
-xmlSchemaCollapseString
-xmlSchemaCompareValues
-xmlSchemaDump
-xmlSchemaFree
-xmlSchemaFreeFacet
-xmlSchemaFreeParserCtxt
-xmlSchemaFreeType
-xmlSchemaFreeValidCtxt
-xmlSchemaFreeValue
-xmlSchemaFreeWildcard
-xmlSchemaGetBuiltInListSimpleTypeItemType
-xmlSchemaGetBuiltInType
-xmlSchemaGetFacetValueAsULong
-xmlSchemaGetParserErrors
-xmlSchemaGetPredefinedType
-xmlSchemaGetValidErrors
-xmlSchemaInitTypes
-xmlSchemaIsBuiltInTypeFacet
-xmlSchemaNewDocParserCtxt
-xmlSchemaNewFacet
-xmlSchemaNewMemParserCtxt
-xmlSchemaNewParserCtxt
-xmlSchemaNewValidCtxt
-xmlSchemaParse
-xmlSchemaSetParserErrors
-xmlSchemaSetValidErrors
-xmlSchemaSetValidOptions
-xmlSchemaValPredefTypeNode
-xmlSchemaValPredefTypeNodeNoNorm
-xmlSchemaValidCtxtGetOptions
-xmlSchemaValidateDoc
-xmlSchemaValidateFacet
-xmlSchemaValidateLengthFacet
-xmlSchemaValidateListSimpleTypeFacet
-xmlSchemaValidateOneElement
-xmlSchemaValidatePredefinedType
-xmlSchemaValidateStream
-xmlSearchNs
-xmlSearchNsByHref
-xmlSetBufferAllocationScheme
-xmlSetCompressMode
-xmlSetDocCompressMode
-xmlSetEntityReferenceFunc
-xmlSetExternalEntityLoader
-xmlSetFeature
-xmlSetGenericErrorFunc
-xmlSetListDoc
-xmlSetNs
-xmlSetNsProp
-xmlSetProp
-xmlSetStructuredErrorFunc
-xmlSetTreeDoc
-xmlSetupParserForBuffer
-xmlShell
-xmlShellBase
-xmlShellCat
-xmlShellDir
-xmlShellDu
-xmlShellList
-xmlShellLoad
-xmlShellPrintNode
-xmlShellPrintXPathError
-xmlShellPrintXPathResult
-xmlShellPwd
-xmlShellSave
-xmlShellValidate
-xmlShellWrite
-xmlSkipBlankChars
-xmlSnprintfElementContent
-xmlSplitQName
-xmlSplitQName2
-xmlSplitQName3
-xmlSprintfElementContent
-xmlStopParser
-xmlStrEqual
-xmlStrPrintf
-xmlStrQEqual
-xmlStrVPrintf
-xmlStrcasecmp
-xmlStrcasestr
-xmlStrcat
-xmlStrchr
-xmlStrcmp
-xmlStrdup
-xmlStringCurrentChar
-xmlStringDecodeEntities
-xmlStringGetNodeList
-xmlStringLenDecodeEntities
-xmlStringLenGetNodeList
-xmlStrlen
-xmlStrncasecmp
-xmlStrncat
-xmlStrncatNew
-xmlStrncmp
-xmlStrndup
-xmlStrstr
-xmlStrsub
-xmlSubstituteEntitiesDefault
-xmlSwitchEncoding
-xmlSwitchInputEncoding
-xmlSwitchToEncoding
-xmlTextConcat
-xmlTextMerge
-xmlTextReaderAttributeCount
-xmlTextReaderBaseUri
-xmlTextReaderClose
-xmlTextReaderConstBaseUri
-xmlTextReaderConstEncoding
-xmlTextReaderConstLocalName
-xmlTextReaderConstName
-xmlTextReaderConstNamespaceUri
-xmlTextReaderConstPrefix
-xmlTextReaderConstString
-xmlTextReaderConstValue
-xmlTextReaderConstXmlLang
-xmlTextReaderConstXmlVersion
-xmlTextReaderCurrentDoc
-xmlTextReaderCurrentNode
-xmlTextReaderDepth
-xmlTextReaderExpand
-xmlTextReaderGetAttribute
-xmlTextReaderGetAttributeNo
-xmlTextReaderGetAttributeNs
-xmlTextReaderGetErrorHandler
-xmlTextReaderGetParserProp
-xmlTextReaderGetRemainder
-xmlTextReaderHasAttributes
-xmlTextReaderHasValue
-xmlTextReaderIsDefault
-xmlTextReaderIsEmptyElement
-xmlTextReaderIsNamespaceDecl
-xmlTextReaderIsValid
-xmlTextReaderLocalName
-xmlTextReaderLocatorBaseURI
-xmlTextReaderLocatorLineNumber
-xmlTextReaderLookupNamespace
-xmlTextReaderMoveToAttribute
-xmlTextReaderMoveToAttributeNo
-xmlTextReaderMoveToAttributeNs
-xmlTextReaderMoveToElement
-xmlTextReaderMoveToFirstAttribute
-xmlTextReaderMoveToNextAttribute
-xmlTextReaderName
-xmlTextReaderNamespaceUri
-xmlTextReaderNext
-xmlTextReaderNextSibling
-xmlTextReaderNodeType
-xmlTextReaderNormalization
-xmlTextReaderPrefix
-xmlTextReaderPreserve
-xmlTextReaderPreservePattern
-xmlTextReaderQuoteChar
-xmlTextReaderRead
-xmlTextReaderReadAttributeValue
-xmlTextReaderReadInnerXml
-xmlTextReaderReadOuterXml
-xmlTextReaderReadState
-xmlTextReaderReadString
-xmlTextReaderRelaxNGSetSchema
-xmlTextReaderRelaxNGValidate
-xmlTextReaderSetErrorHandler
-xmlTextReaderSetParserProp
-xmlTextReaderSetStructuredErrorHandler
-xmlTextReaderStandalone
-xmlTextReaderValue
-xmlTextReaderXmlLang
-xmlTextWriterEndAttribute
-xmlTextWriterEndCDATA
-xmlTextWriterEndComment
-xmlTextWriterEndDTD
-xmlTextWriterEndDTDAttlist
-xmlTextWriterEndDTDElement
-xmlTextWriterEndDTDEntity
-xmlTextWriterEndDocument
-xmlTextWriterEndElement
-xmlTextWriterEndPI
-xmlTextWriterFlush
-xmlTextWriterFullEndElement
-xmlTextWriterSetIndent
-xmlTextWriterSetIndentString
-xmlTextWriterStartAttribute
-xmlTextWriterStartAttributeNS
-xmlTextWriterStartCDATA
-xmlTextWriterStartComment
-xmlTextWriterStartDTD
-xmlTextWriterStartDTDAttlist
-xmlTextWriterStartDTDElement
-xmlTextWriterStartDTDEntity
-xmlTextWriterStartDocument
-xmlTextWriterStartElement
-xmlTextWriterStartElementNS
-xmlTextWriterStartPI
-xmlTextWriterWriteAttribute
-xmlTextWriterWriteAttributeNS
-xmlTextWriterWriteBase64
-xmlTextWriterWriteBinHex
-xmlTextWriterWriteCDATA
-xmlTextWriterWriteComment
-xmlTextWriterWriteDTD
-xmlTextWriterWriteDTDAttlist
-xmlTextWriterWriteDTDElement
-xmlTextWriterWriteDTDEntity
-xmlTextWriterWriteDTDExternalEntity
-xmlTextWriterWriteDTDExternalEntityContents
-xmlTextWriterWriteDTDInternalEntity
-xmlTextWriterWriteDTDNotation
-xmlTextWriterWriteElement
-xmlTextWriterWriteElementNS
-xmlTextWriterWriteFormatAttribute
-xmlTextWriterWriteFormatAttributeNS
-xmlTextWriterWriteFormatCDATA
-xmlTextWriterWriteFormatComment
-xmlTextWriterWriteFormatDTD
-xmlTextWriterWriteFormatDTDAttlist
-xmlTextWriterWriteFormatDTDElement
-xmlTextWriterWriteFormatDTDInternalEntity
-xmlTextWriterWriteFormatElement
-xmlTextWriterWriteFormatElementNS
-xmlTextWriterWriteFormatPI
-xmlTextWriterWriteFormatRaw
-xmlTextWriterWriteFormatString
-xmlTextWriterWritePI
-xmlTextWriterWriteRaw
-xmlTextWriterWriteRawLen
-xmlTextWriterWriteString
-xmlTextWriterWriteVFormatAttribute
-xmlTextWriterWriteVFormatAttributeNS
-xmlTextWriterWriteVFormatCDATA
-xmlTextWriterWriteVFormatComment
-xmlTextWriterWriteVFormatDTD
-xmlTextWriterWriteVFormatDTDAttlist
-xmlTextWriterWriteVFormatDTDElement
-xmlTextWriterWriteVFormatDTDInternalEntity
-xmlTextWriterWriteVFormatElement
-xmlTextWriterWriteVFormatElementNS
-xmlTextWriterWriteVFormatPI
-xmlTextWriterWriteVFormatRaw
-xmlTextWriterWriteVFormatString
-xmlThrDefBufferAllocScheme
-xmlThrDefDefaultBufferSize
-xmlThrDefDeregisterNodeDefault
-xmlThrDefDoValidityCheckingDefaultValue
-xmlThrDefGetWarningsDefaultValue
-xmlThrDefIndentTreeOutput
-xmlThrDefKeepBlanksDefaultValue
-xmlThrDefLineNumbersDefaultValue
-xmlThrDefLoadExtDtdDefaultValue
-xmlThrDefOutputBufferCreateFilenameDefault
-xmlThrDefParserDebugEntities
-xmlThrDefParserInputBufferCreateFilenameDefault
-xmlThrDefPedanticParserDefaultValue
-xmlThrDefRegisterNodeDefault
-xmlThrDefSaveNoEmptyTags
-xmlThrDefSetGenericErrorFunc
-xmlThrDefSetStructuredErrorFunc
-xmlThrDefSubstituteEntitiesDefaultValue
-xmlThrDefTreeIndentString
-xmlUCSIsAegeanNumbers
-xmlUCSIsAlphabeticPresentationForms
-xmlUCSIsArabic
-xmlUCSIsArabicPresentationFormsA
-xmlUCSIsArabicPresentationFormsB
-xmlUCSIsArmenian
-xmlUCSIsArrows
-xmlUCSIsBasicLatin
-xmlUCSIsBengali
-xmlUCSIsBlock
-xmlUCSIsBlockElements
-xmlUCSIsBopomofo
-xmlUCSIsBopomofoExtended
-xmlUCSIsBoxDrawing
-xmlUCSIsBraillePatterns
-xmlUCSIsBuhid
-xmlUCSIsByzantineMusicalSymbols
-xmlUCSIsCJKCompatibility
-xmlUCSIsCJKCompatibilityForms
-xmlUCSIsCJKCompatibilityIdeographs
-xmlUCSIsCJKCompatibilityIdeographsSupplement
-xmlUCSIsCJKRadicalsSupplement
-xmlUCSIsCJKSymbolsandPunctuation
-xmlUCSIsCJKUnifiedIdeographs
-xmlUCSIsCJKUnifiedIdeographsExtensionA
-xmlUCSIsCJKUnifiedIdeographsExtensionB
-xmlUCSIsCat
-xmlUCSIsCatC
-xmlUCSIsCatCc
-xmlUCSIsCatCf
-xmlUCSIsCatCo
-xmlUCSIsCatCs
-xmlUCSIsCatL
-xmlUCSIsCatLl
-xmlUCSIsCatLm
-xmlUCSIsCatLo
-xmlUCSIsCatLt
-xmlUCSIsCatLu
-xmlUCSIsCatM
-xmlUCSIsCatMc
-xmlUCSIsCatMe
-xmlUCSIsCatMn
-xmlUCSIsCatN
-xmlUCSIsCatNd
-xmlUCSIsCatNl
-xmlUCSIsCatNo
-xmlUCSIsCatP
-xmlUCSIsCatPc
-xmlUCSIsCatPd
-xmlUCSIsCatPe
-xmlUCSIsCatPf
-xmlUCSIsCatPi
-xmlUCSIsCatPo
-xmlUCSIsCatPs
-xmlUCSIsCatS
-xmlUCSIsCatSc
-xmlUCSIsCatSk
-xmlUCSIsCatSm
-xmlUCSIsCatSo
-xmlUCSIsCatZ
-xmlUCSIsCatZl
-xmlUCSIsCatZp
-xmlUCSIsCatZs
-xmlUCSIsCherokee
-xmlUCSIsCombiningDiacriticalMarks
-xmlUCSIsCombiningDiacriticalMarksforSymbols
-xmlUCSIsCombiningHalfMarks
-xmlUCSIsCombiningMarksforSymbols
-xmlUCSIsControlPictures
-xmlUCSIsCurrencySymbols
-xmlUCSIsCypriotSyllabary
-xmlUCSIsCyrillic
-xmlUCSIsCyrillicSupplement
-xmlUCSIsDeseret
-xmlUCSIsDevanagari
-xmlUCSIsDingbats
-xmlUCSIsEnclosedAlphanumerics
-xmlUCSIsEnclosedCJKLettersandMonths
-xmlUCSIsEthiopic
-xmlUCSIsGeneralPunctuation
-xmlUCSIsGeometricShapes
-xmlUCSIsGeorgian
-xmlUCSIsGothic
-xmlUCSIsGreek
-xmlUCSIsGreekExtended
-xmlUCSIsGreekandCoptic
-xmlUCSIsGujarati
-xmlUCSIsGurmukhi
-xmlUCSIsHalfwidthandFullwidthForms
-xmlUCSIsHangulCompatibilityJamo
-xmlUCSIsHangulJamo
-xmlUCSIsHangulSyllables
-xmlUCSIsHanunoo
-xmlUCSIsHebrew
-xmlUCSIsHighPrivateUseSurrogates
-xmlUCSIsHighSurrogates
-xmlUCSIsHiragana
-xmlUCSIsIPAExtensions
-xmlUCSIsIdeographicDescriptionCharacters
-xmlUCSIsKanbun
-xmlUCSIsKangxiRadicals
-xmlUCSIsKannada
-xmlUCSIsKatakana
-xmlUCSIsKatakanaPhoneticExtensions
-xmlUCSIsKhmer
-xmlUCSIsKhmerSymbols
-xmlUCSIsLao
-xmlUCSIsLatin1Supplement
-xmlUCSIsLatinExtendedA
-xmlUCSIsLatinExtendedAdditional
-xmlUCSIsLatinExtendedB
-xmlUCSIsLetterlikeSymbols
-xmlUCSIsLimbu
-xmlUCSIsLinearBIdeograms
-xmlUCSIsLinearBSyllabary
-xmlUCSIsLowSurrogates
-xmlUCSIsMalayalam
-xmlUCSIsMathematicalAlphanumericSymbols
-xmlUCSIsMathematicalOperators
-xmlUCSIsMiscellaneousMathematicalSymbolsA
-xmlUCSIsMiscellaneousMathematicalSymbolsB
-xmlUCSIsMiscellaneousSymbols
-xmlUCSIsMiscellaneousSymbolsandArrows
-xmlUCSIsMiscellaneousTechnical
-xmlUCSIsMongolian
-xmlUCSIsMusicalSymbols
-xmlUCSIsMyanmar
-xmlUCSIsNumberForms
-xmlUCSIsOgham
-xmlUCSIsOldItalic
-xmlUCSIsOpticalCharacterRecognition
-xmlUCSIsOriya
-xmlUCSIsOsmanya
-xmlUCSIsPhoneticExtensions
-xmlUCSIsPrivateUse
-xmlUCSIsPrivateUseArea
-xmlUCSIsRunic
-xmlUCSIsShavian
-xmlUCSIsSinhala
-xmlUCSIsSmallFormVariants
-xmlUCSIsSpacingModifierLetters
-xmlUCSIsSpecials
-xmlUCSIsSuperscriptsandSubscripts
-xmlUCSIsSupplementalArrowsA
-xmlUCSIsSupplementalArrowsB
-xmlUCSIsSupplementalMathematicalOperators
-xmlUCSIsSupplementaryPrivateUseAreaA
-xmlUCSIsSupplementaryPrivateUseAreaB
-xmlUCSIsSyriac
-xmlUCSIsTagalog
-xmlUCSIsTagbanwa
-xmlUCSIsTags
-xmlUCSIsTaiLe
-xmlUCSIsTaiXuanJingSymbols
-xmlUCSIsTamil
-xmlUCSIsTelugu
-xmlUCSIsThaana
-xmlUCSIsThai
-xmlUCSIsTibetan
-xmlUCSIsUgaritic
-xmlUCSIsUnifiedCanadianAboriginalSyllabics
-xmlUCSIsVariationSelectors
-xmlUCSIsVariationSelectorsSupplement
-xmlUCSIsYiRadicals
-xmlUCSIsYiSyllables
-xmlUCSIsYijingHexagramSymbols
-xmlURIEscape
-xmlURIEscapeStr
-xmlURIUnescapeString
-xmlUTF8Charcmp
-xmlUTF8Size
-xmlUTF8Strlen
-xmlUTF8Strloc
-xmlUTF8Strndup
-xmlUTF8Strpos
-xmlUTF8Strsize
-xmlUTF8Strsub
-xmlUnlinkNode
-xmlUnlockLibrary
-xmlUnsetNsProp
-xmlUnsetProp
-xmlValidBuildContentModel
-xmlValidCtxtNormalizeAttributeValue
-xmlValidGetPotentialChildren
-xmlValidGetValidElements
-xmlValidNormalizeAttributeValue
-xmlValidateAttributeDecl
-xmlValidateAttributeValue
-xmlValidateDocument
-xmlValidateDocumentFinal
-xmlValidateDtd
-xmlValidateDtdFinal
-xmlValidateElement
-xmlValidateElementDecl
-xmlValidateNCName
-xmlValidateNMToken
-xmlValidateName
-xmlValidateNameValue
-xmlValidateNamesValue
-xmlValidateNmtokenValue
-xmlValidateNmtokensValue
-xmlValidateNotationDecl
-xmlValidateNotationUse
-xmlValidateOneAttribute
-xmlValidateOneElement
-xmlValidateOneNamespace
-xmlValidatePopElement
-xmlValidatePushCData
-xmlValidatePushElement
-xmlValidateQName
-xmlValidateRoot
-xmlXIncludeFreeContext
-xmlXIncludeNewContext
-xmlXIncludeProcess
-xmlXIncludeProcessFlags
-xmlXIncludeProcessNode
-xmlXIncludeProcessTree
-xmlXIncludeProcessTreeFlags
-xmlXIncludeSetFlags
-xmlXPathAddValues
-xmlXPathBooleanFunction
-xmlXPathCastBooleanToNumber
-xmlXPathCastBooleanToString
-xmlXPathCastNodeSetToBoolean
-xmlXPathCastNodeSetToNumber
-xmlXPathCastNodeSetToString
-xmlXPathCastNodeToNumber
-xmlXPathCastNodeToString
-xmlXPathCastNumberToBoolean
-xmlXPathCastNumberToString
-xmlXPathCastStringToBoolean
-xmlXPathCastStringToNumber
-xmlXPathCastToBoolean
-xmlXPathCastToNumber
-xmlXPathCastToString
-xmlXPathCeilingFunction
-xmlXPathCmpNodes
-xmlXPathCompareValues
-xmlXPathCompile
-xmlXPathCompiledEval
-xmlXPathConcatFunction
-xmlXPathContainsFunction
-xmlXPathContextSetCache
-xmlXPathConvertBoolean
-xmlXPathConvertNumber
-xmlXPathConvertString
-xmlXPathCountFunction
-xmlXPathCtxtCompile
-xmlXPathDebugDumpCompExpr
-xmlXPathDebugDumpObject
-xmlXPathDifference
-xmlXPathDistinct
-xmlXPathDistinctSorted
-xmlXPathDivValues
-xmlXPathEqualValues
-xmlXPathErr
-xmlXPathEval
-xmlXPathEvalExpr
-xmlXPathEvalExpression
-xmlXPathEvalPredicate
-xmlXPathEvaluatePredicateResult
-xmlXPathFalseFunction
-xmlXPathFloorFunction
-xmlXPathFreeCompExpr
-xmlXPathFreeContext
-xmlXPathFreeNodeSet
-xmlXPathFreeNodeSetList
-xmlXPathFreeObject
-xmlXPathFreeParserContext
-xmlXPathFunctionLookup
-xmlXPathFunctionLookupNS
-xmlXPathHasSameNodes
-xmlXPathIdFunction
-xmlXPathInit
-xmlXPathIntersection
-xmlXPathIsInf
-xmlXPathIsNaN
-xmlXPathIsNodeType
-xmlXPathLangFunction
-xmlXPathLastFunction
-xmlXPathLeading
-xmlXPathLeadingSorted
-xmlXPathLocalNameFunction
-xmlXPathModValues
-xmlXPathMultValues
-xmlXPathNamespaceURIFunction
-xmlXPathNewBoolean
-xmlXPathNewCString
-xmlXPathNewContext
-xmlXPathNewFloat
-xmlXPathNewNodeSet
-xmlXPathNewNodeSetList
-xmlXPathNewParserContext
-xmlXPathNewString
-xmlXPathNewValueTree
-xmlXPathNextAncestor
-xmlXPathNextAncestorOrSelf
-xmlXPathNextAttribute
-xmlXPathNextChild
-xmlXPathNextDescendant
-xmlXPathNextDescendantOrSelf
-xmlXPathNextFollowing
-xmlXPathNextFollowingSibling
-xmlXPathNextNamespace
-xmlXPathNextParent
-xmlXPathNextPreceding
-xmlXPathNextPrecedingSibling
-xmlXPathNextSelf
-xmlXPathNodeLeading
-xmlXPathNodeLeadingSorted
-xmlXPathNodeSetAdd
-xmlXPathNodeSetAddNs
-xmlXPathNodeSetAddUnique
-xmlXPathNodeSetContains
-xmlXPathNodeSetCreate
-xmlXPathNodeSetDel
-xmlXPathNodeSetFreeNs
-xmlXPathNodeSetMerge
-xmlXPathNodeSetRemove
-xmlXPathNodeSetSort
-xmlXPathNodeTrailing
-xmlXPathNodeTrailingSorted
-xmlXPathNormalizeFunction
-xmlXPathNotEqualValues
-xmlXPathNotFunction
-xmlXPathNsLookup
-xmlXPathNumberFunction
-xmlXPathObjectCopy
-xmlXPathOrderDocElems
-xmlXPathParseNCName
-xmlXPathParseName
-xmlXPathPopBoolean
-xmlXPathPopExternal
-xmlXPathPopNodeSet
-xmlXPathPopNumber
-xmlXPathPopString
-xmlXPathPositionFunction
-xmlXPathRegisterAllFunctions
-xmlXPathRegisterFunc
-xmlXPathRegisterFuncLookup
-xmlXPathRegisterFuncNS
-xmlXPathRegisterNs
-xmlXPathRegisterVariable
-xmlXPathRegisterVariableLookup
-xmlXPathRegisterVariableNS
-xmlXPathRegisteredFuncsCleanup
-xmlXPathRegisteredNsCleanup
-xmlXPathRegisteredVariablesCleanup
-xmlXPathRoot
-xmlXPathRoundFunction
-xmlXPathStartsWithFunction
-xmlXPathStringEvalNumber
-xmlXPathStringFunction
-xmlXPathStringLengthFunction
-xmlXPathSubValues
-xmlXPathSubstringAfterFunction
-xmlXPathSubstringBeforeFunction
-xmlXPathSubstringFunction
-xmlXPathSumFunction
-xmlXPathTrailing
-xmlXPathTrailingSorted
-xmlXPathTranslateFunction
-xmlXPathTrueFunction
-xmlXPathValueFlipSign
-xmlXPathVariableLookup
-xmlXPathVariableLookupNS
-xmlXPathWrapCString
-xmlXPathWrapExternal
-xmlXPathWrapNodeSet
-xmlXPathWrapString
-xmlXPatherror
-xmlXPtrBuildNodeList
-xmlXPtrEval
-xmlXPtrEvalRangePredicate
-xmlXPtrFreeLocationSet
-xmlXPtrLocationSetAdd
-xmlXPtrLocationSetCreate
-xmlXPtrLocationSetDel
-xmlXPtrLocationSetMerge
-xmlXPtrLocationSetRemove
-xmlXPtrNewCollapsedRange
-xmlXPtrNewContext
-xmlXPtrNewLocationSetNodeSet
-xmlXPtrNewLocationSetNodes
-xmlXPtrNewRange
-xmlXPtrNewRangeNodeObject
-xmlXPtrNewRangeNodePoint
-xmlXPtrNewRangeNodes
-xmlXPtrNewRangePointNode
-xmlXPtrNewRangePoints
-xmlXPtrRangeToFunction
-xmlXPtrWrapLocationSet
+EXPORTS
+__docbDefaultSAXHandler
+__htmlDefaultSAXHandler
+__oldXMLWDcompatibility
+__xmlBufferAllocScheme
+__xmlDefaultBufferSize
+__xmlDefaultSAXHandler
+__xmlDefaultSAXLocator
+__xmlDeregisterNodeDefaultValue
+__xmlDoValidityCheckingDefaultValue
+xmlFree DATA
+__xmlGenericError
+__xmlGenericErrorContext
+__xmlGetWarningsDefaultValue
+__xmlIndentTreeOutput
+xmlIsBaseCharGroup DATA
+xmlIsCharGroup DATA
+xmlIsCombiningGroup DATA
+xmlIsDigitGroup DATA
+xmlIsExtenderGroup DATA
+xmlIsIdeographicGroup DATA
+xmlIsPubidChar_tab DATA
+__xmlKeepBlanksDefaultValue
+xmlLastError DATA
+__xmlLineNumbersDefaultValue
+__xmlLoadExtDtdDefaultValue
+xmlMalloc DATA
+xmlMallocAtomic DATA
+xmlMemStrdup DATA
+xmlOutputBufferCreateFilenameValue DATA
+__xmlParserDebugEntities
+xmlParserInputBufferCreateFilenameValue DATA
+xmlParserMaxDepth DATA
+__xmlParserVersion
+__xmlPedanticParserDefaultValue
+xmlRealloc DATA
+__xmlRegisterNodeDefaultValue
+__xmlSaveNoEmptyTags
+xmlStringComment DATA
+xmlStringText DATA
+xmlStringTextNoenc DATA
+xmlStructuredError DATA
+__xmlSubstituteEntitiesDefaultValue
+__xmlTreeIndentString
+xmlXPathNAN DATA
+xmlXPathNINF DATA
+xmlXPathPINF DATA
+UTF8ToHtml
+UTF8Toisolat1
+attribute
+attributeDecl
+cdataBlock
+characters
+checkNamespace
+comment
+docbCreateFileParserCtxt
+docbCreatePushParserCtxt
+docbDefaultSAXHandlerInit
+docbEncodeEntities
+docbFreeParserCtxt
+docbParseChunk
+docbParseDoc
+docbParseDocument
+docbParseFile
+docbSAXParseDoc
+docbSAXParseFile
+elementDecl
+endDocument
+endElement
+entityDecl
+externalSubset
+getColumnNumber
+getEntity
+getLineNumber
+getNamespace
+getParameterEntity
+getPublicId
+getSystemId
+globalNamespace
+hasExternalSubset
+hasInternalSubset
+htmlAttrAllowed
+htmlAutoCloseTag
+htmlCreateFileParserCtxt
+htmlCreateMemoryParserCtxt
+htmlCreatePushParserCtxt
+htmlCtxtReadDoc
+htmlCtxtReadFd
+htmlCtxtReadFile
+htmlCtxtReadIO
+htmlCtxtReadMemory
+htmlCtxtReset
+htmlCtxtUseOptions
+htmlDefaultSAXHandlerInit
+htmlDocContentDumpFormatOutput
+htmlDocContentDumpOutput
+htmlDocDump
+htmlDocDumpMemory
+htmlElementAllowedHere
+htmlElementStatusHere
+htmlEncodeEntities
+htmlEntityLookup
+htmlEntityValueLookup
+htmlFreeParserCtxt
+htmlGetMetaEncoding
+htmlHandleOmittedElem
+htmlInitAutoClose
+htmlIsAutoClosed
+htmlIsBooleanAttr
+htmlIsScriptAttribute
+htmlNewDoc
+htmlNewDocNoDtD
+htmlNodeDump
+htmlNodeDumpFile
+htmlNodeDumpFileFormat
+htmlNodeDumpFormatOutput
+htmlNodeDumpOutput
+htmlNodeStatus
+htmlParseCharRef
+htmlParseChunk
+htmlParseDoc
+htmlParseDocument
+htmlParseElement
+htmlParseEntityRef
+htmlParseFile
+htmlReadDoc
+htmlReadFd
+htmlReadFile
+htmlReadIO
+htmlReadMemory
+htmlSAXParseDoc
+htmlSAXParseFile
+htmlSaveFile
+htmlSaveFileEnc
+htmlSaveFileFormat
+htmlSetMetaEncoding
+htmlTagLookup
+ignorableWhitespace
+initGenericErrorDefaultFunc
+initdocbDefaultSAXHandler
+inithtmlDefaultSAXHandler
+initxmlDefaultSAXHandler
+inputPop
+inputPush
+internalSubset
+isStandalone
+isolat1ToUTF8
+namePop
+namePush
+namespaceDecl
+nodePop
+nodePush
+notationDecl
+processingInstruction
+reference
+resolveEntity
+setDocumentLocator
+setNamespace
+startDocument
+startElement
+unparsedEntityDecl
+valuePop
+valuePush
+xmlACatalogAdd
+xmlACatalogDump
+xmlACatalogRemove
+xmlACatalogResolve
+xmlACatalogResolvePublic
+xmlACatalogResolveSystem
+xmlACatalogResolveURI
+xmlAddAttributeDecl
+xmlAddChild
+xmlAddChildList
+xmlAddDocEntity
+xmlAddDtdEntity
+xmlAddElementDecl
+xmlAddEncodingAlias
+xmlAddID
+xmlAddNextSibling
+xmlAddNotationDecl
+xmlAddPrevSibling
+xmlAddRef
+xmlAddSibling
+xmlAllocOutputBuffer
+xmlAllocParserInputBuffer
+xmlAttrSerializeTxtContent
+xmlAutomataCompile
+xmlAutomataGetInitState
+xmlAutomataIsDeterminist
+xmlAutomataNewAllTrans
+xmlAutomataNewCountTrans
+xmlAutomataNewCountTrans2
+xmlAutomataNewCountedTrans
+xmlAutomataNewCounter
+xmlAutomataNewCounterTrans
+xmlAutomataNewEpsilon
+xmlAutomataNewOnceTrans
+xmlAutomataNewOnceTrans2
+xmlAutomataNewState
+xmlAutomataNewTransition
+xmlAutomataNewTransition2
+xmlAutomataSetFinalState
+xmlBoolToText
+xmlBufferAdd
+xmlBufferAddHead
+xmlBufferCCat
+xmlBufferCat
+xmlBufferContent
+xmlBufferCreate
+xmlBufferCreateSize
+xmlBufferCreateStatic
+xmlBufferDump
+xmlBufferEmpty
+xmlBufferFree
+xmlBufferGrow
+xmlBufferLength
+xmlBufferResize
+xmlBufferSetAllocationScheme
+xmlBufferShrink
+xmlBufferWriteCHAR
+xmlBufferWriteChar
+xmlBufferWriteQuotedString
+xmlBuildQName
+xmlBuildRelativeURI
+xmlBuildURI
+xmlByteConsumed
+xmlC14NDocDumpMemory
+xmlC14NDocSave
+xmlC14NDocSaveTo
+xmlC14NExecute
+xmlCanonicPath
+xmlCatalogAdd
+xmlCatalogAddLocal
+xmlCatalogCleanup
+xmlCatalogConvert
+xmlCatalogDump
+xmlCatalogFreeLocal
+xmlCatalogGetDefaults
+xmlCatalogGetPublic
+xmlCatalogGetSystem
+xmlCatalogIsEmpty
+xmlCatalogLocalResolve
+xmlCatalogLocalResolveURI
+xmlCatalogRemove
+xmlCatalogResolve
+xmlCatalogResolvePublic
+xmlCatalogResolveSystem
+xmlCatalogResolveURI
+xmlCatalogSetDebug
+xmlCatalogSetDefaultPrefer
+xmlCatalogSetDefaults
+xmlCharEncCloseFunc
+xmlCharEncFirstLine
+xmlCharEncInFunc
+xmlCharEncOutFunc
+xmlCharInRange
+xmlCharStrdup
+xmlCharStrndup
+xmlCheckFilename
+xmlCheckHTTPInput
+xmlCheckLanguageID
+xmlCheckUTF8
+xmlCheckVersion
+xmlCleanupCharEncodingHandlers
+xmlCleanupEncodingAliases
+xmlCleanupGlobals
+xmlCleanupInputCallbacks
+xmlCleanupMemory
+xmlCleanupOutputCallbacks
+xmlCleanupParser
+xmlCleanupPredefinedEntities
+xmlCleanupThreads
+xmlClearNodeInfoSeq
+xmlClearParserCtxt
+xmlConvertSGMLCatalog
+xmlCopyAttributeTable
+xmlCopyChar
+xmlCopyCharMultiByte
+xmlCopyDoc
+xmlCopyDtd
+xmlCopyElementContent
+xmlCopyElementTable
+xmlCopyEntitiesTable
+xmlCopyEnumeration
+xmlCopyError
+xmlCopyNamespace
+xmlCopyNamespaceList
+xmlCopyNode
+xmlCopyNodeList
+xmlCopyNotationTable
+xmlCopyProp
+xmlCopyPropList
+xmlCreateDocParserCtxt
+xmlCreateEntitiesTable
+xmlCreateEntityParserCtxt
+xmlCreateEnumeration
+xmlCreateFileParserCtxt
+xmlCreateIOParserCtxt
+xmlCreateIntSubset
+xmlCreateMemoryParserCtxt
+xmlCreatePushParserCtxt
+xmlCreateURI
+xmlCreateURLParserCtxt
+xmlCtxtGetLastError
+xmlCtxtReadDoc
+xmlCtxtReadFd
+xmlCtxtReadFile
+xmlCtxtReadIO
+xmlCtxtReadMemory
+xmlCtxtReset
+xmlCtxtResetLastError
+xmlCtxtResetPush
+xmlCtxtUseOptions
+xmlCurrentChar
+xmlDebugCheckDocument
+xmlDebugDumpAttr
+xmlDebugDumpAttrList
+xmlDebugDumpDTD
+xmlDebugDumpDocument
+xmlDebugDumpDocumentHead
+xmlDebugDumpEntities
+xmlDebugDumpNode
+xmlDebugDumpNodeList
+xmlDebugDumpOneNode
+xmlDebugDumpString
+xmlDecodeEntities
+xmlDefaultSAXHandlerInit
+xmlDelEncodingAlias
+xmlDeregisterNodeDefault
+xmlDetectCharEncoding
+xmlDictCreate
+xmlDictCreateSub
+xmlDictFree
+xmlDictLookup
+xmlDictOwns
+xmlDictQLookup
+xmlDictReference
+xmlDictSize
+xmlDocCopyNode
+xmlDocCopyNodeList
+xmlDocDump
+xmlDocDumpFormatMemory
+xmlDocDumpFormatMemoryEnc
+xmlDocDumpMemory
+xmlDocDumpMemoryEnc
+xmlDocFormatDump
+xmlDocGetRootElement
+xmlDocSetRootElement
+xmlDumpAttributeDecl
+xmlDumpAttributeTable
+xmlDumpElementDecl
+xmlDumpElementTable
+xmlDumpEntitiesTable
+xmlDumpEntityDecl
+xmlDumpNotationDecl
+xmlDumpNotationTable
+xmlElemDump
+xmlEncodeEntities
+xmlEncodeEntitiesReentrant
+xmlEncodeSpecialChars
+xmlErrMemory
+xmlFileClose
+xmlFileMatch
+xmlFileOpen
+xmlFileRead
+xmlFindCharEncodingHandler
+xmlFreeAttributeTable
+xmlFreeAutomata
+xmlFreeCatalog
+xmlFreeDoc
+xmlFreeDtd
+xmlFreeElementContent
+xmlFreeElementTable
+xmlFreeEntitiesTable
+xmlFreeEnumeration
+xmlFreeIDTable
+xmlFreeInputStream
+xmlFreeMutex
+xmlFreeNode
+xmlFreeNodeList
+xmlFreeNotationTable
+xmlFreeNs
+xmlFreeNsList
+xmlFreeParserCtxt
+xmlFreeParserInputBuffer
+xmlFreePattern
+xmlFreePatternList
+xmlFreeProp
+xmlFreePropList
+xmlFreeRMutex
+xmlFreeRefTable
+xmlFreeTextReader
+xmlFreeTextWriter
+xmlFreeURI
+xmlFreeValidCtxt
+xmlGcMemGet
+xmlGcMemSetup
+xmlGetBufferAllocationScheme
+xmlGetCharEncodingHandler
+xmlGetCharEncodingName
+xmlGetCompressMode
+xmlGetDocCompressMode
+xmlGetDocEntity
+xmlGetDtdAttrDesc
+xmlGetDtdElementDesc
+xmlGetDtdEntity
+xmlGetDtdNotationDesc
+xmlGetDtdQAttrDesc
+xmlGetDtdQElementDesc
+xmlGetEncodingAlias
+xmlGetExternalEntityLoader
+xmlGetFeature
+xmlGetFeaturesList
+xmlGetGlobalState
+xmlGetID
+xmlGetIntSubset
+xmlGetLastChild
+xmlGetLastError
+xmlGetLineNo
+xmlGetNoNsProp
+xmlGetNodePath
+xmlGetNsList
+xmlGetNsProp
+xmlGetParameterEntity
+xmlGetPredefinedEntity
+xmlGetProp
+xmlGetRefs
+xmlGetThreadId
+xmlGetUTF8Char
+xmlHandleEntity
+xmlHasNsProp
+xmlHasProp
+xmlHashAddEntry
+xmlHashAddEntry2
+xmlHashAddEntry3
+xmlHashCopy
+xmlHashCreate
+xmlHashFree
+xmlHashLookup
+xmlHashLookup2
+xmlHashLookup3
+xmlHashQLookup
+xmlHashQLookup2
+xmlHashQLookup3
+xmlHashRemoveEntry
+xmlHashRemoveEntry2
+xmlHashRemoveEntry3
+xmlHashScan
+xmlHashScan3
+xmlHashScanFull
+xmlHashScanFull3
+xmlHashSize
+xmlHashUpdateEntry
+xmlHashUpdateEntry2
+xmlHashUpdateEntry3
+xmlIOFTPClose
+xmlIOFTPMatch
+xmlIOFTPOpen
+xmlIOFTPRead
+xmlIOHTTPClose
+xmlIOHTTPMatch
+xmlIOHTTPOpen
+xmlIOHTTPOpenW
+xmlIOHTTPRead
+xmlIOParseDTD
+xmlInitCharEncodingHandlers
+xmlInitGlobals
+xmlInitMemory
+xmlInitNodeInfoSeq
+xmlInitParser
+xmlInitParserCtxt
+xmlInitThreads
+xmlInitializeCatalog
+xmlInitializeGlobalState
+xmlInitializePredefinedEntities
+xmlIsBaseChar
+xmlIsBlank
+xmlIsBlankNode
+xmlIsChar
+xmlIsCombining
+xmlIsDigit
+xmlIsExtender
+xmlIsID
+xmlIsIdeographic
+xmlIsLetter
+xmlIsMainThread
+xmlIsMixedElement
+xmlIsPubidChar
+xmlIsRef
+xmlIsXHTML
+xmlKeepBlanksDefault
+xmlLineNumbersDefault
+xmlLinkGetData
+xmlListAppend
+xmlListClear
+xmlListCopy
+xmlListCreate
+xmlListDelete
+xmlListDup
+xmlListEmpty
+xmlListEnd
+xmlListFront
+xmlListInsert
+xmlListMerge
+xmlListPopBack
+xmlListPopFront
+xmlListPushBack
+xmlListPushFront
+xmlListRemoveAll
+xmlListRemoveFirst
+xmlListRemoveLast
+xmlListReverse
+xmlListReverseSearch
+xmlListReverseWalk
+xmlListSearch
+xmlListSize
+xmlListSort
+xmlListWalk
+xmlLoadACatalog
+xmlLoadCatalog
+xmlLoadCatalogs
+xmlLoadExternalEntity
+xmlLoadSGMLSuperCatalog
+xmlLockLibrary
+xmlLsCountNode
+xmlLsOneNode
+xmlMallocAtomicLoc
+xmlMallocLoc
+xmlMemBlocks
+xmlMemDisplay
+xmlMemFree
+xmlMemGet
+xmlMemMalloc
+xmlMemRealloc
+xmlMemSetup
+xmlMemShow
+xmlMemStrdupLoc
+xmlMemUsed
+xmlMemoryDump
+xmlMemoryStrdup
+xmlModuleClose
+xmlModuleFree
+xmlModuleOpen
+xmlModuleSymbol
+xmlMutexLock
+xmlMutexUnlock
+xmlNamespaceParseNCName
+xmlNamespaceParseNSDef
+xmlNamespaceParseQName
+xmlNanoFTPCheckResponse
+xmlNanoFTPCleanup
+xmlNanoFTPClose
+xmlNanoFTPCloseConnection
+xmlNanoFTPConnect
+xmlNanoFTPConnectTo
+xmlNanoFTPCwd
+xmlNanoFTPDele
+xmlNanoFTPFreeCtxt
+xmlNanoFTPGet
+xmlNanoFTPGetConnection
+xmlNanoFTPGetResponse
+xmlNanoFTPGetSocket
+xmlNanoFTPInit
+xmlNanoFTPList
+xmlNanoFTPNewCtxt
+xmlNanoFTPOpen
+xmlNanoFTPProxy
+xmlNanoFTPQuit
+xmlNanoFTPRead
+xmlNanoFTPScanProxy
+xmlNanoFTPUpdateURL
+xmlNanoHTTPAuthHeader
+xmlNanoHTTPCleanup
+xmlNanoHTTPClose
+xmlNanoHTTPContentLength
+xmlNanoHTTPEncoding
+xmlNanoHTTPFetch
+xmlNanoHTTPInit
+xmlNanoHTTPMethod
+xmlNanoHTTPMethodRedir
+xmlNanoHTTPMimeType
+xmlNanoHTTPOpen
+xmlNanoHTTPOpenRedir
+xmlNanoHTTPRead
+xmlNanoHTTPRedir
+xmlNanoHTTPReturnCode
+xmlNanoHTTPSave
+xmlNanoHTTPScanProxy
+xmlNewAutomata
+xmlNewCDataBlock
+xmlNewCatalog
+xmlNewCharEncodingHandler
+xmlNewCharRef
+xmlNewChild
+xmlNewComment
+xmlNewDoc
+xmlNewDocComment
+xmlNewDocFragment
+xmlNewDocNode
+xmlNewDocNodeEatName
+xmlNewDocPI
+xmlNewDocProp
+xmlNewDocRawNode
+xmlNewDocText
+xmlNewDocTextLen
+xmlNewDtd
+xmlNewElementContent
+xmlNewEntityInputStream
+xmlNewGlobalNs
+xmlNewIOInputStream
+xmlNewInputFromFile
+xmlNewInputStream
+xmlNewMutex
+xmlNewNode
+xmlNewNodeEatName
+xmlNewNs
+xmlNewNsProp
+xmlNewNsPropEatName
+xmlNewPI
+xmlNewParserCtxt
+xmlNewProp
+xmlNewRMutex
+xmlNewReference
+xmlNewStringInputStream
+xmlNewText
+xmlNewTextChild
+xmlNewTextLen
+xmlNewTextReader
+xmlNewTextReaderFilename
+xmlNewTextWriter
+xmlNewTextWriterDoc
+xmlNewTextWriterFilename
+xmlNewTextWriterMemory
+xmlNewTextWriterPushParser
+xmlNewTextWriterTree
+xmlNewValidCtxt
+xmlNextChar
+xmlNoNetExternalEntityLoader
+xmlNodeAddContent
+xmlNodeAddContentLen
+xmlNodeBufGetContent
+xmlNodeDump
+xmlNodeDumpOutput
+xmlNodeGetBase
+xmlNodeGetContent
+xmlNodeGetLang
+xmlNodeGetSpacePreserve
+xmlNodeIsText
+xmlNodeListGetRawString
+xmlNodeListGetString
+xmlNodeSetBase
+xmlNodeSetContent
+xmlNodeSetContentLen
+xmlNodeSetLang
+xmlNodeSetName
+xmlNodeSetSpacePreserve
+xmlNormalizeURIPath
+xmlNormalizeWindowsPath
+xmlOutputBufferClose
+xmlOutputBufferCreateFd
+xmlOutputBufferCreateFile
+xmlOutputBufferCreateFilename
+xmlOutputBufferCreateFilenameDefault
+xmlOutputBufferCreateIO
+xmlOutputBufferFlush
+xmlOutputBufferWrite
+xmlOutputBufferWriteEscape
+xmlOutputBufferWriteString
+xmlParseAttValue
+xmlParseAttribute
+xmlParseAttributeListDecl
+xmlParseAttributeType
+xmlParseBalancedChunkMemory
+xmlParseBalancedChunkMemoryRecover
+xmlParseCDSect
+xmlParseCatalogFile
+xmlParseCharData
+xmlParseCharEncoding
+xmlParseCharRef
+xmlParseChunk
+xmlParseComment
+xmlParseContent
+xmlParseCtxtExternalEntity
+xmlParseDTD
+xmlParseDefaultDecl
+xmlParseDoc
+xmlParseDocTypeDecl
+xmlParseDocument
+xmlParseElement
+xmlParseElementChildrenContentDecl
+xmlParseElementContentDecl
+xmlParseElementDecl
+xmlParseElementMixedContentDecl
+xmlParseEncName
+xmlParseEncodingDecl
+xmlParseEndTag
+xmlParseEntity
+xmlParseEntityDecl
+xmlParseEntityRef
+xmlParseEntityValue
+xmlParseEnumeratedType
+xmlParseEnumerationType
+xmlParseExtParsedEnt
+xmlParseExternalEntity
+xmlParseExternalID
+xmlParseExternalSubset
+xmlParseFile
+xmlParseInNodeContext
+xmlParseMarkupDecl
+xmlParseMemory
+xmlParseMisc
+xmlParseName
+xmlParseNamespace
+xmlParseNmtoken
+xmlParseNotationDecl
+xmlParseNotationType
+xmlParsePEReference
+xmlParsePI
+xmlParsePITarget
+xmlParsePubidLiteral
+xmlParseQuotedString
+xmlParseReference
+xmlParseSDDecl
+xmlParseStartTag
+xmlParseSystemLiteral
+xmlParseTextDecl
+xmlParseURI
+xmlParseURIReference
+xmlParseVersionInfo
+xmlParseVersionNum
+xmlParseXMLDecl
+xmlParserAddNodeInfo
+xmlParserError
+xmlParserFindNodeInfo
+xmlParserFindNodeInfoIndex
+xmlParserGetDirectory
+xmlParserHandlePEReference
+xmlParserHandleReference
+xmlParserInputBufferCreateFd
+xmlParserInputBufferCreateFile
+xmlParserInputBufferCreateFilename
+xmlParserInputBufferCreateFilenameDefault
+xmlParserInputBufferCreateIO
+xmlParserInputBufferCreateMem
+xmlParserInputBufferCreateStatic
+xmlParserInputBufferGrow
+xmlParserInputBufferPush
+xmlParserInputBufferRead
+xmlParserInputGrow
+xmlParserInputRead
+xmlParserInputShrink
+xmlParserPrintFileContext
+xmlParserPrintFileInfo
+xmlParserValidityError
+xmlParserValidityWarning
+xmlParserWarning
+xmlPatternMatch
+xmlPatterncompile
+xmlPedanticParserDefault
+xmlPopInput
+xmlPopInputCallbacks
+xmlPrintURI
+xmlPushInput
+xmlRMutexLock
+xmlRMutexUnlock
+xmlReadDoc
+xmlReadFd
+xmlReadFile
+xmlReadIO
+xmlReadMemory
+xmlReaderForDoc
+xmlReaderForFd
+xmlReaderForFile
+xmlReaderForIO
+xmlReaderForMemory
+xmlReaderNewDoc
+xmlReaderNewFd
+xmlReaderNewFile
+xmlReaderNewIO
+xmlReaderNewMemory
+xmlReaderNewWalker
+xmlReaderWalker
+xmlReallocLoc
+xmlReconciliateNs
+xmlRecoverDoc
+xmlRecoverFile
+xmlRecoverMemory
+xmlRegExecPushString
+xmlRegExecPushString2
+xmlRegFreeExecCtxt
+xmlRegFreeRegexp
+xmlRegNewExecCtxt
+xmlRegexpCompile
+xmlRegexpExec
+xmlRegexpIsDeterminist
+xmlRegexpPrint
+xmlRegisterCharEncodingHandler
+xmlRegisterDefaultInputCallbacks
+xmlRegisterDefaultOutputCallbacks
+xmlRegisterHTTPPostCallbacks
+xmlRegisterInputCallbacks
+xmlRegisterNodeDefault
+xmlRegisterOutputCallbacks
+xmlRelaxNGCleanupTypes
+xmlRelaxNGDump
+xmlRelaxNGDumpTree
+xmlRelaxNGFree
+xmlRelaxNGFreeParserCtxt
+xmlRelaxNGFreeValidCtxt
+xmlRelaxNGGetParserErrors
+xmlRelaxNGGetValidErrors
+xmlRelaxNGInitTypes
+xmlRelaxNGNewDocParserCtxt
+xmlRelaxNGNewMemParserCtxt
+xmlRelaxNGNewParserCtxt
+xmlRelaxNGNewValidCtxt
+xmlRelaxNGParse
+xmlRelaxNGSetParserErrors
+xmlRelaxNGSetValidErrors
+xmlRelaxNGValidateDoc
+xmlRelaxNGValidateFullElement
+xmlRelaxNGValidatePopElement
+xmlRelaxNGValidatePushCData
+xmlRelaxNGValidatePushElement
+xmlRelaxParserSetFlag
+xmlRemoveID
+xmlRemoveProp
+xmlRemoveRef
+xmlReplaceNode
+xmlResetError
+xmlResetLastError
+xmlSAX2AttributeDecl
+xmlSAX2CDataBlock
+xmlSAX2Characters
+xmlSAX2Comment
+xmlSAX2ElementDecl
+xmlSAX2EndDocument
+xmlSAX2EndElement
+xmlSAX2EndElementNs
+xmlSAX2EntityDecl
+xmlSAX2ExternalSubset
+xmlSAX2GetColumnNumber
+xmlSAX2GetEntity
+xmlSAX2GetLineNumber
+xmlSAX2GetParameterEntity
+xmlSAX2GetPublicId
+xmlSAX2GetSystemId
+xmlSAX2HasExternalSubset
+xmlSAX2HasInternalSubset
+xmlSAX2IgnorableWhitespace
+xmlSAX2InitDefaultSAXHandler
+xmlSAX2InitDocbDefaultSAXHandler
+xmlSAX2InitHtmlDefaultSAXHandler
+xmlSAX2InternalSubset
+xmlSAX2IsStandalone
+xmlSAX2NotationDecl
+xmlSAX2ProcessingInstruction
+xmlSAX2Reference
+xmlSAX2ResolveEntity
+xmlSAX2SetDocumentLocator
+xmlSAX2StartDocument
+xmlSAX2StartElement
+xmlSAX2StartElementNs
+xmlSAX2UnparsedEntityDecl
+xmlSAXDefaultVersion
+xmlSAXParseDTD
+xmlSAXParseDoc
+xmlSAXParseEntity
+xmlSAXParseFile
+xmlSAXParseFileWithData
+xmlSAXParseMemory
+xmlSAXParseMemoryWithData
+xmlSAXUserParseFile
+xmlSAXUserParseMemory
+xmlSAXVersion
+xmlSaveClose
+xmlSaveDoc
+xmlSaveFile
+xmlSaveFileEnc
+xmlSaveFileTo
+xmlSaveFlush
+xmlSaveFormatFile
+xmlSaveFormatFileEnc
+xmlSaveFormatFileTo
+xmlSaveSetAttrEscape
+xmlSaveSetEscape
+xmlSaveToFd
+xmlSaveToFilename
+xmlSaveToIO
+xmlSaveTree
+xmlSaveUri
+xmlScanName
+xmlSchemaCheckFacet
+xmlSchemaCleanupTypes
+xmlSchemaCollapseString
+xmlSchemaCompareValues
+xmlSchemaDump
+xmlSchemaFree
+xmlSchemaFreeFacet
+xmlSchemaFreeParserCtxt
+xmlSchemaFreeType
+xmlSchemaFreeValidCtxt
+xmlSchemaFreeValue
+xmlSchemaFreeWildcard
+xmlSchemaGetBuiltInListSimpleTypeItemType
+xmlSchemaGetBuiltInType
+xmlSchemaGetFacetValueAsULong
+xmlSchemaGetParserErrors
+xmlSchemaGetPredefinedType
+xmlSchemaGetValidErrors
+xmlSchemaInitTypes
+xmlSchemaIsBuiltInTypeFacet
+xmlSchemaNewDocParserCtxt
+xmlSchemaNewFacet
+xmlSchemaNewMemParserCtxt
+xmlSchemaNewParserCtxt
+xmlSchemaNewValidCtxt
+xmlSchemaParse
+xmlSchemaSetParserErrors
+xmlSchemaSetValidErrors
+xmlSchemaSetValidOptions
+xmlSchemaValPredefTypeNode
+xmlSchemaValPredefTypeNodeNoNorm
+xmlSchemaValidCtxtGetOptions
+xmlSchemaValidateDoc
+xmlSchemaValidateFacet
+xmlSchemaValidateLengthFacet
+xmlSchemaValidateListSimpleTypeFacet
+xmlSchemaValidateOneElement
+xmlSchemaValidatePredefinedType
+xmlSchemaValidateStream
+xmlSearchNs
+xmlSearchNsByHref
+xmlSetBufferAllocationScheme
+xmlSetCompressMode
+xmlSetDocCompressMode
+xmlSetEntityReferenceFunc
+xmlSetExternalEntityLoader
+xmlSetFeature
+xmlSetGenericErrorFunc
+xmlSetListDoc
+xmlSetNs
+xmlSetNsProp
+xmlSetProp
+xmlSetStructuredErrorFunc
+xmlSetTreeDoc
+xmlSetupParserForBuffer
+xmlShell
+xmlShellBase
+xmlShellCat
+xmlShellDir
+xmlShellDu
+xmlShellList
+xmlShellLoad
+xmlShellPrintNode
+xmlShellPrintXPathError
+xmlShellPrintXPathResult
+xmlShellPwd
+xmlShellSave
+xmlShellValidate
+xmlShellWrite
+xmlSkipBlankChars
+xmlSnprintfElementContent
+xmlSplitQName
+xmlSplitQName2
+xmlSplitQName3
+xmlSprintfElementContent
+xmlStopParser
+xmlStrEqual
+xmlStrPrintf
+xmlStrQEqual
+xmlStrVPrintf
+xmlStrcasecmp
+xmlStrcasestr
+xmlStrcat
+xmlStrchr
+xmlStrcmp
+xmlStrdup
+xmlStringCurrentChar
+xmlStringDecodeEntities
+xmlStringGetNodeList
+xmlStringLenDecodeEntities
+xmlStringLenGetNodeList
+xmlStrlen
+xmlStrncasecmp
+xmlStrncat
+xmlStrncatNew
+xmlStrncmp
+xmlStrndup
+xmlStrstr
+xmlStrsub
+xmlSubstituteEntitiesDefault
+xmlSwitchEncoding
+xmlSwitchInputEncoding
+xmlSwitchToEncoding
+xmlTextConcat
+xmlTextMerge
+xmlTextReaderAttributeCount
+xmlTextReaderBaseUri
+xmlTextReaderClose
+xmlTextReaderConstBaseUri
+xmlTextReaderConstEncoding
+xmlTextReaderConstLocalName
+xmlTextReaderConstName
+xmlTextReaderConstNamespaceUri
+xmlTextReaderConstPrefix
+xmlTextReaderConstString
+xmlTextReaderConstValue
+xmlTextReaderConstXmlLang
+xmlTextReaderConstXmlVersion
+xmlTextReaderCurrentDoc
+xmlTextReaderCurrentNode
+xmlTextReaderDepth
+xmlTextReaderExpand
+xmlTextReaderGetAttribute
+xmlTextReaderGetAttributeNo
+xmlTextReaderGetAttributeNs
+xmlTextReaderGetErrorHandler
+xmlTextReaderGetParserProp
+xmlTextReaderGetRemainder
+xmlTextReaderHasAttributes
+xmlTextReaderHasValue
+xmlTextReaderIsDefault
+xmlTextReaderIsEmptyElement
+xmlTextReaderIsNamespaceDecl
+xmlTextReaderIsValid
+xmlTextReaderLocalName
+xmlTextReaderLocatorBaseURI
+xmlTextReaderLocatorLineNumber
+xmlTextReaderLookupNamespace
+xmlTextReaderMoveToAttribute
+xmlTextReaderMoveToAttributeNo
+xmlTextReaderMoveToAttributeNs
+xmlTextReaderMoveToElement
+xmlTextReaderMoveToFirstAttribute
+xmlTextReaderMoveToNextAttribute
+xmlTextReaderName
+xmlTextReaderNamespaceUri
+xmlTextReaderNext
+xmlTextReaderNextSibling
+xmlTextReaderNodeType
+xmlTextReaderNormalization
+xmlTextReaderPrefix
+xmlTextReaderPreserve
+xmlTextReaderPreservePattern
+xmlTextReaderQuoteChar
+xmlTextReaderRead
+xmlTextReaderReadAttributeValue
+xmlTextReaderReadInnerXml
+xmlTextReaderReadOuterXml
+xmlTextReaderReadState
+xmlTextReaderReadString
+xmlTextReaderRelaxNGSetSchema
+xmlTextReaderRelaxNGValidate
+xmlTextReaderSetErrorHandler
+xmlTextReaderSetParserProp
+xmlTextReaderSetStructuredErrorHandler
+xmlTextReaderStandalone
+xmlTextReaderValue
+xmlTextReaderXmlLang
+xmlTextWriterEndAttribute
+xmlTextWriterEndCDATA
+xmlTextWriterEndComment
+xmlTextWriterEndDTD
+xmlTextWriterEndDTDAttlist
+xmlTextWriterEndDTDElement
+xmlTextWriterEndDTDEntity
+xmlTextWriterEndDocument
+xmlTextWriterEndElement
+xmlTextWriterEndPI
+xmlTextWriterFlush
+xmlTextWriterFullEndElement
+xmlTextWriterSetIndent
+xmlTextWriterSetIndentString
+xmlTextWriterStartAttribute
+xmlTextWriterStartAttributeNS
+xmlTextWriterStartCDATA
+xmlTextWriterStartComment
+xmlTextWriterStartDTD
+xmlTextWriterStartDTDAttlist
+xmlTextWriterStartDTDElement
+xmlTextWriterStartDTDEntity
+xmlTextWriterStartDocument
+xmlTextWriterStartElement
+xmlTextWriterStartElementNS
+xmlTextWriterStartPI
+xmlTextWriterWriteAttribute
+xmlTextWriterWriteAttributeNS
+xmlTextWriterWriteBase64
+xmlTextWriterWriteBinHex
+xmlTextWriterWriteCDATA
+xmlTextWriterWriteComment
+xmlTextWriterWriteDTD
+xmlTextWriterWriteDTDAttlist
+xmlTextWriterWriteDTDElement
+xmlTextWriterWriteDTDEntity
+xmlTextWriterWriteDTDExternalEntity
+xmlTextWriterWriteDTDExternalEntityContents
+xmlTextWriterWriteDTDInternalEntity
+xmlTextWriterWriteDTDNotation
+xmlTextWriterWriteElement
+xmlTextWriterWriteElementNS
+xmlTextWriterWriteFormatAttribute
+xmlTextWriterWriteFormatAttributeNS
+xmlTextWriterWriteFormatCDATA
+xmlTextWriterWriteFormatComment
+xmlTextWriterWriteFormatDTD
+xmlTextWriterWriteFormatDTDAttlist
+xmlTextWriterWriteFormatDTDElement
+xmlTextWriterWriteFormatDTDInternalEntity
+xmlTextWriterWriteFormatElement
+xmlTextWriterWriteFormatElementNS
+xmlTextWriterWriteFormatPI
+xmlTextWriterWriteFormatRaw
+xmlTextWriterWriteFormatString
+xmlTextWriterWritePI
+xmlTextWriterWriteRaw
+xmlTextWriterWriteRawLen
+xmlTextWriterWriteString
+xmlTextWriterWriteVFormatAttribute
+xmlTextWriterWriteVFormatAttributeNS
+xmlTextWriterWriteVFormatCDATA
+xmlTextWriterWriteVFormatComment
+xmlTextWriterWriteVFormatDTD
+xmlTextWriterWriteVFormatDTDAttlist
+xmlTextWriterWriteVFormatDTDElement
+xmlTextWriterWriteVFormatDTDInternalEntity
+xmlTextWriterWriteVFormatElement
+xmlTextWriterWriteVFormatElementNS
+xmlTextWriterWriteVFormatPI
+xmlTextWriterWriteVFormatRaw
+xmlTextWriterWriteVFormatString
+xmlThrDefBufferAllocScheme
+xmlThrDefDefaultBufferSize
+xmlThrDefDeregisterNodeDefault
+xmlThrDefDoValidityCheckingDefaultValue
+xmlThrDefGetWarningsDefaultValue
+xmlThrDefIndentTreeOutput
+xmlThrDefKeepBlanksDefaultValue
+xmlThrDefLineNumbersDefaultValue
+xmlThrDefLoadExtDtdDefaultValue
+xmlThrDefOutputBufferCreateFilenameDefault
+xmlThrDefParserDebugEntities
+xmlThrDefParserInputBufferCreateFilenameDefault
+xmlThrDefPedanticParserDefaultValue
+xmlThrDefRegisterNodeDefault
+xmlThrDefSaveNoEmptyTags
+xmlThrDefSetGenericErrorFunc
+xmlThrDefSetStructuredErrorFunc
+xmlThrDefSubstituteEntitiesDefaultValue
+xmlThrDefTreeIndentString
+xmlUCSIsAegeanNumbers
+xmlUCSIsAlphabeticPresentationForms
+xmlUCSIsArabic
+xmlUCSIsArabicPresentationFormsA
+xmlUCSIsArabicPresentationFormsB
+xmlUCSIsArmenian
+xmlUCSIsArrows
+xmlUCSIsBasicLatin
+xmlUCSIsBengali
+xmlUCSIsBlock
+xmlUCSIsBlockElements
+xmlUCSIsBopomofo
+xmlUCSIsBopomofoExtended
+xmlUCSIsBoxDrawing
+xmlUCSIsBraillePatterns
+xmlUCSIsBuhid
+xmlUCSIsByzantineMusicalSymbols
+xmlUCSIsCJKCompatibility
+xmlUCSIsCJKCompatibilityForms
+xmlUCSIsCJKCompatibilityIdeographs
+xmlUCSIsCJKCompatibilityIdeographsSupplement
+xmlUCSIsCJKRadicalsSupplement
+xmlUCSIsCJKSymbolsandPunctuation
+xmlUCSIsCJKUnifiedIdeographs
+xmlUCSIsCJKUnifiedIdeographsExtensionA
+xmlUCSIsCJKUnifiedIdeographsExtensionB
+xmlUCSIsCat
+xmlUCSIsCatC
+xmlUCSIsCatCc
+xmlUCSIsCatCf
+xmlUCSIsCatCo
+xmlUCSIsCatCs
+xmlUCSIsCatL
+xmlUCSIsCatLl
+xmlUCSIsCatLm
+xmlUCSIsCatLo
+xmlUCSIsCatLt
+xmlUCSIsCatLu
+xmlUCSIsCatM
+xmlUCSIsCatMc
+xmlUCSIsCatMe
+xmlUCSIsCatMn
+xmlUCSIsCatN
+xmlUCSIsCatNd
+xmlUCSIsCatNl
+xmlUCSIsCatNo
+xmlUCSIsCatP
+xmlUCSIsCatPc
+xmlUCSIsCatPd
+xmlUCSIsCatPe
+xmlUCSIsCatPf
+xmlUCSIsCatPi
+xmlUCSIsCatPo
+xmlUCSIsCatPs
+xmlUCSIsCatS
+xmlUCSIsCatSc
+xmlUCSIsCatSk
+xmlUCSIsCatSm
+xmlUCSIsCatSo
+xmlUCSIsCatZ
+xmlUCSIsCatZl
+xmlUCSIsCatZp
+xmlUCSIsCatZs
+xmlUCSIsCherokee
+xmlUCSIsCombiningDiacriticalMarks
+xmlUCSIsCombiningDiacriticalMarksforSymbols
+xmlUCSIsCombiningHalfMarks
+xmlUCSIsCombiningMarksforSymbols
+xmlUCSIsControlPictures
+xmlUCSIsCurrencySymbols
+xmlUCSIsCypriotSyllabary
+xmlUCSIsCyrillic
+xmlUCSIsCyrillicSupplement
+xmlUCSIsDeseret
+xmlUCSIsDevanagari
+xmlUCSIsDingbats
+xmlUCSIsEnclosedAlphanumerics
+xmlUCSIsEnclosedCJKLettersandMonths
+xmlUCSIsEthiopic
+xmlUCSIsGeneralPunctuation
+xmlUCSIsGeometricShapes
+xmlUCSIsGeorgian
+xmlUCSIsGothic
+xmlUCSIsGreek
+xmlUCSIsGreekExtended
+xmlUCSIsGreekandCoptic
+xmlUCSIsGujarati
+xmlUCSIsGurmukhi
+xmlUCSIsHalfwidthandFullwidthForms
+xmlUCSIsHangulCompatibilityJamo
+xmlUCSIsHangulJamo
+xmlUCSIsHangulSyllables
+xmlUCSIsHanunoo
+xmlUCSIsHebrew
+xmlUCSIsHighPrivateUseSurrogates
+xmlUCSIsHighSurrogates
+xmlUCSIsHiragana
+xmlUCSIsIPAExtensions
+xmlUCSIsIdeographicDescriptionCharacters
+xmlUCSIsKanbun
+xmlUCSIsKangxiRadicals
+xmlUCSIsKannada
+xmlUCSIsKatakana
+xmlUCSIsKatakanaPhoneticExtensions
+xmlUCSIsKhmer
+xmlUCSIsKhmerSymbols
+xmlUCSIsLao
+xmlUCSIsLatin1Supplement
+xmlUCSIsLatinExtendedA
+xmlUCSIsLatinExtendedAdditional
+xmlUCSIsLatinExtendedB
+xmlUCSIsLetterlikeSymbols
+xmlUCSIsLimbu
+xmlUCSIsLinearBIdeograms
+xmlUCSIsLinearBSyllabary
+xmlUCSIsLowSurrogates
+xmlUCSIsMalayalam
+xmlUCSIsMathematicalAlphanumericSymbols
+xmlUCSIsMathematicalOperators
+xmlUCSIsMiscellaneousMathematicalSymbolsA
+xmlUCSIsMiscellaneousMathematicalSymbolsB
+xmlUCSIsMiscellaneousSymbols
+xmlUCSIsMiscellaneousSymbolsandArrows
+xmlUCSIsMiscellaneousTechnical
+xmlUCSIsMongolian
+xmlUCSIsMusicalSymbols
+xmlUCSIsMyanmar
+xmlUCSIsNumberForms
+xmlUCSIsOgham
+xmlUCSIsOldItalic
+xmlUCSIsOpticalCharacterRecognition
+xmlUCSIsOriya
+xmlUCSIsOsmanya
+xmlUCSIsPhoneticExtensions
+xmlUCSIsPrivateUse
+xmlUCSIsPrivateUseArea
+xmlUCSIsRunic
+xmlUCSIsShavian
+xmlUCSIsSinhala
+xmlUCSIsSmallFormVariants
+xmlUCSIsSpacingModifierLetters
+xmlUCSIsSpecials
+xmlUCSIsSuperscriptsandSubscripts
+xmlUCSIsSupplementalArrowsA
+xmlUCSIsSupplementalArrowsB
+xmlUCSIsSupplementalMathematicalOperators
+xmlUCSIsSupplementaryPrivateUseAreaA
+xmlUCSIsSupplementaryPrivateUseAreaB
+xmlUCSIsSyriac
+xmlUCSIsTagalog
+xmlUCSIsTagbanwa
+xmlUCSIsTags
+xmlUCSIsTaiLe
+xmlUCSIsTaiXuanJingSymbols
+xmlUCSIsTamil
+xmlUCSIsTelugu
+xmlUCSIsThaana
+xmlUCSIsThai
+xmlUCSIsTibetan
+xmlUCSIsUgaritic
+xmlUCSIsUnifiedCanadianAboriginalSyllabics
+xmlUCSIsVariationSelectors
+xmlUCSIsVariationSelectorsSupplement
+xmlUCSIsYiRadicals
+xmlUCSIsYiSyllables
+xmlUCSIsYijingHexagramSymbols
+xmlURIEscape
+xmlURIEscapeStr
+xmlURIUnescapeString
+xmlUTF8Charcmp
+xmlUTF8Size
+xmlUTF8Strlen
+xmlUTF8Strloc
+xmlUTF8Strndup
+xmlUTF8Strpos
+xmlUTF8Strsize
+xmlUTF8Strsub
+xmlUnlinkNode
+xmlUnlockLibrary
+xmlUnsetNsProp
+xmlUnsetProp
+xmlValidBuildContentModel
+xmlValidCtxtNormalizeAttributeValue
+xmlValidGetPotentialChildren
+xmlValidGetValidElements
+xmlValidNormalizeAttributeValue
+xmlValidateAttributeDecl
+xmlValidateAttributeValue
+xmlValidateDocument
+xmlValidateDocumentFinal
+xmlValidateDtd
+xmlValidateDtdFinal
+xmlValidateElement
+xmlValidateElementDecl
+xmlValidateNCName
+xmlValidateNMToken
+xmlValidateName
+xmlValidateNameValue
+xmlValidateNamesValue
+xmlValidateNmtokenValue
+xmlValidateNmtokensValue
+xmlValidateNotationDecl
+xmlValidateNotationUse
+xmlValidateOneAttribute
+xmlValidateOneElement
+xmlValidateOneNamespace
+xmlValidatePopElement
+xmlValidatePushCData
+xmlValidatePushElement
+xmlValidateQName
+xmlValidateRoot
+xmlXIncludeFreeContext
+xmlXIncludeNewContext
+xmlXIncludeProcess
+xmlXIncludeProcessFlags
+xmlXIncludeProcessNode
+xmlXIncludeProcessTree
+xmlXIncludeProcessTreeFlags
+xmlXIncludeSetFlags
+xmlXPathAddValues
+xmlXPathBooleanFunction
+xmlXPathCastBooleanToNumber
+xmlXPathCastBooleanToString
+xmlXPathCastNodeSetToBoolean
+xmlXPathCastNodeSetToNumber
+xmlXPathCastNodeSetToString
+xmlXPathCastNodeToNumber
+xmlXPathCastNodeToString
+xmlXPathCastNumberToBoolean
+xmlXPathCastNumberToString
+xmlXPathCastStringToBoolean
+xmlXPathCastStringToNumber
+xmlXPathCastToBoolean
+xmlXPathCastToNumber
+xmlXPathCastToString
+xmlXPathCeilingFunction
+xmlXPathCmpNodes
+xmlXPathCompareValues
+xmlXPathCompile
+xmlXPathCompiledEval
+xmlXPathCompiledEvalToBoolean
+xmlXPathConcatFunction
+xmlXPathContainsFunction
+xmlXPathContextSetCache
+xmlXPathConvertBoolean
+xmlXPathConvertNumber
+xmlXPathConvertString
+xmlXPathCountFunction
+xmlXPathCtxtCompile
+xmlXPathDebugDumpCompExpr
+xmlXPathDebugDumpObject
+xmlXPathDifference
+xmlXPathDistinct
+xmlXPathDistinctSorted
+xmlXPathDivValues
+xmlXPathEqualValues
+xmlXPathErr
+xmlXPathEval
+xmlXPathEvalExpr
+xmlXPathEvalExpression
+xmlXPathEvalPredicate
+xmlXPathEvaluatePredicateResult
+xmlXPathFalseFunction
+xmlXPathFloorFunction
+xmlXPathFreeCompExpr
+xmlXPathFreeContext
+xmlXPathFreeNodeSet
+xmlXPathFreeNodeSetList
+xmlXPathFreeObject
+xmlXPathFreeParserContext
+xmlXPathFunctionLookup
+xmlXPathFunctionLookupNS
+xmlXPathHasSameNodes
+xmlXPathIdFunction
+xmlXPathInit
+xmlXPathIntersection
+xmlXPathIsInf
+xmlXPathIsNaN
+xmlXPathIsNodeType
+xmlXPathLangFunction
+xmlXPathLastFunction
+xmlXPathLeading
+xmlXPathLeadingSorted
+xmlXPathLocalNameFunction
+xmlXPathModValues
+xmlXPathMultValues
+xmlXPathNamespaceURIFunction
+xmlXPathNewBoolean
+xmlXPathNewCString
+xmlXPathNewContext
+xmlXPathNewFloat
+xmlXPathNewNodeSet
+xmlXPathNewNodeSetList
+xmlXPathNewParserContext
+xmlXPathNewString
+xmlXPathNewValueTree
+xmlXPathNextAncestor
+xmlXPathNextAncestorOrSelf
+xmlXPathNextAttribute
+xmlXPathNextChild
+xmlXPathNextDescendant
+xmlXPathNextDescendantOrSelf
+xmlXPathNextFollowing
+xmlXPathNextFollowingSibling
+xmlXPathNextNamespace
+xmlXPathNextParent
+xmlXPathNextPreceding
+xmlXPathNextPrecedingSibling
+xmlXPathNextSelf
+xmlXPathNodeLeading
+xmlXPathNodeLeadingSorted
+xmlXPathNodeSetAdd
+xmlXPathNodeSetAddNs
+xmlXPathNodeSetAddUnique
+xmlXPathNodeSetContains
+xmlXPathNodeSetCreate
+xmlXPathNodeSetDel
+xmlXPathNodeSetFreeNs
+xmlXPathNodeSetMerge
+xmlXPathNodeSetRemove
+xmlXPathNodeSetSort
+xmlXPathNodeTrailing
+xmlXPathNodeTrailingSorted
+xmlXPathNormalizeFunction
+xmlXPathNotEqualValues
+xmlXPathNotFunction
+xmlXPathNsLookup
+xmlXPathNumberFunction
+xmlXPathObjectCopy
+xmlXPathOrderDocElems
+xmlXPathParseNCName
+xmlXPathParseName
+xmlXPathPopBoolean
+xmlXPathPopExternal
+xmlXPathPopNodeSet
+xmlXPathPopNumber
+xmlXPathPopString
+xmlXPathPositionFunction
+xmlXPathRegisterAllFunctions
+xmlXPathRegisterFunc
+xmlXPathRegisterFuncLookup
+xmlXPathRegisterFuncNS
+xmlXPathRegisterNs
+xmlXPathRegisterVariable
+xmlXPathRegisterVariableLookup
+xmlXPathRegisterVariableNS
+xmlXPathRegisteredFuncsCleanup
+xmlXPathRegisteredNsCleanup
+xmlXPathRegisteredVariablesCleanup
+xmlXPathRoot
+xmlXPathRoundFunction
+xmlXPathStartsWithFunction
+xmlXPathStringEvalNumber
+xmlXPathStringFunction
+xmlXPathStringLengthFunction
+xmlXPathSubValues
+xmlXPathSubstringAfterFunction
+xmlXPathSubstringBeforeFunction
+xmlXPathSubstringFunction
+xmlXPathSumFunction
+xmlXPathTrailing
+xmlXPathTrailingSorted
+xmlXPathTranslateFunction
+xmlXPathTrueFunction
+xmlXPathValueFlipSign
+xmlXPathVariableLookup
+xmlXPathVariableLookupNS
+xmlXPathWrapCString
+xmlXPathWrapExternal
+xmlXPathWrapNodeSet
+xmlXPathWrapString
+xmlXPatherror
+xmlXPtrBuildNodeList
+xmlXPtrEval
+xmlXPtrEvalRangePredicate
+xmlXPtrFreeLocationSet
+xmlXPtrLocationSetAdd
+xmlXPtrLocationSetCreate
+xmlXPtrLocationSetDel
+xmlXPtrLocationSetMerge
+xmlXPtrLocationSetRemove
+xmlXPtrNewCollapsedRange
+xmlXPtrNewContext
+xmlXPtrNewLocationSetNodeSet
+xmlXPtrNewLocationSetNodes
+xmlXPtrNewRange
+xmlXPtrNewRangeNodeObject
+xmlXPtrNewRangeNodePoint
+xmlXPtrNewRangeNodes
+xmlXPtrNewRangePointNode
+xmlXPtrNewRangePoints
+xmlXPtrRangeToFunction
+xmlXPtrWrapLocationSet
diff --git a/ext/mbstring/libmbfl/nls/nls_hy.c b/ext/mbstring/libmbfl/nls/nls_hy.c
index a2511484c..1c4b38351 100644
--- a/ext/mbstring/libmbfl/nls/nls_hy.c
+++ b/ext/mbstring/libmbfl/nls/nls_hy.c
@@ -11,7 +11,7 @@
const mbfl_language mbfl_language_armenian = {
mbfl_no_language_armenian ,
- "Armenian ",
+ "Armenian",
"hy",
NULL,
mbfl_no_encoding_armscii8,
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index 1cae5788e..f6a175d8d 100644
--- a/ext/mbstring/mb_gpc.c
+++ b/ext/mbstring/mb_gpc.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mb_gpc.c,v 1.17.2.2.2.3 2007/03/18 16:36:13 iliaa Exp $ */
+/* $Id: mb_gpc.c,v 1.17.2.2.2.4 2007/12/31 07:20:07 sebastian Exp $ */
/* {{{ includes */
#ifdef HAVE_CONFIG_H
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index d269a2225..7d2e2840c 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.c,v 1.224.2.22.2.25 2007/09/24 11:51:36 hirokawa Exp $ */
+/* $Id: mbstring.c,v 1.224.2.22.2.30 2008/02/17 02:06:56 hirokawa Exp $ */
/*
* PHP 4 Multibyte String module "mbstring"
@@ -888,6 +888,8 @@ PHP_RINIT_FUNCTION(mbstring)
const struct mb_overload_def *p;
MBSTRG(current_language) = MBSTRG(language);
+ php_mb_nls_get_default_detect_order_list(MBSTRG(language),
+ &MBSTRG(default_detect_order_list), &MBSTRG(default_detect_order_list_size));
if (MBSTRG(internal_encoding) == mbfl_no_encoding_invalid) {
char *default_enc = NULL;
@@ -1611,7 +1613,7 @@ PHP_FUNCTION(mb_strpos)
}
}
- if (offset < 0 || (unsigned long)offset > haystack.len) {
+ if (offset < 0 || (unsigned long)offset > (unsigned long)mbfl_strlen(&haystack)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string.");
RETURN_FALSE;
}
@@ -1724,6 +1726,13 @@ PHP_FUNCTION(mb_strrpos)
if (needle.len <= 0) {
RETURN_FALSE;
}
+
+ if ((offset > 0 && offset > mbfl_strlen(&haystack)) ||
+ (offset < 0 && -offset > mbfl_strlen(&haystack))) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string");
+ RETURN_FALSE;
+ }
+
n = mbfl_strpos(&haystack, &needle, offset, 1);
if (n >= 0) {
RETVAL_LONG(n);
@@ -2325,7 +2334,7 @@ PHP_FUNCTION(mb_strimwidth)
convert_to_long_ex(arg2);
from = Z_LVAL_PP(arg2);
if (from < 0 || from > Z_STRLEN_PP(arg1)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Start position is out of reange");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Start position is out of range");
RETURN_FALSE;
}
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
index ae184a0ac..02765d17f 100644
--- a/ext/mbstring/mbstring.h
+++ b/ext/mbstring/mbstring.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.h,v 1.66.2.4.2.5 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: mbstring.h,v 1.66.2.4.2.6 2007/12/31 07:20:07 sebastian Exp $ */
/*
* PHP 4 Multibyte String module "mbstring" (currently only for Japanese)
diff --git a/ext/mbstring/oniguruma/enc/utf16_be.c b/ext/mbstring/oniguruma/enc/utf16_be.c
index 250a0cf34..536d107d6 100755
--- a/ext/mbstring/oniguruma/enc/utf16_be.c
+++ b/ext/mbstring/oniguruma/enc/utf16_be.c
@@ -2,7 +2,7 @@
utf16_be.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/enc/utf16_le.c b/ext/mbstring/oniguruma/enc/utf16_le.c
index c2d860ed0..cefcb60ad 100755
--- a/ext/mbstring/oniguruma/enc/utf16_le.c
+++ b/ext/mbstring/oniguruma/enc/utf16_le.c
@@ -2,7 +2,7 @@
utf16_le.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/enc/utf32_be.c b/ext/mbstring/oniguruma/enc/utf32_be.c
index c98b910ba..c1f066897 100755
--- a/ext/mbstring/oniguruma/enc/utf32_be.c
+++ b/ext/mbstring/oniguruma/enc/utf32_be.c
@@ -2,7 +2,7 @@
utf32_be.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/enc/utf32_le.c b/ext/mbstring/oniguruma/enc/utf32_le.c
index 043a86074..c10cbfa77 100755
--- a/ext/mbstring/oniguruma/enc/utf32_le.c
+++ b/ext/mbstring/oniguruma/enc/utf32_le.c
@@ -2,7 +2,7 @@
utf32_le.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/enc/utf8.c b/ext/mbstring/oniguruma/enc/utf8.c
index 4188aa910..42ce807f9 100644
--- a/ext/mbstring/oniguruma/enc/utf8.c
+++ b/ext/mbstring/oniguruma/enc/utf8.c
@@ -2,7 +2,7 @@
utf8.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/oniguruma.h b/ext/mbstring/oniguruma/oniguruma.h
index 0cd7e2593..5fb6ec154 100644
--- a/ext/mbstring/oniguruma/oniguruma.h
+++ b/ext/mbstring/oniguruma/oniguruma.h
@@ -4,7 +4,7 @@
oniguruma.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regcomp.c b/ext/mbstring/oniguruma/regcomp.c
index e441516c3..a679a20b2 100644
--- a/ext/mbstring/oniguruma/regcomp.c
+++ b/ext/mbstring/oniguruma/regcomp.c
@@ -2,7 +2,7 @@
regcomp.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regenc.h b/ext/mbstring/oniguruma/regenc.h
index a10c738b5..833dd2af4 100644
--- a/ext/mbstring/oniguruma/regenc.h
+++ b/ext/mbstring/oniguruma/regenc.h
@@ -4,7 +4,7 @@
regenc.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regerror.c b/ext/mbstring/oniguruma/regerror.c
index 4888fe00f..46dc6ae15 100644
--- a/ext/mbstring/oniguruma/regerror.c
+++ b/ext/mbstring/oniguruma/regerror.c
@@ -2,7 +2,7 @@
regerror.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regexec.c b/ext/mbstring/oniguruma/regexec.c
index 0715b2afc..a1685c8c6 100644
--- a/ext/mbstring/oniguruma/regexec.c
+++ b/ext/mbstring/oniguruma/regexec.c
@@ -2,7 +2,7 @@
regexec.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regext.c b/ext/mbstring/oniguruma/regext.c
index f03b40e2a..1586012b8 100755
--- a/ext/mbstring/oniguruma/regext.c
+++ b/ext/mbstring/oniguruma/regext.c
@@ -2,7 +2,7 @@
regext.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/reggnu.c b/ext/mbstring/oniguruma/reggnu.c
index b52486595..fdc7974ae 100644
--- a/ext/mbstring/oniguruma/reggnu.c
+++ b/ext/mbstring/oniguruma/reggnu.c
@@ -2,7 +2,7 @@
reggnu.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regint.h b/ext/mbstring/oniguruma/regint.h
index 1be9efb97..4eff34c3b 100644
--- a/ext/mbstring/oniguruma/regint.h
+++ b/ext/mbstring/oniguruma/regint.h
@@ -4,7 +4,7 @@
regint.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regparse.c b/ext/mbstring/oniguruma/regparse.c
index 6066631ed..26fc35b11 100644
--- a/ext/mbstring/oniguruma/regparse.c
+++ b/ext/mbstring/oniguruma/regparse.c
@@ -2,7 +2,7 @@
regparse.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regparse.h b/ext/mbstring/oniguruma/regparse.h
index 007d982ce..c0cdded7b 100644
--- a/ext/mbstring/oniguruma/regparse.h
+++ b/ext/mbstring/oniguruma/regparse.h
@@ -4,7 +4,7 @@
regparse.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regposix.c b/ext/mbstring/oniguruma/regposix.c
index c61a6ce7f..23ae95693 100644
--- a/ext/mbstring/oniguruma/regposix.c
+++ b/ext/mbstring/oniguruma/regposix.c
@@ -2,7 +2,7 @@
regposix.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regsyntax.c b/ext/mbstring/oniguruma/regsyntax.c
index 4c2f39b67..542e599c8 100644
--- a/ext/mbstring/oniguruma/regsyntax.c
+++ b/ext/mbstring/oniguruma/regsyntax.c
@@ -2,7 +2,7 @@
regsyntax.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ext/mbstring/oniguruma/regversion.c b/ext/mbstring/oniguruma/regversion.c
index d1e01d75d..cbebdb026 100644
--- a/ext/mbstring/oniguruma/regversion.c
+++ b/ext/mbstring/oniguruma/regversion.c
@@ -2,7 +2,7 @@
regversion.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@ onig_copyright(void)
{
static char s[58];
- sprintf(s, "Oniguruma %d.%d.%d : Copyright (C) 2002-2007 K.Kosako",
+ sprintf(s, "Oniguruma %d.%d.%d : Copyright (C) 2002-2008 K.Kosako",
ONIGURUMA_VERSION_MAJOR,
ONIGURUMA_VERSION_MINOR,
ONIGURUMA_VERSION_TEENY);
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index f22d54098..be4921edd 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mbregex.c,v 1.53.2.1.2.4 2007/01/11 22:23:20 tony2001 Exp $ */
+/* $Id: php_mbregex.c,v 1.53.2.1.2.7 2008/02/17 02:04:12 hirokawa Exp $ */
#ifdef HAVE_CONFIG_H
@@ -546,6 +546,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
convert_to_string_ex(arg_pattern);
/* don't bother doing an extended regex with just a number */
}
+
+ if (!Z_STRVAL_PP(arg_pattern) || Z_STRLEN_PP(arg_pattern) == 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "empty pattern");
+ RETVAL_FALSE;
+ goto out;
+ }
+
re = php_mbregex_compile_pattern(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern), options, MBSTRG(current_mbctype), MBSTRG(regex_default_syntax) TSRMLS_CC);
if (re == NULL) {
RETVAL_FALSE;
@@ -737,7 +744,12 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
/* null terminate buffer */
smart_str_appendc(&eval_buf, '\0');
/* do eval */
- zend_eval_string(eval_buf.c, &v, description TSRMLS_CC);
+ if (zend_eval_string(eval_buf.c, &v, description TSRMLS_CC) == FAILURE) {
+ efree(description);
+ php_error_docref(NULL TSRMLS_CC,E_ERROR, "Failed evaluating code: %s%s", PHP_EOL, eval_buf.c);
+ /* zend_error() does not return in this case */
+ }
+
/* result of eval */
convert_to_string(&v);
smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v));
diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h
index ff90e9d2a..e583b0063 100644
--- a/ext/mbstring/php_mbregex.h
+++ b/ext/mbstring/php_mbregex.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mbregex.h,v 1.12.2.1.2.1 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: php_mbregex.h,v 1.12.2.1.2.2 2007/12/31 07:20:07 sebastian Exp $ */
#ifndef _PHP_MBREGEX_H
#define _PHP_MBREGEX_H
diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c
index 1f1d8cb84..d90cabb84 100644
--- a/ext/mbstring/php_unicode.c
+++ b/ext/mbstring/php_unicode.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -276,6 +276,11 @@ MBSTRING_API char *php_unicode_convert_case(int case_mode, char *srcstr, size_t
size_t i;
enum mbfl_no_encoding _src_encoding = mbfl_name2no_encoding(src_encoding);
+ if (_src_encoding == mbfl_no_encoding_invalid) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", src_encoding);
+ return NULL;
+ }
+
unicode = php_mb_convert_encoding(srcstr, srclen, "UCS-4BE", src_encoding, &unicode_len TSRMLS_CC);
if (unicode == NULL)
return NULL;
diff --git a/ext/mbstring/php_unicode.h b/ext/mbstring/php_unicode.h
index 3ae4246d4..1bbc77830 100644
--- a/ext/mbstring/php_unicode.h
+++ b/ext/mbstring/php_unicode.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/mbstring/tests/bug43301.phpt b/ext/mbstring/tests/bug43301.phpt
new file mode 100644
index 000000000..858520fdf
--- /dev/null
+++ b/ext/mbstring/tests/bug43301.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #43301 (mb_ereg*_replace() crashes when replacement string is invalid PHP expression and 'e' option is used)
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+
+$ptr = 'hello';
+
+$txt = <<<doc
+hello, I have got a cr*sh on you
+doc;
+
+echo mb_ereg_replace($ptr,'$1',$txt,'e');
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in %s/bug43301.php(%d) : mbregex replace on line 1
+
+Fatal error: mb_ereg_replace(): Failed evaluating code:
+$1 in %s/bug43301.php on line %d
diff --git a/ext/mbstring/tests/mb_convert_encoding_basic.phpt b/ext/mbstring/tests/mb_convert_encoding_basic.phpt
new file mode 100644
index 000000000..d7f194eb2
--- /dev/null
+++ b/ext/mbstring/tests/mb_convert_encoding_basic.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test mb_convert_encoding() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_convert_encoding') or die("skip mb_convert_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_convert_encoding(string $str, string $to_encoding [, mixed $from_encoding])
+ * Description: Returns converted string in desired encoding
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_convert_encoding()
+ */
+
+echo "*** Testing mb_convert_encoding() : basic functionality ***\n";
+
+//All strings are the same when displayed in their respective encodings
+$sjis_string = base64_decode('k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
+$jis_string = base64_decode('GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==');
+$euc_jp_string = base64_decode('xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow==');
+$utf8_string = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- Convert to JIS --\n";
+echo "JIS encoded string in base64:\n";
+var_dump(base64_encode($jis_string));
+echo "Converted Strings:\n";
+var_dump(base64_encode(mb_convert_encoding($sjis_string, 'JIS', 'SJIS')));
+var_dump(base64_encode(mb_convert_encoding($euc_jp_string, 'JIS', 'EUC-JP')));
+var_dump(base64_encode(mb_convert_encoding($utf8_string, 'JIS', 'UTF-8')));
+
+echo "\n-- Convert to EUC-JP --\n";
+echo "EUC-JP encoded string in base64:\n";
+var_dump(base64_encode($euc_jp_string));
+echo "Converted Strings:\n";
+var_dump(base64_encode(mb_convert_encoding($sjis_string, 'EUC-JP', 'SJIS')));
+var_dump(base64_encode(mb_convert_encoding($jis_string, 'EUC-JP', 'JIS')));
+var_dump(base64_encode(mb_convert_encoding($utf8_string, 'EUC-JP', 'UTF-8')));
+
+echo "\n-- Convert to SJIS --\n";
+echo "SJIS encoded string in base64:\n";
+var_dump(base64_encode($sjis_string));
+echo "Converted Strings:\n";
+var_dump(base64_encode(mb_convert_encoding($jis_string, 'SJIS', 'JIS')));
+var_dump(base64_encode(mb_convert_encoding($euc_jp_string, 'SJIS', 'EUC-JP')));
+var_dump(base64_encode(mb_convert_encoding($utf8_string, 'SJIS', 'UTF-8')));
+
+echo "\n-- Convert to UTF-8 --\n";
+echo "UTF-8 encoded string in base64:\n";
+var_dump(base64_encode($utf8_string));
+echo "Converted Strings:\n";
+var_dump(base64_encode(mb_convert_encoding($sjis_string, 'UTF-8', 'SJIS')));
+var_dump(base64_encode(mb_convert_encoding($jis_string, 'UTF-8', 'JIS')));
+var_dump(base64_encode(mb_convert_encoding($euc_jp_string, 'UTF-8', 'EUC-JP')));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_convert_encoding() : basic functionality ***
+
+-- Convert to JIS --
+JIS encoded string in base64:
+string(68) "GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg=="
+Converted Strings:
+string(68) "GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg=="
+string(68) "GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg=="
+string(68) "GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg=="
+
+-- Convert to EUC-JP --
+EUC-JP encoded string in base64:
+string(52) "xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow=="
+Converted Strings:
+string(52) "xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow=="
+string(52) "xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow=="
+string(52) "xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow=="
+
+-- Convert to SJIS --
+SJIS encoded string in base64:
+string(52) "k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg=="
+Converted Strings:
+string(52) "k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg=="
+string(52) "k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg=="
+string(52) "k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg=="
+
+-- Convert to UTF-8 --
+UTF-8 encoded string in base64:
+string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+Converted Strings:
+string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
new file mode 100644
index 000000000..fb0c28166
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test mb_encode_mimeheader() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer-encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_encode_mimeheader with different strings.
+ * For the below strings:
+ * 'English' is ASCII only, 'Japanese' has no ASCII characters and 'Greek' is mixed.
+ */
+
+echo "*** Testing mb_encode_mimeheader() : basic ***\n";
+mb_internal_encoding('utf-8');
+
+$inputs = array('English' => 'This is an English string. 0123456789',
+ 'Japanese' => base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC'),
+ 'Greek' => base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg=='));
+
+foreach ($inputs as $lang => $input) {
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q'));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : basic ***
+
+Language: English
+-- Base 64: --
+string(37) "This is an English string. 0123456789"
+-- Quoted-Printable --
+string(37) "This is an English string. 0123456789"
+
+Language: Japanese
+-- Base 64: --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+-- Quoted-Printable --
+string(117) "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
+ =?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82?="
+
+Language: Greek
+-- Base 64: --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+-- Quoted-Printable --
+string(249) "=?UTF-8?Q?=CE=91=CF=85=CF=84=CF=8C=20=CE=B5=CE=AF=CE=BD=CE=B1=CE=B9=20?=
+ =?UTF-8?Q?=CE=B5=CE=BB=CE=BB=CE=B7=CE=BD=CE=B9=CE=BA=CF=8C=20=CE=BA=CE=B5?=
+ =?UTF-8?Q?=CE=AF=CE=BC=CE=B5=CE=BD=CE=BF=2E=20=30=31=32=33=34=35=36=37=38?=
+ =?UTF-8?Q?=39=2E?="
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt
new file mode 100644
index 000000000..f440e1d44
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation1.phpt
@@ -0,0 +1,186 @@
+--TEST--
+Test mb_encode_mimeheader() function : usage variations - Pass different data types to $str arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $str argument to see how mb_encode_mimeheader() behaves
+ */
+
+echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
+
+mb_internal_encoding('utf-8');
+
+// Initialise function arguments not being substituted
+$charset = 'utf-8';
+$transfer_encoding = 'B';
+$linefeed = "\r\n";
+$indent = 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 $str argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_encode_mimeheader()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_encode_mimeheader($input, $charset, $transfer_encoding, $linefeed, $indent));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : 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) "123456789000"
+
+-- Iteration 8 --
+string(13) "1.23456789E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+
+-- Iteration 10 --
+string(0) ""
+
+-- Iteration 11 --
+string(0) ""
+
+-- 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 --
+string(11) "hello world"
+
+-- Iteration 21 --
+string(14) "Class A object"
+
+-- Iteration 22 --
+string(0) ""
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+
+Warning: mb_encode_mimeheader() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation2.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation2.phpt
new file mode 100644
index 000000000..855c3b33b
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation2.phpt
@@ -0,0 +1,224 @@
+--TEST--
+Test mb_encode_mimeheader() function : usage variations - Pass different data types to $charset arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $charset argument to see how mb_encode_mimeheader() behaves
+ */
+
+echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
+
+mb_internal_encoding('utf-8');
+
+// Initialise function arguments not being substituted
+$str = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
+$transfer_encoding = 'B';
+$linefeed = "\r\n";
+$indent = 2;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+utf-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $charset argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "utf-8",
+ 'utf-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_encode_mimeheader()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_encode_mimeheader($str, $input, $transfer_encoding, $linefeed, $indent));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 19 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 20 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 21 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 22 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_encode_mimeheader(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_encode_mimeheader() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation3.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation3.phpt
new file mode 100644
index 000000000..8c6bf08e7
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation3.phpt
@@ -0,0 +1,186 @@
+--TEST--
+Test mb_encode_mimeheader() function : usage variations - Pass different data types to $transfer_encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $transfer_encoding argument to see how mb_encode_mimeheader() behaves
+ */
+
+echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
+
+mb_internal_encoding('utf-8');
+
+// Initialise function arguments not being substituted
+$str = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
+$charset = 'utf-8';
+$linefeed = "\r\n";
+$indent = 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 $transfer_encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_encode_mimeheader()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_encode_mimeheader($str, $charset, $input, $linefeed, $indent));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : usage variations ***
+
+-- Iteration 1 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 2 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 3 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 4 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 5 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 6 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 7 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 8 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 9 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 10 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 11 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 12 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 13 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 14 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 15 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 16 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 17 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 18 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 19 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 20 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 21 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 22 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 23 --
+string(52) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?="
+
+-- Iteration 24 --
+
+Warning: mb_encode_mimeheader() expects parameter 3 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation4.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation4.phpt
new file mode 100644
index 000000000..64e236d70
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation4.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test mb_encode_mimeheader() function : usage variations - Pass different data types to $linefeed arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $linefeed argument to see how mb_encode_mimeheader() behaves
+ */
+
+echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
+mb_internal_encoding('utf-8');
+
+
+// Initialise function arguments not being substituted
+//longer $str to go over 1 line
+$str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
+$charset = 'utf-8';
+$transfer_encoding = 'B';
+$indent = 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 $linefeed argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_encode_mimeheader()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_encode_mimeheader($str, $charset, $transfer_encoding, $input, $indent));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : usage variations ***
+
+-- Iteration 1 --
+string(114) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=0 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 2 --
+string(114) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=1 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 3 --
+string(118) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=12345 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 4 --
+string(118) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=-2345 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 5 --
+string(117) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=10.5 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 6 --
+string(118) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=-10.5 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 7 --
+string(121) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=12345678 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 8 --
+string(121) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=1.234567 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 9 --
+string(116) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=0.5 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 10 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 11 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 12 --
+string(114) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=1 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 13 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 14 --
+string(114) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=1 =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 15 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 16 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 17 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 18 --
+string(119) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=string =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 19 --
+string(119) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=string =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 20 --
+string(121) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=hello wo =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 21 --
+string(121) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=Class A =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 22 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 23 --
+string(113) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?= =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 24 --
+
+Warning: mb_encode_mimeheader() expects parameter 4 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation5.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation5.phpt
new file mode 100644
index 000000000..593b3c15a
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation5.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test mb_encode_mimeheader() function : usage variations - Pass different data types to $indent arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $indent argument to see how mb_encode_mimeheader() behaves
+ */
+
+echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
+
+mb_internal_encoding('utf-8');
+
+// Initialise function arguments not being substituted
+$str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
+$charset = 'utf-8';
+$transfer_encoding = 'B';
+$linefeed = "\r\n";
+
+//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 $indent argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_encode_mimeheader()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_encode_mimeheader($str, $charset, $transfer_encoding, $linefeed, $input));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : usage variations ***
+
+-- Iteration 1 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 2 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 3 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 4 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 5 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66?=
+ =?UTF-8?B?zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 6 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 7 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 8 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 9 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 10 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 11 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 12 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 13 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 14 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 15 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 16 --
+
+Warning: mb_encode_mimeheader() expects parameter 5 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: mb_encode_mimeheader() expects parameter 5 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mb_encode_mimeheader() expects parameter 5 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mb_encode_mimeheader() expects parameter 5 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mb_encode_mimeheader() expects parameter 5 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mb_encode_mimeheader() expects parameter 5 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 22 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 23 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 24 --
+
+Warning: mb_encode_mimeheader() expects parameter 5 to be long, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt
new file mode 100644
index 000000000..20ba5c17d
--- /dev/null
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test mb_encode_mimeheader() function : usage variations - Pass different strings to $linefeed arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_encode_mimeheader') or die("skip mb_encode_mimeheader() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_encode_mimeheader
+ * (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
+ * Description: Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?=
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different strings to $linefeed argument
+ */
+
+echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
+
+mb_internal_encoding('utf-8');
+
+$linefeeds = array("\r\n",
+ "\n",
+ "---");
+$str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
+
+$iterator = 1;
+foreach ($linefeeds as $linefeed) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_encode_mimeheader($str, 'utf-8', 'B', $linefeed));
+ $iterator++;
+}
+
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_encode_mimeheader() : usage variations ***
+
+-- Iteration 1 --
+string(115) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 2 --
+string(114) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=
+ =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+
+-- Iteration 3 --
+string(116) "=?UTF-8?B?zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868?=--- =?UTF-8?B?zrXOvc6/LiAwMTIzNDU2Nzg5Lg==?="
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg1.phpt b/ext/mbstring/tests/mb_ereg1.phpt
index e420312da..663d1b778 100644
--- a/ext/mbstring/tests/mb_ereg1.phpt
+++ b/ext/mbstring/tests/mb_ereg1.phpt
@@ -30,17 +30,16 @@ array(3) {
[2]=>
int(3)
}
-int(1)
+
+Warning: mb_ereg(): empty pattern in %s on line %d
+bool(false)
array(3) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
- array(1) {
- [0]=>
- bool(false)
- }
+ string(0) ""
}
Notice: Array to string conversion in %s on line %d
diff --git a/ext/mbstring/tests/mb_ereg_basic.phpt b/ext/mbstring/tests/mb_ereg_basic.phpt
new file mode 100644
index 000000000..0bdaf74ee
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_basic.phpt
@@ -0,0 +1,117 @@
+--TEST--
+Test mb_ereg() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test basic functionality of mb_ereg
+ */
+
+echo "*** Testing mb_ereg() : basic functionality ***\n";
+
+if(mb_regex_encoding('utf-8') == true) {
+ echo "Regex encoding set to utf-8\n";
+} else {
+ echo "Could not set regex encoding to utf-8\n";
+}
+$string_ascii = 'This is an English string. 0123456789.';
+$regex_ascii1 = '(.*is)+.*\.[[:blank:]][0-9]{9}';
+$regex_ascii2 = '.*is+';
+
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+$regex_mb1 = base64_decode('KOaXpeacrOiqnikuKj8oWzEtOV0rKQ==');
+$regex_mb2 = base64_decode('5LiW55WM');
+
+echo "\n**-- ASCII String --**\n";
+echo "-- Without \$regs argument--\n";
+var_dump(mb_ereg($regex_ascii1, $string_ascii));
+var_dump(mb_ereg($regex_ascii2, $string_ascii));
+echo "--With \$regs argument --\n";
+var_dump(mb_ereg($regex_ascii1, $string_ascii, $regs_ascii1));
+var_dump($regs_ascii1);
+var_dump(mb_ereg($regex_ascii2, $string_ascii, $regs_ascii2));
+var_dump($regs_ascii2);
+
+echo "\n**-- Multibyte String --**\n";
+echo "-- Without \$regs argument --\n";
+var_dump(mb_ereg($regex_mb1, $string_mb));
+var_dump(mb_ereg($regex_mb2, $string_mb));
+echo "-- With \$regs argument --\n";
+var_dump(mb_ereg($regex_mb1, $string_mb, $regs_mb1));
+base64_encode_var_dump($regs_mb1);
+var_dump(mb_ereg($regex_mb2, $string_mb, $regs_mb2));
+var_dump($regs_mb2);
+
+echo "Done";
+
+/**
+ * replicate a var dump of an array but outputted string values are base64 encoded
+ *
+ * @param array $regs
+ */
+function base64_encode_var_dump($regs) {
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
+}
+?>
+
+--EXPECTF--
+*** Testing mb_ereg() : basic functionality ***
+Regex encoding set to utf-8
+
+**-- ASCII String --**
+-- Without $regs argument--
+int(1)
+int(1)
+--With $regs argument --
+int(36)
+array(2) {
+ [0]=>
+ string(36) "This is an English string. 012345678"
+ [1]=>
+ string(17) "This is an Englis"
+}
+int(17)
+array(1) {
+ [0]=>
+ string(17) "This is an Englis"
+}
+
+**-- Multibyte String --**
+-- Without $regs argument --
+int(1)
+bool(false)
+-- With $regs argument --
+int(35)
+array(3) {
+ [0]=>
+ string(48) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzQ="
+ [1]=>
+ string(12) "5pel5pys6Kqe"
+ [2]=>
+ string(8) "MTIzNA=="
+}
+bool(false)
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_error.phpt b/ext/mbstring/tests/mb_ereg_error.phpt
new file mode 100644
index 000000000..21216257c
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_error.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test mb_ereg() function : error conditions - pass incorrect number of arguments
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test behaviour of mb_ereg() when passed an incorrcect number of arguments
+ */
+
+echo "*** Testing mb_ereg() : error conditions ***\n";
+
+
+//Test mb_ereg with one more than the expected number of arguments
+echo "\n-- Testing mb_ereg() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$registers = array(1, 2);
+$extra_arg = 10;
+var_dump( mb_ereg($pattern, $string, $registers, $extra_arg) );
+
+// Testing mb_ereg with one less than the expected number of arguments
+echo "\n-- Testing mb_ereg() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( mb_ereg($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_ereg() : error conditions ***
+
+-- Testing mb_ereg() function with more than expected no. of arguments --
+
+Warning: mb_ereg() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+-- Testing mb_ereg() function with less than expected no. of arguments --
+
+Warning: mb_ereg() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_ereg_variation1.phpt b/ext/mbstring/tests/mb_ereg_variation1.phpt
new file mode 100644
index 000000000..a8aa5d8ba
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_variation1.phpt
@@ -0,0 +1,165 @@
+--TEST--
+Test mb_ereg() function : usage variations - pass different data types to $pattern argument
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Pass different data types to $pattern argument
+ */
+
+echo "*** Testing mb_ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = 'string value';
+
+//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 $pattern argument
+$inputs = array(
+
+// int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+// float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+// boolean data
+/*10*/ true,
+ TRUE,
+
+// string data
+/*12*/ "string",
+ 'string',
+ $heredoc,
+
+// object data
+/*15*/ new classA(),
+
+// resource variable
+/*16*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_ereg()
+$iterator = 1;
+foreach($inputs as $input) {
+ if (@is_array($regs)){
+ $regs = null;
+ }
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_ereg($input, $string, $regs) );
+ var_dump($regs);
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_ereg() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+NULL
+
+-- Iteration 2 --
+bool(false)
+NULL
+
+-- Iteration 3 --
+bool(false)
+NULL
+
+-- Iteration 4 --
+bool(false)
+NULL
+
+-- Iteration 5 --
+bool(false)
+NULL
+
+-- Iteration 6 --
+bool(false)
+NULL
+
+-- Iteration 7 --
+bool(false)
+NULL
+
+-- Iteration 8 --
+bool(false)
+NULL
+
+-- Iteration 9 --
+bool(false)
+NULL
+
+-- Iteration 10 --
+bool(false)
+NULL
+
+-- Iteration 11 --
+bool(false)
+NULL
+
+-- Iteration 12 --
+int(6)
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+
+-- Iteration 13 --
+int(6)
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+
+-- Iteration 14 --
+bool(false)
+NULL
+
+-- Iteration 15 --
+bool(false)
+NULL
+
+-- Iteration 16 --
+bool(false)
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_variation2.phpt b/ext/mbstring/tests/mb_ereg_variation2.phpt
new file mode 100644
index 000000000..d85c8bd56
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_variation2.phpt
@@ -0,0 +1,216 @@
+--TEST--
+Test mb_ereg() function : usage variations - pass different data types to $string arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test behaviour of mb_ereg() when passed different data types as $string arg
+ */
+
+echo "*** Testing mb_ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$pattern = 'str';
+
+//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 $string argument
+$inputs = array(
+
+// int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+// float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+// null data
+/*10*/ NULL,
+ null,
+
+// boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+// 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 element of $inputs to check the behavior of mb_ereg()
+$iterator = 1;
+foreach($inputs as $input) {
+ if (@is_array($regs)){
+ $regs = null;
+ }
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_ereg($pattern, $input, $regs) );
+ var_dump($regs);
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+
+?>
+
+--EXPECTF--
+*** Testing mb_ereg() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+NULL
+
+-- Iteration 2 --
+bool(false)
+NULL
+
+-- Iteration 3 --
+bool(false)
+NULL
+
+-- Iteration 4 --
+bool(false)
+NULL
+
+-- Iteration 5 --
+bool(false)
+NULL
+
+-- Iteration 6 --
+bool(false)
+NULL
+
+-- Iteration 7 --
+bool(false)
+NULL
+
+-- Iteration 8 --
+bool(false)
+NULL
+
+-- Iteration 9 --
+bool(false)
+NULL
+
+-- Iteration 10 --
+bool(false)
+NULL
+
+-- Iteration 11 --
+bool(false)
+NULL
+
+-- Iteration 12 --
+bool(false)
+NULL
+
+-- Iteration 13 --
+bool(false)
+NULL
+
+-- Iteration 14 --
+bool(false)
+NULL
+
+-- Iteration 15 --
+bool(false)
+NULL
+
+-- Iteration 16 --
+bool(false)
+NULL
+
+-- Iteration 17 --
+bool(false)
+NULL
+
+-- Iteration 18 --
+int(3)
+array(1) {
+ [0]=>
+ string(3) "str"
+}
+
+-- Iteration 19 --
+int(3)
+array(1) {
+ [0]=>
+ string(3) "str"
+}
+
+-- Iteration 20 --
+bool(false)
+NULL
+
+-- Iteration 21 --
+bool(false)
+NULL
+
+-- Iteration 22 --
+bool(false)
+NULL
+
+-- Iteration 23 --
+bool(false)
+NULL
+
+-- Iteration 24 --
+
+Warning: mb_ereg() expects parameter 2 to be string, resource given in %s on line %d
+bool(false)
+NULL
+Done
diff --git a/ext/mbstring/tests/mb_ereg_variation3.phpt b/ext/mbstring/tests/mb_ereg_variation3.phpt
new file mode 100644
index 000000000..0236e4410
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_variation3.phpt
@@ -0,0 +1,163 @@
+--TEST--
+Test mb_ereg() function : usage variations - pass different character classes to see they match correctly
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * test that mb_ereg can match correctly when passed different character classes.
+ */
+
+echo "*** Testing mb_ereg() : variation ***\n";
+
+
+mb_regex_encoding('utf-8'); // have to set otherwise won't match $mb properly
+$mb = base64_decode('5pel5pys6Kqe');
+$character_classes = array ('aB1' => '[[:alnum:]]+', /*1*/
+ 'aBcD' => '[[:alpha:]]+',
+ 'ab/=' => '[[:ascii:]]+',
+ " \t" => '[[:blank:]]+',
+ '234' => '[[:digit:]]+', /*5*/
+ "$mb" => '[[:graph:]]+',
+ 'fjds' => '[[:lower:]]+',
+ "$mb\t" => '[[:print:]]+',
+ '.!"*@' => '[[:punct:]]+',
+ "\t" => '[[:space:]]+', /*10*/
+ 'IDSJV' => '[[:upper:]]+',
+ '3b5D' => '[[:xdigit:]]+'); /*12*/
+
+$iterator = 1;
+foreach($character_classes as $string => $pattern) {
+ if (is_array(@$regs)) {
+ $regs = null;
+ }
+ // make sure any multibyte output is in base 64
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_ereg($pattern, $string, $regs));
+ if (strpos($string, $mb) === FALSE) {
+ var_dump($regs);
+ } else {
+ base64_encode_var_dump($regs);
+ }
+ $iterator++;
+}
+/**
+ * replicate a var dump of an array but outputted string values are base64 encoded
+ *
+ * @param array $regs
+ */
+function base64_encode_var_dump($regs) {
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_ereg() : variation ***
+
+-- Iteration 1 --
+int(3)
+array(1) {
+ [0]=>
+ string(3) "aB1"
+}
+
+-- Iteration 2 --
+int(4)
+array(1) {
+ [0]=>
+ string(4) "aBcD"
+}
+
+-- Iteration 3 --
+int(4)
+array(1) {
+ [0]=>
+ string(4) "ab/="
+}
+
+-- Iteration 4 --
+int(2)
+array(1) {
+ [0]=>
+ string(2) " "
+}
+
+-- Iteration 5 --
+int(3)
+array(1) {
+ [0]=>
+ string(3) "234"
+}
+
+-- Iteration 6 --
+int(9)
+array(1) {
+ [0]=>
+ string(12) "5pel5pys6Kqe"
+}
+
+-- Iteration 7 --
+int(4)
+array(1) {
+ [0]=>
+ string(4) "fjds"
+}
+
+-- Iteration 8 --
+int(10)
+array(1) {
+ [0]=>
+ string(16) "5pel5pys6KqeCQ=="
+}
+
+-- Iteration 9 --
+int(5)
+array(1) {
+ [0]=>
+ string(5) ".!"*@"
+}
+
+-- Iteration 10 --
+int(1)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+
+-- Iteration 11 --
+int(5)
+array(1) {
+ [0]=>
+ string(5) "IDSJV"
+}
+
+-- Iteration 12 --
+int(4)
+array(1) {
+ [0]=>
+ string(4) "3b5D"
+}
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_variation4.phpt b/ext/mbstring/tests/mb_ereg_variation4.phpt
new file mode 100644
index 000000000..7f7d6dfc9
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_variation4.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test mb_ereg() function : usage variations - pass different character classes as pattern for multibyte string
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test how character classes match a multibyte string
+ */
+
+echo "*** Testing mb_ereg() : usage variations ***\n";
+
+mb_regex_encoding('utf-8');
+
+//contains japanese characters, ASCII digits and different, UTF-8 encoded digits
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+$character_classes = array ('[[:alnum:]]+', /*1*/
+ '[[:alpha:]]+',
+ '[[:ascii:]]+',
+ '[[:blank:]]+',
+ '[[:cntrl:]]+',/*5*/
+ '[[:digit:]]+',
+ '[[:graph:]]+',
+ '[[:lower:]]+',
+ '[[:print:]]+',
+ '[[:punct:]]+', /*10*/
+ '[[:space:]]+',
+ '[[:upper:]]+',
+ '[[:xdigit:]]+'); /*13*/
+
+$iterator = 1;
+foreach ($character_classes as $pattern) {
+ if (is_array(@$regs)) {
+ $regs = null;
+ }
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_ereg($pattern, $string_mb, $regs));
+ if ($regs) {
+ base64_encode_var_dump($regs);
+ }
+ $iterator++;
+}
+/**
+ * replicate a var dump of an array but outputted string values are base64 encoded
+ *
+ * @param array $regs
+ */
+function base64_encode_var_dump($regs) {
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
+}
+echo "Done";
+
+?>
+--EXPECTF--
+*** Testing mb_ereg() : usage variations ***
+
+-- Iteration 1 --
+int(47)
+array(1) {
+ [0]=>
+ string(64) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJk="
+}
+
+-- Iteration 2 --
+int(27)
+array(1) {
+ [0]=>
+ string(36) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ"
+}
+
+-- Iteration 3 --
+int(5)
+array(1) {
+ [0]=>
+ string(8) "MDEyMzQ="
+}
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+int(20)
+array(1) {
+ [0]=>
+ string(28) "MDEyMzTvvJXvvJbvvJfvvJjvvJk="
+}
+
+-- Iteration 7 --
+int(50)
+array(1) {
+ [0]=>
+ string(68) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+}
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+int(50)
+array(1) {
+ [0]=>
+ string(68) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+}
+
+-- Iteration 10 --
+int(3)
+array(1) {
+ [0]=>
+ string(4) "44CC"
+}
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+int(5)
+array(1) {
+ [0]=>
+ string(8) "MDEyMzQ="
+}
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_variation5.phpt b/ext/mbstring/tests/mb_ereg_variation5.phpt
new file mode 100644
index 000000000..95bc59919
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_variation5.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test mb_ereg() function : usage variations - Test anchors in regex
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test mb_ereg with anchors (start and end of string) in $pattern
+ */
+
+echo "*** Testing mb_ereg() : usage variations ***\n";
+
+mb_regex_encoding('utf-8');
+
+$string_ascii = 'This is an English string. 0123456789.';
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+$regex = '^.*?[[:blank:]]?[[:punct:][:digit:]]+\.?$';
+
+echo "\nASCII String without \$regs arg:\t\t";
+var_dump(mb_ereg($regex, $string_ascii));
+echo "ASCII String with \$regs arg:\n";
+var_dump(mb_ereg($regex, $string_ascii, $regs_ascii));
+var_dump($regs_ascii);
+
+echo "\nMultibyte String without \$regs arg:\t";
+var_dump(mb_ereg($regex, $string_mb));
+echo "Multubyte String with \$regs arg:\n";
+var_dump(mb_ereg($regex, $string_mb, $regs_mb));
+base64_encode_var_dump($regs_mb);
+
+echo "Done";
+
+/**
+ * replicate a var dump of an array but outputted string values are base64 encoded
+ *
+ * @param array $regs
+ */
+function base64_encode_var_dump($regs) {
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
+}
+?>
+--EXPECTF--
+*** Testing mb_ereg() : usage variations ***
+
+ASCII String without $regs arg: int(1)
+ASCII String with $regs arg:
+int(38)
+array(1) {
+ [0]=>
+ string(38) "This is an English string. 0123456789."
+}
+
+Multibyte String without $regs arg: int(1)
+Multubyte String with $regs arg:
+int(53)
+array(1) {
+ [0]=>
+ string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+}
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_variation6.phpt b/ext/mbstring/tests/mb_ereg_variation6.phpt
new file mode 100644
index 000000000..33d2ee571
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_variation6.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test mb_ereg() function : usage variations - match special characters
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test how mb_ereg() matches special characters for $pattern
+ */
+
+echo "*** Testing mb_ereg() : usage variations ***\n";
+
+if(mb_regex_encoding('utf-8') == true) {
+ echo "Regex encoding set to utf-8\n";
+} else {
+ echo "Could not set regex encoding to utf-8\n";
+}
+
+$regex_char = array ('\w+', '\W+', '\s+', '\S+', '\d+', '\D+', '\b', '\B');
+
+$string_ascii = 'This is an English string. 0123456789.';
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+foreach ($regex_char as $char) {
+ echo "\n--** Pattern is: $char **--\n";
+ if (@$regs_ascii || @$regs_mb) {
+ $regs_ascii = null;
+ $regs_mb = null;
+ }
+ echo "-- ASCII String: --\n";
+ var_dump(mb_ereg($char, $string_ascii, $regs_ascii));
+ var_dump($regs_ascii);
+
+ echo "-- Multibyte String: --\n";
+ var_dump(mb_ereg($char, $string_mb, $regs_mb));
+ base64_encode_var_dump($regs_mb);
+
+}
+
+/**
+ * replicate a var dump of an array but outputted string values are base64 encoded
+ *
+ * @param array $regs
+ */
+function base64_encode_var_dump($regs) {
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
+}
+
+echo "Done";
+
+?>
+--EXPECTF--
+*** Testing mb_ereg() : usage variations ***
+Regex encoding set to utf-8
+
+--** Pattern is: \w+ **--
+-- ASCII String: --
+int(4)
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+-- Multibyte String: --
+int(27)
+array(1) {
+ [0]=>
+ string(36) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ"
+}
+
+--** Pattern is: \W+ **--
+-- ASCII String: --
+int(1)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+-- Multibyte String: --
+int(3)
+array(1) {
+ [0]=>
+ string(4) "44CC"
+}
+
+--** Pattern is: \s+ **--
+-- ASCII String: --
+int(1)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+-- Multibyte String: --
+bool(false)
+NULL
+
+--** Pattern is: \S+ **--
+-- ASCII String: --
+int(4)
+array(1) {
+ [0]=>
+ string(4) "This"
+}
+-- Multibyte String: --
+int(53)
+array(1) {
+ [0]=>
+ string(72) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+}
+
+--** Pattern is: \d+ **--
+-- ASCII String: --
+int(10)
+array(1) {
+ [0]=>
+ string(10) "0123456789"
+}
+-- Multibyte String: --
+int(20)
+array(1) {
+ [0]=>
+ string(28) "MDEyMzTvvJXvvJbvvJfvvJjvvJk="
+}
+
+--** Pattern is: \D+ **--
+-- ASCII String: --
+int(27)
+array(1) {
+ [0]=>
+ string(27) "This is an English string. "
+}
+-- Multibyte String: --
+int(30)
+array(1) {
+ [0]=>
+ string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
+}
+
+--** Pattern is: \b **--
+-- ASCII String: --
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+-- Multibyte String: --
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+
+--** Pattern is: \B **--
+-- ASCII String: --
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+-- Multibyte String: --
+int(1)
+array(1) {
+ [0]=>
+ bool(false)
+}
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_ereg_variation7.phpt b/ext/mbstring/tests/mb_ereg_variation7.phpt
new file mode 100644
index 000000000..81c958957
--- /dev/null
+++ b/ext/mbstring/tests/mb_ereg_variation7.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test mb_ereg() function : usage variations - different regex features in $pattern
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
+ * Description: Regular expression match for multibyte string
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Testing the following regular expression features match correctly:
+ * 1. definite quantifiers
+ * 2. Alternation
+ * 3. subpatterns in parentheses
+ */
+
+echo "*** Testing mb_ereg() : usage variations ***\n";
+
+if(mb_regex_encoding('utf-8') == true) {
+ echo "Regex encoding set to utf-8\n";
+} else {
+ echo "Could not set regex encoding to utf-8\n";
+}
+
+$string_ascii = 'This is an English string. 0123456789.';
+$regex_ascii = '([A-Z]\w{1,4}is( [aeiou]|h)) ?.*\.\s[0-9]+(5([6-9][79]){2})[[:punct:]]$';
+var_dump(mb_ereg($regex_ascii, $string_ascii, $regs_ascii));
+var_dump($regs_ascii);
+
+$string_mb = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
+$regex_mb = base64_decode("W86RLc6pXShcdysgKSvOtVvOsS3PiVxzXSvOui4qKM+MfM6/KS4qXC5cc1swLTldKyg1KFs2LTldWzc5XSl7Mn0pW1s6cHVuY3Q6XV0k");
+var_dump(mb_ereg($regex_mb, $string_mb, $regs_mb));
+base64_encode_var_dump($regs_mb);
+
+/**
+ * replicate a var dump of an array but outputted string values are base64 encoded
+ *
+ * @param array $regs
+ */
+function base64_encode_var_dump($regs) {
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
+}
+
+echo "Done";
+
+?>
+--EXPECTF--
+*** Testing mb_ereg() : usage variations ***
+Regex encoding set to utf-8
+int(38)
+array(5) {
+ [0]=>
+ string(38) "This is an English string. 0123456789."
+ [1]=>
+ string(6) "This i"
+ [2]=>
+ string(2) " i"
+ [3]=>
+ string(5) "56789"
+ [4]=>
+ string(2) "89"
+}
+int(64)
+array(5) {
+ [0]=>
+ string(88) "zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg=="
+ [1]=>
+ string(16) "zrXOr869zrHOuSA="
+ [2]=>
+ string(4) "zr8="
+ [3]=>
+ string(8) "NTY3ODk="
+ [4]=>
+ string(4) "ODk="
+}
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_internal_encoding_basic.phpt b/ext/mbstring/tests/mb_internal_encoding_basic.phpt
new file mode 100644
index 000000000..a289dcf8d
--- /dev/null
+++ b/ext/mbstring/tests/mb_internal_encoding_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test mb_internal_encoding() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_internal_encoding') or die("skip mb_internal_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_internal_encoding([string $encoding])
+ * Description: Sets the current internal encoding or Returns
+ * the current internal encoding as a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_internal_encoding
+ */
+
+echo "*** Testing mb_internal_encoding() : basic functionality ***\n";
+
+var_dump(mb_internal_encoding()); //default internal encoding
+
+var_dump(mb_internal_encoding('UTF-8')); //change internal encoding to UTF-8
+
+var_dump(mb_internal_encoding()); //check internal encoding is now set to UTF-8
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_internal_encoding() : basic functionality ***
+string(%d) "%s"
+bool(true)
+string(5) "UTF-8"
+Done
diff --git a/ext/mbstring/tests/mb_internal_encoding_error1.phpt b/ext/mbstring/tests/mb_internal_encoding_error1.phpt
new file mode 100644
index 000000000..61f133a44
--- /dev/null
+++ b/ext/mbstring/tests/mb_internal_encoding_error1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test mb_internal_encoding() function : error conditions - pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_internal_encoding') or die("skip mb_internal_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_internal_encoding([string $encoding])
+ * Description: Sets the current internal encoding or
+ * Returns the current internal encoding as a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test mb_internal_encoding with one more than the expected number of arguments
+ */
+
+echo "*** Testing mb_internal_encoding() : error conditions ***\n";
+
+echo "\n-- Testing mb_internal_encoding() function with more than expected no. of arguments --\n";
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_internal_encoding($encoding, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_internal_encoding() : error conditions ***
+
+-- Testing mb_internal_encoding() function with more than expected no. of arguments --
+
+Warning: mb_internal_encoding() expects at most 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_internal_encoding_error2.phpt b/ext/mbstring/tests/mb_internal_encoding_error2.phpt
new file mode 100644
index 000000000..d0a1653eb
--- /dev/null
+++ b/ext/mbstring/tests/mb_internal_encoding_error2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test mb_internal_encoding() function : error conditions - pass an unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_internal_encoding') or die("skip mb_internal_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_internal_encoding([string $encoding])
+ * Description: Sets the current internal encoding or
+ * Returns the current internal encoding as a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_internal_encoding an unknown encoding
+ */
+
+echo "*** Testing mb_internal_encoding() : error conditions ***\n";
+
+var_dump(mb_internal_encoding('unknown-encoding'));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_internal_encoding() : error conditions ***
+
+Warning: mb_internal_encoding(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_internal_encoding_variation1.phpt b/ext/mbstring/tests/mb_internal_encoding_variation1.phpt
new file mode 100644
index 000000000..3aa1784b1
--- /dev/null
+++ b/ext/mbstring/tests/mb_internal_encoding_variation1.phpt
@@ -0,0 +1,217 @@
+--TEST--
+Test mb_internal_encoding() function : usage variations - Pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_internal_encoding') or die("skip mb_internal_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_internal_encoding([string $encoding])
+ * Description: Sets the current internal encoding or Returns
+ * the current internal encoding as a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types as $encoding to mb_internal_encoding() to test behaviour
+ * Where possible 'UTF-8' has been entered as a string value
+ */
+
+echo "*** Testing mb_internal_encoding() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_internal_encoding()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_internal_encoding($input) );
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing mb_internal_encoding() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_internal_encoding(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_internal_encoding(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_internal_encoding(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_internal_encoding(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_internal_encoding(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_internal_encoding(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_internal_encoding(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_internal_encoding(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_internal_encoding(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_internal_encoding(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_internal_encoding(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_internal_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_internal_encoding() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_internal_encoding_variation2.phpt b/ext/mbstring/tests/mb_internal_encoding_variation2.phpt
new file mode 100644
index 000000000..3abf2517a
--- /dev/null
+++ b/ext/mbstring/tests/mb_internal_encoding_variation2.phpt
@@ -0,0 +1,374 @@
+--TEST--
+Test mb_internal_encoding() function : usage variations - Test different encodings
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_internal_encoding') or die("skip mb_internal_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_internal_encoding([string $encoding])
+ * Description: Sets the current internal encoding or Returns
+ * the current internal encoding as a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test all listed encoding types from php.net to check all are known to function
+ * NB: The strings passed are *NOT* necessarily encoded in the encoding passed to the function.
+ * This test is purely to see whether the function recognises the encoding.
+ */
+
+echo "*** Testing mb_internal_encoding() : usage variations ***\n";
+
+$encoding = array('UCS-4', /*1*/
+ 'UCS-4BE',
+ 'UCS-4LE',
+ 'UCS-2',
+ 'UCS-2BE', /*5*/
+ 'UCS-2LE',
+ 'UTF-32',
+ 'UTF-32BE',
+ 'UTF-32LE',
+ 'UTF-16', /*10*/
+ 'UTF-16BE',
+ 'UTF-16LE',
+ 'UTF-7',
+ 'UTF7-IMAP',
+ 'UTF-8', /*15*/
+ 'ASCII',
+ 'EUC-JP',
+ 'SJIS',
+ 'eucJP-win',
+ 'SJIS-win', /*20*/
+ 'ISO-2022-JP',
+ 'JIS',
+ 'ISO-8859-1',
+ 'ISO-8859-2',
+ 'ISO-8859-3', /*25*/
+ 'ISO-8859-4',
+ 'ISO-8859-5',
+ 'ISO-8859-6',
+ 'ISO-8859-7',
+ 'ISO-8859-8', /*30*/
+ 'ISO-8859-9',
+ 'ISO-8859-10',
+ 'ISO-8859-13',
+ 'ISO-8859-14',
+ 'ISO-8859-15', /*35*/
+ 'byte2be',
+ 'byte2le',
+ 'byte4be',
+ 'byte4le',
+ 'BASE64', /*40*/
+ 'HTML-ENTITIES',
+ '7bit',
+ '8bit',
+ 'EUC-CN',
+ 'CP936', /*45*/
+ 'HZ',
+ 'EUC-TW',
+ 'CP950',
+ 'BIG-5',
+ 'EUC-KR', /*50*/
+ 'UHC',
+ 'ISO-2022-KR',
+ 'Windows-1251',
+ 'Windows-1252',
+ 'CP866', /*55*/
+ 'KOI8-R'); /*56*/
+
+$iterator = 1;
+foreach($encoding as $enc) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_internal_encoding());
+ var_dump(mb_internal_encoding($enc));
+ var_dump(mb_internal_encoding());
+ $iterator++;
+}
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing mb_internal_encoding() : usage variations ***
+
+-- Iteration 1 --
+string(%d) "%s"
+bool(true)
+string(5) "UCS-4"
+
+-- Iteration 2 --
+string(5) "UCS-4"
+bool(true)
+string(7) "UCS-4BE"
+
+-- Iteration 3 --
+string(7) "UCS-4BE"
+bool(true)
+string(7) "UCS-4LE"
+
+-- Iteration 4 --
+string(7) "UCS-4LE"
+bool(true)
+string(5) "UCS-2"
+
+-- Iteration 5 --
+string(5) "UCS-2"
+bool(true)
+string(7) "UCS-2BE"
+
+-- Iteration 6 --
+string(7) "UCS-2BE"
+bool(true)
+string(7) "UCS-2LE"
+
+-- Iteration 7 --
+string(7) "UCS-2LE"
+bool(true)
+string(6) "UTF-32"
+
+-- Iteration 8 --
+string(6) "UTF-32"
+bool(true)
+string(8) "UTF-32BE"
+
+-- Iteration 9 --
+string(8) "UTF-32BE"
+bool(true)
+string(8) "UTF-32LE"
+
+-- Iteration 10 --
+string(8) "UTF-32LE"
+bool(true)
+string(6) "UTF-16"
+
+-- Iteration 11 --
+string(6) "UTF-16"
+bool(true)
+string(8) "UTF-16BE"
+
+-- Iteration 12 --
+string(8) "UTF-16BE"
+bool(true)
+string(8) "UTF-16LE"
+
+-- Iteration 13 --
+string(8) "UTF-16LE"
+bool(true)
+string(5) "UTF-7"
+
+-- Iteration 14 --
+string(5) "UTF-7"
+bool(true)
+string(9) "UTF7-IMAP"
+
+-- Iteration 15 --
+string(9) "UTF7-IMAP"
+bool(true)
+string(5) "UTF-8"
+
+-- Iteration 16 --
+string(5) "UTF-8"
+bool(true)
+string(5) "ASCII"
+
+-- Iteration 17 --
+string(5) "ASCII"
+bool(true)
+string(6) "EUC-JP"
+
+-- Iteration 18 --
+string(6) "EUC-JP"
+bool(true)
+string(4) "SJIS"
+
+-- Iteration 19 --
+string(4) "SJIS"
+bool(true)
+string(9) "eucJP-win"
+
+-- Iteration 20 --
+string(9) "eucJP-win"
+bool(true)
+string(8) "SJIS-win"
+
+-- Iteration 21 --
+string(8) "SJIS-win"
+bool(true)
+string(11) "ISO-2022-JP"
+
+-- Iteration 22 --
+string(11) "ISO-2022-JP"
+bool(true)
+string(3) "JIS"
+
+-- Iteration 23 --
+string(3) "JIS"
+bool(true)
+string(10) "ISO-8859-1"
+
+-- Iteration 24 --
+string(10) "ISO-8859-1"
+bool(true)
+string(10) "ISO-8859-2"
+
+-- Iteration 25 --
+string(10) "ISO-8859-2"
+bool(true)
+string(10) "ISO-8859-3"
+
+-- Iteration 26 --
+string(10) "ISO-8859-3"
+bool(true)
+string(10) "ISO-8859-4"
+
+-- Iteration 27 --
+string(10) "ISO-8859-4"
+bool(true)
+string(10) "ISO-8859-5"
+
+-- Iteration 28 --
+string(10) "ISO-8859-5"
+bool(true)
+string(10) "ISO-8859-6"
+
+-- Iteration 29 --
+string(10) "ISO-8859-6"
+bool(true)
+string(10) "ISO-8859-7"
+
+-- Iteration 30 --
+string(10) "ISO-8859-7"
+bool(true)
+string(10) "ISO-8859-8"
+
+-- Iteration 31 --
+string(10) "ISO-8859-8"
+bool(true)
+string(10) "ISO-8859-9"
+
+-- Iteration 32 --
+string(10) "ISO-8859-9"
+bool(true)
+string(11) "ISO-8859-10"
+
+-- Iteration 33 --
+string(11) "ISO-8859-10"
+bool(true)
+string(11) "ISO-8859-13"
+
+-- Iteration 34 --
+string(11) "ISO-8859-13"
+bool(true)
+string(11) "ISO-8859-14"
+
+-- Iteration 35 --
+string(11) "ISO-8859-14"
+bool(true)
+string(11) "ISO-8859-15"
+
+-- Iteration 36 --
+string(11) "ISO-8859-15"
+bool(true)
+string(7) "byte2be"
+
+-- Iteration 37 --
+string(7) "byte2be"
+bool(true)
+string(7) "byte2le"
+
+-- Iteration 38 --
+string(7) "byte2le"
+bool(true)
+string(7) "byte4be"
+
+-- Iteration 39 --
+string(7) "byte4be"
+bool(true)
+string(7) "byte4le"
+
+-- Iteration 40 --
+string(7) "byte4le"
+bool(true)
+string(6) "BASE64"
+
+-- Iteration 41 --
+string(6) "BASE64"
+bool(true)
+string(13) "HTML-ENTITIES"
+
+-- Iteration 42 --
+string(13) "HTML-ENTITIES"
+bool(true)
+string(4) "7bit"
+
+-- Iteration 43 --
+string(4) "7bit"
+bool(true)
+string(4) "8bit"
+
+-- Iteration 44 --
+string(4) "8bit"
+bool(true)
+string(6) "EUC-CN"
+
+-- Iteration 45 --
+string(6) "EUC-CN"
+bool(true)
+string(5) "CP936"
+
+-- Iteration 46 --
+string(5) "CP936"
+bool(true)
+string(2) "HZ"
+
+-- Iteration 47 --
+string(2) "HZ"
+bool(true)
+string(6) "EUC-TW"
+
+-- Iteration 48 --
+string(6) "EUC-TW"
+bool(true)
+string(5) "BIG-5"
+
+-- Iteration 49 --
+string(5) "BIG-5"
+bool(true)
+string(5) "BIG-5"
+
+-- Iteration 50 --
+string(5) "BIG-5"
+bool(true)
+string(6) "EUC-KR"
+
+-- Iteration 51 --
+string(6) "EUC-KR"
+bool(true)
+string(3) "UHC"
+
+-- Iteration 52 --
+string(3) "UHC"
+bool(true)
+string(11) "ISO-2022-KR"
+
+-- Iteration 53 --
+string(11) "ISO-2022-KR"
+bool(true)
+string(12) "Windows-1251"
+
+-- Iteration 54 --
+string(12) "Windows-1251"
+bool(true)
+string(12) "Windows-1252"
+
+-- Iteration 55 --
+string(12) "Windows-1252"
+bool(true)
+string(5) "CP866"
+
+-- Iteration 56 --
+string(5) "CP866"
+bool(true)
+string(6) "KOI8-R"
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_regex_encoding_basic.phpt b/ext/mbstring/tests/mb_regex_encoding_basic.phpt
new file mode 100644
index 000000000..a0a41e967
--- /dev/null
+++ b/ext/mbstring/tests/mb_regex_encoding_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_regex_encoding() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_regex_encoding') or die("skip mb_regex_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : proto string mb_regex_encoding([string encoding])
+ * Description: Returns the current encoding for regex as a string.
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test Basic functionality of mb_regex_encoding
+ */
+
+echo "*** Testing mb_regex_encoding() : basic functionality ***\n";
+
+var_dump(mb_regex_encoding());
+
+var_dump(mb_regex_encoding('UTF-8'));
+
+var_dump(mb_regex_encoding());
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_regex_encoding() : basic functionality ***
+string(%d) "%s"
+bool(true)
+string(5) "UTF-8"
+Done
diff --git a/ext/mbstring/tests/mb_regex_encoding_error1.phpt b/ext/mbstring/tests/mb_regex_encoding_error1.phpt
new file mode 100644
index 000000000..6fe19aa9d
--- /dev/null
+++ b/ext/mbstring/tests/mb_regex_encoding_error1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test mb_regex_encoding() function : error conditions - pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_regex_encoding') or die("skip mb_regex_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_regex_encoding([string $encoding])
+ * Description: Returns the current encoding for regex as a string.
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Test mb_regex_encoding with one more than expected number of arguments
+ */
+
+echo "*** Testing mb_regex_encoding() : error conditions ***\n";
+
+
+echo "\n-- Testing mb_regex_encoding() function with more than expected no. of arguments --\n";
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_regex_encoding($encoding, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_regex_encoding() : error conditions ***
+
+-- Testing mb_regex_encoding() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for mb_regex_encoding() in %s on line %d
+NULL
+Done
diff --git a/ext/mbstring/tests/mb_regex_encoding_error2.phpt b/ext/mbstring/tests/mb_regex_encoding_error2.phpt
new file mode 100644
index 000000000..c752609da
--- /dev/null
+++ b/ext/mbstring/tests/mb_regex_encoding_error2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test mb_regex_encoding() function : error conditions - Pass an unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_regex_encoding') or die("skip mb_regex_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_regex_encoding([string $encoding])
+ * Description: Returns the current encoding for regex as a string.
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Pass mb_regex_encoding an unknown type of encoding
+ */
+
+echo "*** Testing mb_regex_encoding() : error conditions ***\n";
+
+var_dump(mb_regex_encoding('unknown'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_regex_encoding() : error conditions ***
+
+Warning: mb_regex_encoding(): Unknown encoding "unknown" in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_regex_encoding_variation1.phpt b/ext/mbstring/tests/mb_regex_encoding_variation1.phpt
new file mode 100644
index 000000000..0d2ff99ac
--- /dev/null
+++ b/ext/mbstring/tests/mb_regex_encoding_variation1.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test mb_regex_encoding() function : usage variations - Pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_regex_encoding') or die("skip mb_regex_encoding() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_regex_encoding([string $encoding])
+ * Description: Returns the current encoding for regex as a string.
+ * Source code: ext/mbstring/php_mbregex.c
+ */
+
+/*
+ * Pass different data types as $encoding argument to mb_regex_encoding() to test behaviour
+ * Where possible, 'UTF-8' has been entered as a string value
+ */
+
+echo "*** Testing mb_regex_encoding() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_regex_encoding()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_regex_encoding($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_regex_encoding() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_regex_encoding(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_regex_encoding(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_regex_encoding(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_regex_encoding(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_regex_encoding(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_regex_encoding(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_regex_encoding(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_regex_encoding(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_regex_encoding(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_regex_encoding(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_regex_encoding(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_regex_encoding(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_regex_encoding(): Unknown encoding "Resource id #%d" in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strlen_basic.phpt b/ext/mbstring/tests/mb_strlen_basic.phpt
new file mode 100644
index 000000000..6214f3069
--- /dev/null
+++ b/ext/mbstring/tests/mb_strlen_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test mb_strlen() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strlen(string $str [, string $encoding])
+ * Description: Get character numbers of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_strlen()
+ */
+
+echo "*** Testing mb_strlen() : basic functionality***\n";
+
+$string_ascii = 'abc def';
+//Japanese string in UTF-8
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- ASCII String --\n";
+var_dump(mb_strlen($string_ascii));
+
+echo "\n-- Multibyte String --\n";
+var_dump(mb_strlen($string_mb, 'UTF-8'));
+
+echo "\nDone";
+?>
+
+--EXPECTF--
+*** Testing mb_strlen() : basic functionality***
+
+-- ASCII String --
+int(7)
+
+-- Multibyte String --
+int(21)
+
+Done
diff --git a/ext/mbstring/tests/mb_strlen_error1.phpt b/ext/mbstring/tests/mb_strlen_error1.phpt
new file mode 100644
index 000000000..8fcd87ec3
--- /dev/null
+++ b/ext/mbstring/tests/mb_strlen_error1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test mb_strlen() function : error conditions - pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strlen(string $str [, string $encoding])
+ * Description: Get character numbers of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strlen an incorrect number of arguments to test behaviour
+ */
+
+echo "*** Testing mb_strlen() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing mb_strlen() function with Zero arguments --\n";
+var_dump( mb_strlen() );
+
+//Test mb_strlen with one more than the expected number of arguments
+echo "\n-- Testing mb_strlen() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_strlen($str, $encoding, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strlen() : error conditions ***
+
+-- Testing mb_strlen() function with Zero arguments --
+
+Warning: mb_strlen() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing mb_strlen() function with more than expected no. of arguments --
+
+Warning: mb_strlen() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_strlen_error2.phpt b/ext/mbstring/tests/mb_strlen_error2.phpt
new file mode 100644
index 000000000..a530a8441
--- /dev/null
+++ b/ext/mbstring/tests/mb_strlen_error2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test mb_strlen() function : error conditions - pass an unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strlen(string $str [, string $encoding])
+ * Description: Get character numbers of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test mb_strlen when passed an unknown encoding
+ */
+
+echo "*** Testing mb_strlen() : error ***\n";
+
+$string = 'abcdef';
+
+$encoding = 'unknown-encoding';
+
+var_dump(mb_strlen($string, $encoding));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strlen() : error ***
+
+Warning: mb_strlen(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_strlen_variation1.phpt b/ext/mbstring/tests/mb_strlen_variation1.phpt
new file mode 100644
index 000000000..a64fad17e
--- /dev/null
+++ b/ext/mbstring/tests/mb_strlen_variation1.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test mb_strlen() function : usage variations - Pass different data types as $str arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strlen(string $str [, string $encoding])
+ * Description: Get character numbers of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test mb_strlen by passing different data types as $str argument
+ */
+
+echo "*** Testing mb_strlen() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$encoding = 'utf-8';
+
+//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 $str argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_strlen()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strlen($input, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strlen() : usage variations ***
+
+-- Iteration 1 --
+int(1)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(5)
+
+-- Iteration 4 --
+int(5)
+
+-- Iteration 5 --
+int(4)
+
+-- Iteration 6 --
+int(5)
+
+-- Iteration 7 --
+int(12)
+
+-- Iteration 8 --
+int(13)
+
+-- Iteration 9 --
+int(3)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(1)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(6)
+
+-- Iteration 19 --
+int(6)
+
+-- Iteration 20 --
+int(11)
+
+-- Iteration 21 --
+int(14)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+
+Warning: mb_strlen() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strlen_variation2.phpt b/ext/mbstring/tests/mb_strlen_variation2.phpt
new file mode 100644
index 000000000..d34f3cfcb
--- /dev/null
+++ b/ext/mbstring/tests/mb_strlen_variation2.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test mb_strlen() function : usage variations - Pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strlen(string $str [, string $encoding])
+ * Description: Get character numbers of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test mb_strlen() by passing different data types as $encoding argument.
+ * Where possible 'UTF-8' has been entered as a string value
+ */
+
+echo "*** Testing mb_strlen() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$str = 'string value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strlen()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strlen($str, $input));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strlen() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_strlen(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_strlen(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_strlen(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strlen(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_strlen(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_strlen(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_strlen(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_strlen(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_strlen(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_strlen(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_strlen(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(12)
+
+-- Iteration 19 --
+int(12)
+
+-- Iteration 20 --
+int(12)
+
+-- Iteration 21 --
+int(12)
+
+-- Iteration 22 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_strlen(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strlen() expects parameter 2 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strlen_variation3.phpt b/ext/mbstring/tests/mb_strlen_variation3.phpt
new file mode 100644
index 000000000..13dc90993
--- /dev/null
+++ b/ext/mbstring/tests/mb_strlen_variation3.phpt
@@ -0,0 +1,445 @@
+--TEST--
+Test mb_strlen() function : usage variations - Pass list of encodings
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strlen(string $str [, string $encoding])
+ * Description: Get character numbers of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass all encodings listed on php.net to mb_strlen to test that function recognises them
+ * NB: The strings passed are *NOT* necessarily encoded in the encoding passed to the function.
+ * This test is purely to see whether the function recognises the encoding.
+ */
+
+echo "*** Testing mb_strlen() : usage variations ***\n";
+
+$encoding = array('UCS-4', /*1*/
+ 'UCS-4BE',
+ 'UCS-4LE',
+ 'UCS-2',
+ 'UCS-2BE', /*5*/
+ 'UCS-2LE',
+ 'UTF-32',
+ 'UTF-32BE',
+ 'UTF-32LE',
+ 'UTF-16', /*10*/
+ 'UTF-16BE',
+ 'UTF-16LE',
+ 'UTF-7',
+ 'UTF7-IMAP',
+ 'UTF-8', /*15*/
+ 'ASCII',
+ 'EUC-JP',
+ 'SJIS',
+ 'eucJP-win',
+ 'SJIS-win', /*20*/
+ 'ISO-2022-JP',
+ 'JIS',
+ 'ISO-8859-1',
+ 'ISO-8859-2',
+ 'ISO-8859-3', /*25*/
+ 'ISO-8859-4',
+ 'ISO-8859-5',
+ 'ISO-8859-6',
+ 'ISO-8859-7',
+ 'ISO-8859-8', /*30*/
+ 'ISO-8859-9',
+ 'ISO-8859-10',
+ 'ISO-8859-13',
+ 'ISO-8859-14',
+ 'ISO-8859-15', /*35*/
+ 'byte2be',
+ 'byte2le',
+ 'byte4be',
+ 'byte4le',
+ 'BASE64', /*40*/
+ 'HTML-ENTITIES',
+ '7bit',
+ '8bit',
+ 'EUC-CN',
+ 'CP936', /*45*/
+ 'HZ',
+ 'EUC-TW',
+ 'CP950',
+ 'BIG-5',
+ 'EUC-KR', /*50*/
+ 'UHC',
+ 'ISO-2022-KR',
+ 'Windows-1251',
+ 'Windows-1252',
+ 'CP866', /*55*/
+ 'KOI8-R'); /*56*/
+
+
+
+$iterator = 1;
+$string_ascii = 'abc def';
+$string_mb = base64_decode('44K/44OT44Ol44Os44O844OG44Kj44Oz44Kw44O744Oe44K344O844Oz44O744Kr44Oz44OR44OL44O8');
+
+foreach($encoding as $enc) {
+ echo "\n-- Iteration $iterator: $enc --\n";
+
+ echo "-- ASCII String --\n";
+ if(mb_strlen($string_ascii, $enc)) {
+ echo "Encoding $enc recognised\n";
+ } else {
+ echo "Encoding $enc not recognised\n";
+ }
+
+ echo "-- Multibyte String --\n";
+ if(mb_strlen($string_mb, $enc)){
+ echo "Encoding $enc recognised\n";
+ } else {
+ echo "Encoding $enc not recognised\n";
+ }
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strlen() : usage variations ***
+
+-- Iteration 1: UCS-4 --
+-- ASCII String --
+Encoding UCS-4 recognised
+-- Multibyte String --
+Encoding UCS-4 recognised
+
+-- Iteration 2: UCS-4BE --
+-- ASCII String --
+Encoding UCS-4BE recognised
+-- Multibyte String --
+Encoding UCS-4BE recognised
+
+-- Iteration 3: UCS-4LE --
+-- ASCII String --
+Encoding UCS-4LE recognised
+-- Multibyte String --
+Encoding UCS-4LE recognised
+
+-- Iteration 4: UCS-2 --
+-- ASCII String --
+Encoding UCS-2 recognised
+-- Multibyte String --
+Encoding UCS-2 recognised
+
+-- Iteration 5: UCS-2BE --
+-- ASCII String --
+Encoding UCS-2BE recognised
+-- Multibyte String --
+Encoding UCS-2BE recognised
+
+-- Iteration 6: UCS-2LE --
+-- ASCII String --
+Encoding UCS-2LE recognised
+-- Multibyte String --
+Encoding UCS-2LE recognised
+
+-- Iteration 7: UTF-32 --
+-- ASCII String --
+Encoding UTF-32 recognised
+-- Multibyte String --
+Encoding UTF-32 recognised
+
+-- Iteration 8: UTF-32BE --
+-- ASCII String --
+Encoding UTF-32BE recognised
+-- Multibyte String --
+Encoding UTF-32BE recognised
+
+-- Iteration 9: UTF-32LE --
+-- ASCII String --
+Encoding UTF-32LE recognised
+-- Multibyte String --
+Encoding UTF-32LE recognised
+
+-- Iteration 10: UTF-16 --
+-- ASCII String --
+Encoding UTF-16 recognised
+-- Multibyte String --
+Encoding UTF-16 recognised
+
+-- Iteration 11: UTF-16BE --
+-- ASCII String --
+Encoding UTF-16BE recognised
+-- Multibyte String --
+Encoding UTF-16BE recognised
+
+-- Iteration 12: UTF-16LE --
+-- ASCII String --
+Encoding UTF-16LE recognised
+-- Multibyte String --
+Encoding UTF-16LE recognised
+
+-- Iteration 13: UTF-7 --
+-- ASCII String --
+Encoding UTF-7 recognised
+-- Multibyte String --
+Encoding UTF-7 recognised
+
+-- Iteration 14: UTF7-IMAP --
+-- ASCII String --
+Encoding UTF7-IMAP recognised
+-- Multibyte String --
+Encoding UTF7-IMAP recognised
+
+-- Iteration 15: UTF-8 --
+-- ASCII String --
+Encoding UTF-8 recognised
+-- Multibyte String --
+Encoding UTF-8 recognised
+
+-- Iteration 16: ASCII --
+-- ASCII String --
+Encoding ASCII recognised
+-- Multibyte String --
+Encoding ASCII recognised
+
+-- Iteration 17: EUC-JP --
+-- ASCII String --
+Encoding EUC-JP recognised
+-- Multibyte String --
+Encoding EUC-JP recognised
+
+-- Iteration 18: SJIS --
+-- ASCII String --
+Encoding SJIS recognised
+-- Multibyte String --
+Encoding SJIS recognised
+
+-- Iteration 19: eucJP-win --
+-- ASCII String --
+Encoding eucJP-win recognised
+-- Multibyte String --
+Encoding eucJP-win recognised
+
+-- Iteration 20: SJIS-win --
+-- ASCII String --
+Encoding SJIS-win recognised
+-- Multibyte String --
+Encoding SJIS-win recognised
+
+-- Iteration 21: ISO-2022-JP --
+-- ASCII String --
+Encoding ISO-2022-JP recognised
+-- Multibyte String --
+Encoding ISO-2022-JP recognised
+
+-- Iteration 22: JIS --
+-- ASCII String --
+Encoding JIS recognised
+-- Multibyte String --
+Encoding JIS recognised
+
+-- Iteration 23: ISO-8859-1 --
+-- ASCII String --
+Encoding ISO-8859-1 recognised
+-- Multibyte String --
+Encoding ISO-8859-1 recognised
+
+-- Iteration 24: ISO-8859-2 --
+-- ASCII String --
+Encoding ISO-8859-2 recognised
+-- Multibyte String --
+Encoding ISO-8859-2 recognised
+
+-- Iteration 25: ISO-8859-3 --
+-- ASCII String --
+Encoding ISO-8859-3 recognised
+-- Multibyte String --
+Encoding ISO-8859-3 recognised
+
+-- Iteration 26: ISO-8859-4 --
+-- ASCII String --
+Encoding ISO-8859-4 recognised
+-- Multibyte String --
+Encoding ISO-8859-4 recognised
+
+-- Iteration 27: ISO-8859-5 --
+-- ASCII String --
+Encoding ISO-8859-5 recognised
+-- Multibyte String --
+Encoding ISO-8859-5 recognised
+
+-- Iteration 28: ISO-8859-6 --
+-- ASCII String --
+Encoding ISO-8859-6 recognised
+-- Multibyte String --
+Encoding ISO-8859-6 recognised
+
+-- Iteration 29: ISO-8859-7 --
+-- ASCII String --
+Encoding ISO-8859-7 recognised
+-- Multibyte String --
+Encoding ISO-8859-7 recognised
+
+-- Iteration 30: ISO-8859-8 --
+-- ASCII String --
+Encoding ISO-8859-8 recognised
+-- Multibyte String --
+Encoding ISO-8859-8 recognised
+
+-- Iteration 31: ISO-8859-9 --
+-- ASCII String --
+Encoding ISO-8859-9 recognised
+-- Multibyte String --
+Encoding ISO-8859-9 recognised
+
+-- Iteration 32: ISO-8859-10 --
+-- ASCII String --
+Encoding ISO-8859-10 recognised
+-- Multibyte String --
+Encoding ISO-8859-10 recognised
+
+-- Iteration 33: ISO-8859-13 --
+-- ASCII String --
+Encoding ISO-8859-13 recognised
+-- Multibyte String --
+Encoding ISO-8859-13 recognised
+
+-- Iteration 34: ISO-8859-14 --
+-- ASCII String --
+Encoding ISO-8859-14 recognised
+-- Multibyte String --
+Encoding ISO-8859-14 recognised
+
+-- Iteration 35: ISO-8859-15 --
+-- ASCII String --
+Encoding ISO-8859-15 recognised
+-- Multibyte String --
+Encoding ISO-8859-15 recognised
+
+-- Iteration 36: byte2be --
+-- ASCII String --
+Encoding byte2be recognised
+-- Multibyte String --
+Encoding byte2be recognised
+
+-- Iteration 37: byte2le --
+-- ASCII String --
+Encoding byte2le recognised
+-- Multibyte String --
+Encoding byte2le recognised
+
+-- Iteration 38: byte4be --
+-- ASCII String --
+Encoding byte4be recognised
+-- Multibyte String --
+Encoding byte4be recognised
+
+-- Iteration 39: byte4le --
+-- ASCII String --
+Encoding byte4le recognised
+-- Multibyte String --
+Encoding byte4le recognised
+
+-- Iteration 40: BASE64 --
+-- ASCII String --
+Encoding BASE64 recognised
+-- Multibyte String --
+Encoding BASE64 recognised
+
+-- Iteration 41: HTML-ENTITIES --
+-- ASCII String --
+Encoding HTML-ENTITIES recognised
+-- Multibyte String --
+Encoding HTML-ENTITIES recognised
+
+-- Iteration 42: 7bit --
+-- ASCII String --
+Encoding 7bit recognised
+-- Multibyte String --
+Encoding 7bit recognised
+
+-- Iteration 43: 8bit --
+-- ASCII String --
+Encoding 8bit recognised
+-- Multibyte String --
+Encoding 8bit recognised
+
+-- Iteration 44: EUC-CN --
+-- ASCII String --
+Encoding EUC-CN recognised
+-- Multibyte String --
+Encoding EUC-CN recognised
+
+-- Iteration 45: CP936 --
+-- ASCII String --
+Encoding CP936 recognised
+-- Multibyte String --
+Encoding CP936 recognised
+
+-- Iteration 46: HZ --
+-- ASCII String --
+Encoding HZ recognised
+-- Multibyte String --
+Encoding HZ recognised
+
+-- Iteration 47: EUC-TW --
+-- ASCII String --
+Encoding EUC-TW recognised
+-- Multibyte String --
+Encoding EUC-TW recognised
+
+-- Iteration 48: CP950 --
+-- ASCII String --
+Encoding CP950 recognised
+-- Multibyte String --
+Encoding CP950 recognised
+
+-- Iteration 49: BIG-5 --
+-- ASCII String --
+Encoding BIG-5 recognised
+-- Multibyte String --
+Encoding BIG-5 recognised
+
+-- Iteration 50: EUC-KR --
+-- ASCII String --
+Encoding EUC-KR recognised
+-- Multibyte String --
+Encoding EUC-KR recognised
+
+-- Iteration 51: UHC --
+-- ASCII String --
+Encoding UHC recognised
+-- Multibyte String --
+Encoding UHC recognised
+
+-- Iteration 52: ISO-2022-KR --
+-- ASCII String --
+Encoding ISO-2022-KR recognised
+-- Multibyte String --
+Encoding ISO-2022-KR recognised
+
+-- Iteration 53: Windows-1251 --
+-- ASCII String --
+Encoding Windows-1251 recognised
+-- Multibyte String --
+Encoding Windows-1251 recognised
+
+-- Iteration 54: Windows-1252 --
+-- ASCII String --
+Encoding Windows-1252 recognised
+-- Multibyte String --
+Encoding Windows-1252 recognised
+
+-- Iteration 55: CP866 --
+-- ASCII String --
+Encoding CP866 recognised
+-- Multibyte String --
+Encoding CP866 recognised
+
+-- Iteration 56: KOI8-R --
+-- ASCII String --
+Encoding KOI8-R recognised
+-- Multibyte String --
+Encoding KOI8-R recognised
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_basic.phpt b/ext/mbstring/tests/mb_strpos_basic.phpt
new file mode 100644
index 000000000..4284ab805
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_basic.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test mb_strpos() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_strpos with ASCII and multibyte characters
+ */
+
+echo "*** Testing mb_strpos() : basic functionality***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+//Japanese string in UTF-8
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- ASCII string 1 --\n";
+var_dump(mb_strpos($string_ascii, 'd', 2, 'ISO-8859-1'));
+
+echo "\n-- ASCII string 2 --\n";
+var_dump(mb_strpos($string_ascii, '123'));
+
+echo "\n-- Multibyte string 1 --\n";
+$needle1 = base64_decode('5pel5pys6Kqe');
+var_dump(mb_strpos($string_mb, $needle1));
+
+echo "\n-- Multibyte string 2 --\n";
+$needle2 = base64_decode("44GT44KT44Gr44Gh44Gv44CB5LiW55WM");
+var_dump(mb_strpos($string_mb, $needle2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strpos() : basic functionality***
+
+-- ASCII string 1 --
+int(4)
+
+-- ASCII string 2 --
+bool(false)
+
+-- Multibyte string 1 --
+int(0)
+
+-- Multibyte string 2 --
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_error1.phpt b/ext/mbstring/tests/mb_strpos_error1.phpt
new file mode 100644
index 000000000..8f5ba8542
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_error1.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test mb_strpos() function : error conditions - Pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test how mb_strpos behaves when passed an incorrect number of arguments
+ */
+
+echo "*** Testing mb_strpos() : error conditions ***\n";
+
+
+//Test mb_strpos with one more than the expected number of arguments
+echo "\n-- Testing mb_strpos() function with more than expected no. of arguments --\n";
+$haystack = 'string_val';
+$needle = 'string_val';
+$offset = 10;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_strpos($haystack, $needle, $offset, $encoding, $extra_arg) );
+
+// Testing mb_strpos with one less than the expected number of arguments
+echo "\n-- Testing mb_strpos() function with less than expected no. of arguments --\n";
+$haystack = 'string_val';
+var_dump( mb_strpos($haystack) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strpos() : error conditions ***
+
+-- Testing mb_strpos() function with more than expected no. of arguments --
+
+Warning: mb_strpos() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_strpos() function with less than expected no. of arguments --
+
+Warning: mb_strpos() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_strpos_error2.phpt b/ext/mbstring/tests/mb_strpos_error2.phpt
new file mode 100644
index 000000000..f75390f2c
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_error2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test mb_strpos() function : error conditions - Pass unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass an unknown encoding to mb_strpos() to test behaviour
+ */
+
+echo "*** Testing mb_strpos() : error conditions ***\n";
+$haystack = 'Hello, world';
+$needle = 'world';
+$offset = 2;
+$encoding = 'unknown-encoding';
+
+var_dump( mb_strpos($haystack, $needle, $offset, $encoding) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strpos() : error conditions ***
+
+Warning: mb_strpos(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_strpos_variation1.phpt b/ext/mbstring/tests/mb_strpos_variation1.phpt
new file mode 100644
index 000000000..61f534791
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_variation1.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Test mb_strpos() function : usage variations - pass different data types to $haystack arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strpos different data types as $haystack arg to test behaviour
+ */
+
+echo "*** Testing mb_strpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$needle = 'string_val';
+$offset = 0;
+$encoding = 'utf-8';
+
+//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 $haystack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_strpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strpos($input, $needle, $offset, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strpos() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strpos() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_variation2.phpt b/ext/mbstring/tests/mb_strpos_variation2.phpt
new file mode 100644
index 000000000..ed62ea8aa
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_variation2.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test mb_strpos() function : usage variations - pass different data types as $needle arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strpos different data types as $needle arg to test behaviour
+ */
+
+echo "*** Testing mb_strpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$haystack = 'string_val';
+$offset = 0;
+$encoding = 'utf-8';
+
+//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 $needle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_strpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strpos($haystack, $input, $offset, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strpos() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_strpos(): Empty delimiter. in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strpos() expects parameter 2 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_variation3.phpt b/ext/mbstring/tests/mb_strpos_variation3.phpt
new file mode 100644
index 000000000..8f8540ee8
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_variation3.phpt
@@ -0,0 +1,202 @@
+--TEST--
+Test mb_strpos() function : usage variations - pass different data types as $offset arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strpos different data types as $offset arg to test behaviour
+ */
+
+echo "*** Testing mb_strpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$needle = 'a';
+$haystack = 'string_val';
+$encoding = 'utf-8';
+
+//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 $offest argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_strpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strpos($haystack, $needle, $input, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strpos() : usage variations ***
+
+-- Iteration 1 --
+int(8)
+
+-- Iteration 2 --
+int(8)
+
+-- Iteration 3 --
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_strpos(): Offset not contained in string. in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+int(8)
+
+-- Iteration 9 --
+int(8)
+
+-- Iteration 10 --
+int(8)
+
+-- Iteration 11 --
+int(8)
+
+-- Iteration 12 --
+int(8)
+
+-- Iteration 13 --
+int(8)
+
+-- Iteration 14 --
+int(8)
+
+-- Iteration 15 --
+int(8)
+
+-- Iteration 16 --
+
+Warning: mb_strpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: mb_strpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: mb_strpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: mb_strpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: mb_strpos() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+int(8)
+
+-- Iteration 23 --
+int(8)
+
+-- Iteration 24 --
+
+Warning: mb_strpos() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strpos_variation4.phpt b/ext/mbstring/tests/mb_strpos_variation4.phpt
new file mode 100644
index 000000000..ac818c661
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_variation4.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test mb_strpos() function : usage variations - pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of first occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strpos different data types as $encoding arg to test behaviour
+ * Where possible 'UTF-8' has been entered as a string value
+ */
+
+echo "*** Testing mb_strpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$haystack = 'string_val';
+$needle = 'val';
+$offset = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strpos($haystack, $needle, $offset, $input));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strpos() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_strpos(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_strpos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_strpos(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strpos(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_strpos(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_strpos(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_strpos(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_strpos(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_strpos(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_strpos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_strpos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(7)
+
+-- Iteration 19 --
+int(7)
+
+-- Iteration 20 --
+int(7)
+
+-- Iteration 21 --
+int(7)
+
+-- Iteration 22 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_strpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strpos() expects parameter 4 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrpos_basic.phpt b/ext/mbstring/tests/mb_strrpos_basic.phpt
new file mode 100644
index 000000000..9de0388f4
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test mb_strrpos() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_strrpos()
+ */
+
+echo "*** Testing mb_strrpos() : basic ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'This is an English string. 0123456789.';
+//Japanese string in UTF-8
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- ASCII string 1 --\n";
+var_dump(mb_strrpos($string_ascii, 'is', 4, 'ISO-8859-1'));
+
+echo "\n-- ASCII string 2 --\n";
+var_dump(mb_strrpos($string_ascii, 'hello, world'));
+
+echo "\n-- Multibyte string 1 --\n";
+$needle1 = base64_decode('44CC');
+var_dump(mb_strrpos($string_mb, $needle1));
+
+echo "\n-- Multibyte string 2 --\n";
+$needle2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
+var_dump(mb_strrpos($string_mb, $needle2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strrpos() : basic ***
+
+-- ASCII string 1 --
+int(15)
+
+-- ASCII string 2 --
+bool(false)
+
+-- Multibyte string 1 --
+int(20)
+
+-- Multibyte string 2 --
+bool(false)
+Done
+
diff --git a/ext/mbstring/tests/mb_strrpos_error1.phpt b/ext/mbstring/tests/mb_strrpos_error1.phpt
new file mode 100644
index 000000000..727ef569f
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_error1.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test mb_strrpos() function : error conditions - pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strrpos() an incorrect number of arguments
+ */
+
+echo "*** Testing mb_strrpos() : error conditions ***\n";
+
+
+//Test mb_strrpos with one more than the expected number of arguments
+echo "\n-- Testing mb_strrpos() function with more than expected no. of arguments --\n";
+$haystack = 'string_val';
+$needle = 'string_val';
+$offset = 10;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_strrpos($haystack, $needle, $offset, $encoding, $extra_arg) );
+
+// Testing mb_strrpos with one less than the expected number of arguments
+echo "\n-- Testing mb_strrpos() function with less than expected no. of arguments --\n";
+$haystack = 'string_val';
+var_dump( mb_strrpos($haystack) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strrpos() : error conditions ***
+
+-- Testing mb_strrpos() function with more than expected no. of arguments --
+
+Warning: mb_strrpos() expects at most 4 parameters, 5 given in %s on line %d
+bool(false)
+
+-- Testing mb_strrpos() function with less than expected no. of arguments --
+
+Warning: mb_strrpos() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrpos_error2.phpt b/ext/mbstring/tests/mb_strrpos_error2.phpt
new file mode 100644
index 000000000..8247d370d
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_error2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_strrpos() function : error conditions - pass an unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strrpos() an encoding that doesn't exist
+ */
+
+echo "*** Testing mb_strrpos() : error conditions ***\n";
+
+$haystack = 'This is an English string. 0123456789.';
+$needle = '123';
+$offset = 5;
+$encoding = 'unknown-encoding';
+
+var_dump(mb_strrpos($haystack, $needle , $offset, $encoding));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strrpos() : error conditions ***
+
+Warning: mb_strrpos(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrpos_variation1.phpt b/ext/mbstring/tests/mb_strrpos_variation1.phpt
new file mode 100644
index 000000000..922cb73fd
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_variation1.phpt
@@ -0,0 +1,181 @@
+--TEST--
+Test mb_strrpos() function : usage variations - pass different data types to $haystack arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strrpos() different data types as $haystack argument to test behaviour
+ */
+
+echo "*** Testing mb_strrpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$needle = 'world';
+$offset = 0;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "hello, world";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello, world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $haystack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "hello, world",
+ 'hello, world',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strrpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strrpos($input, $needle, $offset, $encoding));
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strrpos() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+int(7)
+
+-- Iteration 19 --
+int(7)
+
+-- Iteration 20 --
+int(7)
+
+-- Iteration 21 --
+int(7)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strrpos() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrpos_variation2.phpt b/ext/mbstring/tests/mb_strrpos_variation2.phpt
new file mode 100644
index 000000000..4986096c7
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_variation2.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test mb_strrpos() function : usage variations - Pass different data types to $needle arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strrpos() different data types as $needle argument to test behaviour
+ */
+
+echo "*** Testing mb_strrpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$haystack = 'hello, world';
+$offset = 0;
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "world";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $needle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "world",
+ 'world',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strrpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strrpos($haystack, $input, $offset, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strrpos() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+int(7)
+
+-- Iteration 19 --
+int(7)
+
+-- Iteration 20 --
+int(7)
+
+-- Iteration 21 --
+int(7)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strrpos() expects parameter 2 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrpos_variation3.phpt b/ext/mbstring/tests/mb_strrpos_variation3.phpt
new file mode 100644
index 000000000..714ea1693
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_variation3.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test mb_strrpos() function : usage variations - Pass different data types as $offset arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strrpos() different data types as $offset argument to test behaviour
+ */
+
+echo "*** Testing mb_strrpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$needle = 'a';
+$haystack = 'string_val';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "7";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $offset argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // object data
+/*16*/ new classA(),
+
+ // undefined data
+/*17*/ @$undefined_var,
+
+ // unset data
+/*18*/ @$unset_var
+);
+
+// loop through each element of $inputs to check the behavior of mb_strrpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strrpos($haystack, $needle, $input, $encoding));
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strrpos() : usage variations ***
+
+-- Iteration 1 --
+int(8)
+
+-- Iteration 2 --
+int(8)
+
+-- Iteration 3 --
+
+Notice: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Notice: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+
+Notice: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+int(8)
+
+-- Iteration 9 --
+int(8)
+
+-- Iteration 10 --
+int(8)
+
+-- Iteration 11 --
+int(8)
+
+-- Iteration 12 --
+int(8)
+
+-- Iteration 13 --
+int(8)
+
+-- Iteration 14 --
+int(8)
+
+-- Iteration 15 --
+int(8)
+
+-- Iteration 16 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(8)
+
+-- Iteration 17 --
+int(8)
+
+-- Iteration 18 --
+int(8)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrpos_variation4.phpt b/ext/mbstring/tests/mb_strrpos_variation4.phpt
new file mode 100644
index 000000000..e3d3d43c0
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_variation4.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test mb_strrpos() function : usage variations - pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass mb_strrpos() different data types as $encoding argument to test behaviour
+ * Where possible 'UTF-8' has been entered as a string value
+ */
+
+echo "*** Testing mb_strrpos() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$haystack = 'hello, world';
+$needle = 'world';
+$offset = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strrpos()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strrpos($haystack, $needle, $offset, $input));
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strrpos() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_strrpos(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_strrpos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_strrpos(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strrpos(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_strrpos(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_strrpos(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_strrpos(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_strrpos(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_strrpos(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_strrpos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_strrpos(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(7)
+
+-- Iteration 19 --
+int(7)
+
+-- Iteration 20 --
+int(7)
+
+-- Iteration 21 --
+int(7)
+
+-- Iteration 22 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_strrpos(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strrpos() expects parameter 4 to be string, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strrpos_variation5.phpt b/ext/mbstring/tests/mb_strrpos_variation5.phpt
new file mode 100644
index 000000000..8fdd40da3
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_variation5.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test mb_strrpos() function : usage variations - pass encoding as third argument (deprecated behaviour)
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
+ * Description: Find position of last occurrence of a string within another
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Testing deprecated behaviour where third argument can be $encoding
+ */
+
+echo "*** Testing mb_strrpos() : usage variations ***\n";
+
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+$needle_mb = base64_decode('44CC');
+
+$stringh = <<<END
+utf-8
+END;
+
+$inputs = array('Double Quoted String' => "utf-8",
+ 'Single Quoted String' => 'utf-8',
+ 'Heredoc' => $stringh);
+foreach ($inputs as $type => $input) {
+ echo "\n-- $type --\n";
+ echo "-- With fourth encoding argument --\n";
+ var_dump(mb_strrpos($string_mb, $needle_mb, $input, 'utf-8'));
+ echo "-- Without fourth encoding argument --\n";
+ var_dump(mb_strrpos($string_mb, $needle_mb, $input));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strrpos() : usage variations ***
+
+-- Double Quoted String --
+-- With fourth encoding argument --
+int(20)
+-- Without fourth encoding argument --
+int(20)
+
+-- Single Quoted String --
+-- With fourth encoding argument --
+int(20)
+-- Without fourth encoding argument --
+int(20)
+
+-- Heredoc --
+-- With fourth encoding argument --
+int(20)
+-- Without fourth encoding argument --
+int(20)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtolower_basic.phpt b/ext/mbstring/tests/mb_strtolower_basic.phpt
new file mode 100644
index 000000000..b1d31e2bc
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtolower_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test mb_strtolower() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
+ * Description: Returns a lowercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_strtolower
+ */
+
+echo "*** Testing mb_strtolower() : basic functionality***\n";
+
+$ascii_lower = 'abcdefghijklmnopqrstuvwxyz';
+$ascii_upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+$greek_lower = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
+$greek_upper = base64_decode('zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p');
+
+echo "\n-- ASCII String --\n";
+$ascii = mb_strtolower($ascii_upper);
+var_dump($ascii);
+
+if($ascii == $ascii_lower) {
+ echo "Correctly converted\n";
+} else {
+ echo "Incorrectly converted\n";
+}
+
+echo "\n-- Multibyte String --\n";
+$mb = mb_strtolower($greek_upper, 'UTF-8');
+var_dump(base64_encode($mb));
+
+if ($mb == $greek_lower) {
+ echo "Correctly converted\n";
+} else {
+ echo "Incorreclty converted\n";
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strtolower() : basic functionality***
+
+-- ASCII String --
+string(26) "abcdefghijklmnopqrstuvwxyz"
+Correctly converted
+
+-- Multibyte String --
+string(64) "zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J"
+Correctly converted
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtolower_error1.phpt b/ext/mbstring/tests/mb_strtolower_error1.phpt
new file mode 100644
index 000000000..13cdd3ce7
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtolower_error1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test mb_strtolower() function : error conditions - pass incorrect number of arguments
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
+ * Description: Returns a lowercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to mb_strtolower() to test behaviour
+ */
+
+echo "*** Testing mb_strtolower() : error conditions***\n";
+
+//Test mb_strtolower with one more than the expected number of arguments
+echo "\n-- Testing mb_strtolower() function with more than expected no. of arguments --\n";
+$sourcestring = 'string_value';
+$encoding = 'UTF-8';
+$extra_arg = 10;
+var_dump( mb_strtolower($sourcestring, $encoding, $extra_arg) );
+
+//Test mb_strtolower with zero arguments
+echo "\n-- Testing mb_strtolower() function with zero arguments --\n";
+var_dump( mb_strtolower() );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strtolower() : error conditions***
+
+-- Testing mb_strtolower() function with more than expected no. of arguments --
+
+Warning: mb_strtolower() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing mb_strtolower() function with zero arguments --
+
+Warning: mb_strtolower() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtolower_error2.phpt b/ext/mbstring/tests/mb_strtolower_error2.phpt
new file mode 100644
index 000000000..d84026b41
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtolower_error2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test mb_strtolower() function : error conditions - pass an unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
+ * Description: Returns a lowercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass an unknown encoding to mb_strtolower() to test behaviour
+ */
+
+echo "*** Testing mb_strtolower() : error conditions***\n";
+
+$sourcestring = 'hello, world';
+$encoding = 'unknown-encoding';
+
+var_dump( mb_strtolower($sourcestring, $encoding) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strtolower() : error conditions***
+
+Warning: mb_strtolower(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtolower_variation1.phpt b/ext/mbstring/tests/mb_strtolower_variation1.phpt
new file mode 100644
index 000000000..ac468ca0d
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtolower_variation1.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test mb_strtolower() function : usage variations - pass different data types as $sourcestring arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
+ * Description: Returns a lowercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $sourcestring argument to test behaviour of mb_strtolower()
+ */
+
+echo "*** Testing mb_strtolower() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$encoding = 'UTF-8';
+
+//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 $sourcestring argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_strtolower()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strtolower($input, $encoding) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strtolower() : 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) "123456789000"
+
+-- Iteration 8 --
+string(13) "1.23456789e-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+
+-- Iteration 10 --
+string(0) ""
+
+-- Iteration 11 --
+string(0) ""
+
+-- 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 --
+string(11) "hello world"
+
+-- Iteration 21 --
+string(14) "class a object"
+
+-- Iteration 22 --
+string(0) ""
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+
+Warning: mb_strtolower() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtolower_variation2.phpt b/ext/mbstring/tests/mb_strtolower_variation2.phpt
new file mode 100644
index 000000000..c9a674f5c
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtolower_variation2.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test mb_strtolower() function : usage variations - pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
+ * Description: Returns a lowercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types to $encoding argument to test behaviour of mb_strtolower()
+ * Where possible, 'UTF-8' has been entered as a string value
+ */
+
+echo "*** Testing mb_strtolower() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$sourcestring = 'Hello, World';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strtolower()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strtolower($sourcestring, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_strtolower() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_strtolower(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_strtolower(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_strtolower(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strtolower(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_strtolower(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_strtolower(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_strtolower(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_strtolower(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_strtolower(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_strtolower(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_strtolower(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_strtolower(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_strtolower(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_strtolower(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strtolower(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+string(12) "hello, world"
+
+-- Iteration 19 --
+string(12) "hello, world"
+
+-- Iteration 20 --
+string(12) "hello, world"
+
+-- Iteration 21 --
+string(12) "hello, world"
+
+-- Iteration 22 --
+
+Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_strtolower(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strtolower() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtolower_variation3.phpt b/ext/mbstring/tests/mb_strtolower_variation3.phpt
new file mode 100644
index 000000000..7ff3cee33
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtolower_variation3.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test mb_strtolower() function : usage variations - pass mixed ASCII and non-ASCII strings
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
+ * Description: Returns a lowercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
+ * to check correct conversion is occuring (Japanese characters should not be converted).
+ */
+
+echo "*** Testing mb_strtolower() : usage variations ***\n";
+
+$string_mixed = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
+$string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
+$string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
+
+echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
+$a = mb_strtolower($string_mixed, 'UTF-8');
+var_dump(base64_encode($a));
+if ($a == $string_mixed_lower) {
+ echo "Correctly Converted\n";
+} else {
+ echo "Incorrectly Converted\n";
+}
+
+echo "\n-- Multibyte Only String--\n";
+$b = mb_strtolower($string_all_mb, 'UTF-8');
+var_dump(base64_encode($b));
+if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
+ echo "Correctly Converted\n";
+} else {
+ echo "Incorrectly Converted\n";
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtolower() : usage variations ***
+
+-- Mixed string (mulitbyte and ASCII characters) --
+string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=="
+Correctly Converted
+
+-- Multibyte Only String--
+string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
+Correctly Converted
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtolower_variation4.phpt b/ext/mbstring/tests/mb_strtolower_variation4.phpt
new file mode 100644
index 000000000..f08b50879
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtolower_variation4.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test mb_strtolower() function : usage variations - pass different characters to check conversion is correct
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtolower(string $sourcestring [, string $encoding])
+ * Description: Returns a lowercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass accented characters and Russian characters to check case conversion is correct
+ */
+
+echo "*** Testing mb_strtolower() : usage variations ***\n";
+
+$uppers = array('Basic Latin' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+ 'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='),
+ 'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw=='));
+$lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz',
+ 'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='),
+ 'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
+
+foreach ($uppers as $lang => $sourcestring) {
+ echo "\n-- $lang --\n";
+ $a = mb_strtolower($sourcestring, 'utf-8');
+ var_dump(base64_encode($a));
+ if ($a == $lowers[$lang]) {
+ echo "Correctly Converted\n";
+ } else {
+ echo "Incorrectly Converted\n";
+ }
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtolower() : usage variations ***
+
+-- Basic Latin --
+string(36) "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo="
+Correctly Converted
+
+-- Characters With Accents --
+string(64) "w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=="
+Correctly Converted
+
+-- Russian --
+string(24) "0LDQsdCy0LPQtNC10LbQtw=="
+Correctly Converted
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_basic.phpt b/ext/mbstring/tests/mb_strtoupper_basic.phpt
new file mode 100644
index 000000000..b282647f8
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtoupper_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test mb_strtoupper() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
+ * Description: Returns a uppercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test basic functionality of mb_strtoupper
+ */
+
+echo "*** Testing mb_strtoupper() : basic functionality ***\n";
+
+mb_internal_encoding('utf-8');
+$ascii_lower = 'abcdefghijklmnopqrstuvwxyz';
+$ascii_upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+$greek_lower = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
+$greek_upper = base64_decode('zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p');
+
+echo "\n-- ASCII String --\n";
+$ascii = mb_strtoupper($ascii_lower);
+var_dump($ascii);
+
+if($ascii == $ascii_upper) {
+ echo "Correctly converted\n";
+} else {
+ echo "Incorrectly converted\n";
+}
+
+echo "\n-- Multibyte String --\n";
+$mb = mb_strtoupper($greek_lower, 'UTF-8');
+var_dump(base64_encode($mb));
+
+if ($mb == $greek_upper) {
+ echo "Correctly converted\n";
+} else {
+ echo "Incorreclty converted\n";
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtoupper() : basic functionality ***
+
+-- ASCII String --
+string(26) "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+Correctly converted
+
+-- Multibyte String --
+string(64) "zpHOks6TzpTOlc6WzpfOmM6ZzprOm86czp3Ons6fzqDOoc6jzqTOpc6mzqfOqM6p"
+Correctly converted
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_error1.phpt b/ext/mbstring/tests/mb_strtoupper_error1.phpt
new file mode 100644
index 000000000..d61c389c1
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtoupper_error1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test mb_strtoupper() function : error conditions - pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
+ * Description: Returns a uppercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to mb_strtoupper() to test behaviour
+ */
+
+echo "*** Testing mb_strtoupper() : error conditions ***\n";
+
+//Test mb_strtoupper with one more than the expected number of arguments
+echo "\n-- Testing mb_strtoupper() function with more than expected no. of arguments --\n";
+$sourcestring = 'string_value';
+$encoding = 'UTF-8';
+$extra_arg = 10;
+var_dump( mb_strtoupper($sourcestring, $encoding, $extra_arg) );
+
+//Test mb_strtoupper with zero arguments
+echo "\n-- Testing mb_strtoupper() function with zero arguments --\n";
+var_dump( mb_strtoupper() );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtoupper() : error conditions ***
+
+-- Testing mb_strtoupper() function with more than expected no. of arguments --
+
+Warning: mb_strtoupper() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing mb_strtoupper() function with zero arguments --
+
+Warning: mb_strtoupper() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_error2.phpt b/ext/mbstring/tests/mb_strtoupper_error2.phpt
new file mode 100644
index 000000000..b198fe100
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtoupper_error2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test mb_strtoupper() function : error conditions - pass an unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
+ * Description: Returns a uppercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass an unknown encoding as $encoding argument to check behaviour of mbstrtoupper()
+ */
+
+echo "*** Testing mb_strtoupper() : error conditions ***\n";
+
+$sourcestring = 'hello, world';
+$encoding = 'unknown-encoding';
+
+var_dump( mb_strtoupper($sourcestring, $encoding) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtoupper() : error conditions ***
+
+Warning: mb_strtoupper(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_variation1.phpt b/ext/mbstring/tests/mb_strtoupper_variation1.phpt
new file mode 100644
index 000000000..b602f696b
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtoupper_variation1.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Test mb_strtoupper() function : usage varitations - pass different data types as $sourcestring arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
+ * Description: Returns a uppercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ *
+ * Pass different data types as $sourcestring argument to mb_strtoupper to test behaviour
+ */
+
+echo "*** Testing mb_strtoupper() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$encoding = 'UTF-8';
+
+//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 $sourcestring argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_strtoupper()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strtoupper($input, $encoding) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtoupper() : 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) "123456789000"
+
+-- Iteration 8 --
+string(13) "1.23456789E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+
+-- Iteration 10 --
+string(0) ""
+
+-- Iteration 11 --
+string(0) ""
+
+-- 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 --
+string(12) "HELLO, WORLD"
+
+-- Iteration 21 --
+string(14) "CLASS A OBJECT"
+
+-- Iteration 22 --
+string(0) ""
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+
+Warning: mb_strtoupper() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_variation2.phpt b/ext/mbstring/tests/mb_strtoupper_variation2.phpt
new file mode 100644
index 000000000..3291ce71c
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtoupper_variation2.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test mb_strtoupper() function : usage varitations - Pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
+ * Description: Returns a uppercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types as $encoding argument to mb_strtoupper() to test behaviour
+ * Where possible, 'UTF-8' is entered as string value
+ */
+
+echo "*** Testing mb_strtoupper() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$sourcestring = 'Hello, World';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_strtoupper()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_strtoupper($sourcestring, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtoupper() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_strtoupper(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_strtoupper(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_strtoupper(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_strtoupper(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_strtoupper(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_strtoupper(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_strtoupper(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_strtoupper(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_strtoupper(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_strtoupper(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_strtoupper(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_strtoupper(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_strtoupper(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_strtoupper(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_strtoupper(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+string(12) "HELLO, WORLD"
+
+-- Iteration 19 --
+string(12) "HELLO, WORLD"
+
+-- Iteration 20 --
+string(12) "HELLO, WORLD"
+
+-- Iteration 21 --
+string(12) "HELLO, WORLD"
+
+-- Iteration 22 --
+
+Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_strtoupper(): Unknown encoding "(null)" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_strtoupper() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_variation3.phpt b/ext/mbstring/tests/mb_strtoupper_variation3.phpt
new file mode 100644
index 000000000..9b2956976
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtoupper_variation3.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test mb_strtoupper() function : usage varitations - pass mixed ASCII and non-ASCII strings
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
+ * Description: Returns a uppercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
+ * to check correct conversion is occuring (Japanese characters should not be converted).
+ */
+
+echo "*** Testing mb_strtoupper() : usage variations ***\n";
+
+$string_mixed_upper = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
+$string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
+$string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
+
+
+echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
+$a = mb_strtoupper($string_mixed_lower, 'UTF-8');
+var_dump(base64_encode($a));
+if ($a == $string_mixed_upper) {
+ echo "Correctly Converted\n";
+} else {
+ echo "Incorrectly Converted\n";
+}
+
+echo "\n-- Multibyte Only String--\n";
+$b = mb_strtoupper($string_all_mb, 'UTF-8');
+var_dump(base64_encode($b));
+if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
+ echo "Correctly Converted\n";
+} else {
+ echo "Incorrectly Converted\n";
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtoupper() : usage variations ***
+
+-- Mixed string (mulitbyte and ASCII characters) --
+string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=="
+Correctly Converted
+
+-- Multibyte Only String--
+string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
+Correctly Converted
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_strtoupper_variation4.phpt b/ext/mbstring/tests/mb_strtoupper_variation4.phpt
new file mode 100644
index 000000000..8f5abe726
--- /dev/null
+++ b/ext/mbstring/tests/mb_strtoupper_variation4.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test mb_strtoupper() function : usage varitations - Pass different character types to check conversion is correct
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding]
+ * Description: Returns a uppercased version of $sourcestring
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass characters from different languages to check that mb_strtoupper is
+ * doing a correct case conversion
+ */
+
+echo "*** Testing mb_strtoupper() : usage variations ***\n";
+
+$uppers = array('Basic Latin' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+ 'Characters With Accents' => base64_decode('w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=='),
+ 'Russian' => base64_decode('0JDQkdCS0JPQlNCV0JbQlw=='));
+$lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz',
+ 'Characters With Accents' => base64_decode('w6DDocOiw6PDpMOlw6bDp8Oow6nDqsOrw6zDrcOuw6/DsMOxw7LDs8O0w7XDtg=='),
+ 'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
+
+foreach ($lowers as $lang => $sourcestring) {
+ echo "\n-- $lang --\n";
+ $a = mb_strtoupper($sourcestring, 'UTF-8');
+ var_dump(base64_encode($a));
+ if ($a == $uppers[$lang]) {
+ echo "Correctly Converted\n";
+ } else {
+ echo "Incorrectly Converted\n";
+ }
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_strtoupper() : usage variations ***
+
+-- Basic Latin --
+string(36) "QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo="
+Correctly Converted
+
+-- Characters With Accents --
+string(64) "w4DDgcOCw4PDhMOFw4bDh8OIw4nDisOLw4zDjcOOw4/DkMORw5LDk8OUw5XDlg=="
+Correctly Converted
+
+-- Russian --
+string(24) "0JDQkdCS0JPQlNCV0JbQlw=="
+Correctly Converted
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_basic.phpt b/ext/mbstring/tests/mb_substr_basic.phpt
new file mode 100644
index 000000000..a43cf15bb
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test mb_substr() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test Basic Functionality of mb_substr with ASCII characters and multibyte strings.
+ */
+
+echo "*** Testing mb_substr() : basic functionality ***\n";
+
+$string_ascii = 'ABCDEF';
+//Japanese string in UTF-8
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+echo "\n-- ASCII string 1 --\n";
+var_dump(mb_substr($string_ascii, 3));
+
+echo "\n-- ASCII string 2 --\n";
+var_dump(mb_substr($string_ascii, 3, 5, 'ISO-8859-1'));
+
+echo "\n-- Multibyte string 1 --\n";
+$result_1 = mb_substr($string_mb, 2, 7);
+var_dump(base64_encode($result_1));
+
+echo "\n-- Multibyte string 2 --\n";
+$result_2 = mb_substr($string_mb, 2, 7, 'utf-8');
+var_dump(base64_encode($result_2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr() : basic functionality ***
+
+-- ASCII string 1 --
+string(3) "DEF"
+
+-- ASCII string 2 --
+string(3) "DEF"
+
+-- Multibyte string 1 --
+string(12) "peacrOiqng=="
+
+-- Multibyte string 2 --
+string(28) "6Kqe44OG44Kt44K544OI44Gn44GZ"
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_count_basic.phpt b/ext/mbstring/tests/mb_substr_count_basic.phpt
new file mode 100644
index 000000000..4b8756741
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_count_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test mb_substr_count() function : basic functionality
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_substr_count(string $haystack, string $needle [, string $encoding])
+ * Description: Count the number of substring occurrences
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test Basic functionality of mb_substr_count
+ */
+
+echo "*** Testing mb_substr_count() : basic functionality ***\n";
+
+$string_ascii = 'This is an English string. 0123456789.';
+
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+$needle_mb1 = base64_decode('44CC');
+$needle_mb2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
+
+echo "\n-- ASCII String --\n";
+var_dump(mb_substr_count($string_ascii, 'is'));
+var_dump(mb_substr_count($string_ascii, 'hello, world'));
+
+echo "\n-- Multibyte String --\n";
+var_dump(mb_substr_count($string_mb, $needle_mb1));
+var_dump(mb_substr_count($string_mb, $needle_mb2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr_count() : basic functionality ***
+
+-- ASCII String --
+int(3)
+int(0)
+
+-- Multibyte String --
+int(2)
+int(0)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_count_error1.phpt b/ext/mbstring/tests/mb_substr_count_error1.phpt
new file mode 100644
index 000000000..8ddcaa6d6
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_count_error1.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test mb_substr_count() function : error conditions - pass incorrect number of arguments
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_substr_count(string $haystack, string $needle [, string $encoding])
+ * Description: Count the number of substring occurrences
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to mb_substr_count() to test behaviour
+ */
+
+echo "*** Testing mb_substr_count() : error conditions ***\n";
+
+
+//Test mb_substr_count with one more than the expected number of arguments
+echo "\n-- Testing mb_substr_count() function with more than expected no. of arguments --\n";
+$haystack = 'string_val';
+$needle = 'val';
+$encoding = 'utf-8';
+$extra_arg = 10;
+var_dump( mb_substr_count($haystack, $needle, $encoding, $extra_arg) );
+
+// Testing mb_substr_count with one less than the expected number of arguments
+echo "\n-- Testing mb_substr_count() function with less than expected no. of arguments --\n";
+$haystack = 'string_val';
+var_dump( mb_substr_count($haystack) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr_count() : error conditions ***
+
+-- Testing mb_substr_count() function with more than expected no. of arguments --
+
+Warning: mb_substr_count() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing mb_substr_count() function with less than expected no. of arguments --
+
+Warning: mb_substr_count() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_count_error2.phpt b/ext/mbstring/tests/mb_substr_count_error2.phpt
new file mode 100644
index 000000000..e2572b028
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_count_error2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test mb_substr_count() function : error conditions - pass unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_substr_count(string $haystack, string $needle [, string $encoding])
+ * Description: Count the number of substring occurrences
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test behaviour of mb_substr_count() function when passed an unknown encoding
+ */
+
+echo "*** Testing mb_substr_count() : error conditions ***\n";
+
+$haystack = 'Hello, World!';
+$needle = 'Hello';
+$encoding = 'unknown-encoding';
+
+echo "\n-- Testing mb_substr_count() function with an unknown encoding --\n";
+var_dump(mb_substr_count($haystack, $needle, $encoding));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr_count() : error conditions ***
+
+-- Testing mb_substr_count() function with an unknown encoding --
+
+Warning: mb_substr_count(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_count_variation1.phpt b/ext/mbstring/tests/mb_substr_count_variation1.phpt
new file mode 100644
index 000000000..8121b4871
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_count_variation1.phpt
@@ -0,0 +1,183 @@
+--TEST--
+Test mb_substr_count() function : usage variations - Pass different data types as $haystack arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype :int mb_substr_count(string $haystack, string $needle [, string $encoding])
+ * Description: Count the number of substring occurrences
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types as $haystack argument to mb_substr_count() to test behaviour
+ */
+
+echo "*** Testing mb_substr_count() : usage variations ***\n";
+
+
+// Initialise function arguments not being substituted
+$needle = 'world';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "hello, world";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello, world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $haystack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "hello, world",
+ 'hello, world',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_substr_count()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_substr_count($input, $needle, $encoding) );
+ $iterator++;
+};
+
+fclose($fp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr_count() : usage variations ***
+
+-- 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(1)
+
+-- Iteration 19 --
+int(1)
+
+-- Iteration 20 --
+int(1)
+
+-- Iteration 21 --
+int(1)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+
+Warning: mb_substr_count() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/mbstring/tests/mb_substr_count_variation2.phpt b/ext/mbstring/tests/mb_substr_count_variation2.phpt
new file mode 100644
index 000000000..dac48b55a
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_count_variation2.phpt
@@ -0,0 +1,197 @@
+--TEST--
+Test mb_substr_count() function : usage variations - pass different data types as $needle arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_substr_count(string $haystack, string $needle [, string $encoding])
+ * Description: Count the number of substring occurrences
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types as $needle to mb_substr_count() to test behaviour
+ */
+
+echo "*** Testing mb_substr_count() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$haystack = 'hello, world';
+$encoding = 'utf-8';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "world";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $needle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "world",
+ 'world',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_substr_count()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_substr_count($haystack, $input, $encoding) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr_count() : usage variations ***
+
+-- 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 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(1)
+
+-- Iteration 19 --
+int(1)
+
+-- Iteration 20 --
+int(1)
+
+-- Iteration 21 --
+int(1)
+
+-- Iteration 22 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_substr_count(): Empty substring. in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_substr_count() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_count_variation3.phpt b/ext/mbstring/tests/mb_substr_count_variation3.phpt
new file mode 100644
index 000000000..d2e7a6056
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_count_variation3.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test mb_substr_count() function :usage variations - pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : int mb_substr_count(string $haystack, string $needle [, string $encoding])
+ * Description: Count the number of substring occurrences
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types as $encoding argument to mb_substr_count() to test behaviour
+ * Where possible, 'UTF-8' is entered as string value
+ */
+
+echo "*** Testing mb_substr_count() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$haystack = 'hello, world';
+$needle = 'world';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $encoding argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_substr_count()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_substr_count($haystack, $needle, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr_count() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_substr_count(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_substr_count(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_substr_count(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_substr_count(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_substr_count(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_substr_count(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_substr_count(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_substr_count(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_substr_count(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_substr_count(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_substr_count(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(1)
+
+-- Iteration 19 --
+int(1)
+
+-- Iteration 20 --
+int(1)
+
+-- Iteration 21 --
+int(1)
+
+-- Iteration 22 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_substr_count(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_substr_count() expects parameter 3 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_error1.phpt b/ext/mbstring/tests/mb_substr_error1.phpt
new file mode 100644
index 000000000..c2007c93b
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_error1.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test mb_substr() function : error conditions - Pass incorrect number of args
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass incorrect number of arguments to mb_substr() to test behaviour
+ */
+
+echo "*** Testing mb_substr() : error conditions ***\n";
+
+//Test mb_substr with one more than the expected number of arguments
+echo "\n-- Testing mb_substr() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$start = 10;
+$length = 10;
+$encoding = 'string_val';
+$extra_arg = 10;
+var_dump( mb_substr($str, $start, $length, $encoding, $extra_arg) );
+
+// Testing mb_substr with one less than the expected number of arguments
+echo "\n-- Testing mb_substr() function with less than expected no. of arguments --\n";
+$str = 'string_val';
+var_dump( mb_substr($str) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr() : error conditions ***
+
+-- Testing mb_substr() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for mb_substr() in %s on line %d
+NULL
+
+-- Testing mb_substr() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for mb_substr() in %s on line %d
+NULL
+Done
diff --git a/ext/mbstring/tests/mb_substr_error2.phpt b/ext/mbstring/tests/mb_substr_error2.phpt
new file mode 100644
index 000000000..72be974ed
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_error2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test mb_substr() function : error conditions - Pass an unknown encoding
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass an unknown encoding to mb_substr() to test behaviour
+ */
+
+echo "*** Testing mb_substr() : error conditions ***\n";
+
+$str = 'Hello, world';
+$start = 1;
+$length = 5;
+$encoding = 'unknown-encoding';
+
+var_dump( mb_substr($str, $start, $length, $encoding));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr() : error conditions ***
+
+Warning: mb_substr(): Unknown encoding "unknown-encoding" in %s on line %d
+bool(false)
+Done
diff --git a/ext/mbstring/tests/mb_substr_variation1.phpt b/ext/mbstring/tests/mb_substr_variation1.phpt
new file mode 100644
index 000000000..fd9d0db47
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_variation1.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test mb_substr() function : usage variations - pass unexpected arguments (including strings) in place of $str
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types as $str to mb_substr() to test behaviour
+ */
+
+echo "*** Testing mb_substr() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start = 0;
+$length = 5;
+$encoding = 'utf-8';
+
+//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 $str argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of mb_substr()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_substr($input, $start, $length, $encoding));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr() : 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(5) "12345"
+
+-- Iteration 8 --
+string(5) "1.234"
+
+-- Iteration 9 --
+string(3) "0.5"
+
+-- Iteration 10 --
+string(0) ""
+
+-- Iteration 11 --
+string(0) ""
+
+-- 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(5) "strin"
+
+-- Iteration 19 --
+string(5) "strin"
+
+-- Iteration 20 --
+string(5) "hello"
+
+-- Iteration 21 --
+string(5) "Class"
+
+-- Iteration 22 --
+string(0) ""
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+string(5) "Resou"
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation2.phpt b/ext/mbstring/tests/mb_substr_variation2.phpt
new file mode 100644
index 000000000..cb8a37af5
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_variation2.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test mb_substr() function : usage variations - Pass different data types as $encoding arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass different data types as $encoding argument to mb_substr() to test behaviour
+ * Where possible, 'UTF-8' is entered as string value
+ */
+
+echo "*** Testing mb_substr() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$str = 'string_val';
+$start = 1;
+$length = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "UTF-8";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+UTF-8
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "UTF-8",
+ 'UTF-8',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of mb_substr
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( mb_substr($str, $start, $length, $input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: mb_substr(): Unknown encoding "0" in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: mb_substr(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: mb_substr(): Unknown encoding "12345" in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: mb_substr(): Unknown encoding "-2345" in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: mb_substr(): Unknown encoding "10.5" in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: mb_substr(): Unknown encoding "-10.5" in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: mb_substr(): Unknown encoding "123456789000" in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: mb_substr(): Unknown encoding "1.23456789E-9" in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: mb_substr(): Unknown encoding "0.5" in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: mb_substr(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: mb_substr(): Unknown encoding "1" in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+string(5) "tring"
+
+-- Iteration 19 --
+string(5) "tring"
+
+-- Iteration 20 --
+string(5) "tring"
+
+-- Iteration 21 --
+string(5) "tring"
+
+-- Iteration 22 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: mb_substr(): Unknown encoding "" in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: mb_substr(): Unknown encoding "Resource id #%d" in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation3.phpt b/ext/mbstring/tests/mb_substr_variation3.phpt
new file mode 100644
index 000000000..bb930b4b9
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_variation3.phpt
@@ -0,0 +1,445 @@
+--TEST--
+Test mb_substr() function : usage variations - test different encodings
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Pass all encodings listed on php.net to test that function recognises them.
+ * NB: The strings passed are *NOT* necessarily encoded in the encoding passed to the function.
+ * This test is purely to see whether the function recognises the encoding.
+ */
+
+echo "*** Testing mb_substr() : usage variations ***\n";
+
+$encoding = array('UCS-4', /*1*/
+ 'UCS-4BE',
+ 'UCS-4LE',
+ 'UCS-2',
+ 'UCS-2BE', /*5*/
+ 'UCS-2LE',
+ 'UTF-32',
+ 'UTF-32BE',
+ 'UTF-32LE',
+ 'UTF-16', /*10*/
+ 'UTF-16BE',
+ 'UTF-16LE',
+ 'UTF-7',
+ 'UTF7-IMAP',
+ 'UTF-8', /*15*/
+ 'ASCII',
+ 'EUC-JP',
+ 'SJIS',
+ 'eucJP-win',
+ 'SJIS-win', /*20*/
+ 'ISO-2022-JP',
+ 'JIS',
+ 'ISO-8859-1',
+ 'ISO-8859-2',
+ 'ISO-8859-3', /*25*/
+ 'ISO-8859-4',
+ 'ISO-8859-5',
+ 'ISO-8859-6',
+ 'ISO-8859-7',
+ 'ISO-8859-8', /*30*/
+ 'ISO-8859-9',
+ 'ISO-8859-10',
+ 'ISO-8859-13',
+ 'ISO-8859-14',
+ 'ISO-8859-15', /*35*/
+ 'byte2be',
+ 'byte2le',
+ 'byte4be',
+ 'byte4le',
+ 'BASE64', /*40*/
+ 'HTML-ENTITIES',
+ '7bit',
+ '8bit',
+ 'EUC-CN',
+ 'CP936', /*45*/
+ 'HZ',
+ 'EUC-TW',
+ 'CP950',
+ 'BIG-5',
+ 'EUC-KR', /*50*/
+ 'UHC',
+ 'ISO-2022-KR',
+ 'Windows-1251',
+ 'Windows-1252',
+ 'CP866', /*55*/
+ 'KOI8-R'); /*56*/
+
+
+
+$iterator = 1;
+$string_ascii = 'abc def';
+//Japanese string encoded in UTF-8
+$string_mb = base64_decode('44K/44OT44Ol44Os44O844OG44Kj44Oz44Kw44O744Oe44K344O844Oz44O744Kr44Oz44OR44OL44O8');
+
+foreach($encoding as $enc) {
+ echo "\n-- Iteration $iterator: $enc --\n";
+
+ echo "-- ASCII String --\n";
+ if (mb_substr($string_ascii, 1, 5, $enc)) {
+ echo "Encoding $enc recognised\n";
+ } else {
+ echo "Encoding $enc not recognised\n";
+ }
+
+ echo "-- Multibyte String --\n";
+ if (mb_substr($string_mb, 1, 5, $enc)) {
+ echo "Encoding $enc recognised\n";
+ } else {
+ echo "Encoding $enc not recognised\n";
+ }
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr() : usage variations ***
+
+-- Iteration 1: UCS-4 --
+-- ASCII String --
+Encoding UCS-4 recognised
+-- Multibyte String --
+Encoding UCS-4 recognised
+
+-- Iteration 1: UCS-4BE --
+-- ASCII String --
+Encoding UCS-4BE recognised
+-- Multibyte String --
+Encoding UCS-4BE recognised
+
+-- Iteration 1: UCS-4LE --
+-- ASCII String --
+Encoding UCS-4LE recognised
+-- Multibyte String --
+Encoding UCS-4LE recognised
+
+-- Iteration 1: UCS-2 --
+-- ASCII String --
+Encoding UCS-2 recognised
+-- Multibyte String --
+Encoding UCS-2 recognised
+
+-- Iteration 1: UCS-2BE --
+-- ASCII String --
+Encoding UCS-2BE recognised
+-- Multibyte String --
+Encoding UCS-2BE recognised
+
+-- Iteration 1: UCS-2LE --
+-- ASCII String --
+Encoding UCS-2LE recognised
+-- Multibyte String --
+Encoding UCS-2LE recognised
+
+-- Iteration 1: UTF-32 --
+-- ASCII String --
+Encoding UTF-32 recognised
+-- Multibyte String --
+Encoding UTF-32 recognised
+
+-- Iteration 1: UTF-32BE --
+-- ASCII String --
+Encoding UTF-32BE recognised
+-- Multibyte String --
+Encoding UTF-32BE recognised
+
+-- Iteration 1: UTF-32LE --
+-- ASCII String --
+Encoding UTF-32LE recognised
+-- Multibyte String --
+Encoding UTF-32LE recognised
+
+-- Iteration 1: UTF-16 --
+-- ASCII String --
+Encoding UTF-16 recognised
+-- Multibyte String --
+Encoding UTF-16 recognised
+
+-- Iteration 1: UTF-16BE --
+-- ASCII String --
+Encoding UTF-16BE recognised
+-- Multibyte String --
+Encoding UTF-16BE recognised
+
+-- Iteration 1: UTF-16LE --
+-- ASCII String --
+Encoding UTF-16LE recognised
+-- Multibyte String --
+Encoding UTF-16LE recognised
+
+-- Iteration 1: UTF-7 --
+-- ASCII String --
+Encoding UTF-7 recognised
+-- Multibyte String --
+Encoding UTF-7 recognised
+
+-- Iteration 1: UTF7-IMAP --
+-- ASCII String --
+Encoding UTF7-IMAP recognised
+-- Multibyte String --
+Encoding UTF7-IMAP recognised
+
+-- Iteration 1: UTF-8 --
+-- ASCII String --
+Encoding UTF-8 recognised
+-- Multibyte String --
+Encoding UTF-8 recognised
+
+-- Iteration 1: ASCII --
+-- ASCII String --
+Encoding ASCII recognised
+-- Multibyte String --
+Encoding ASCII recognised
+
+-- Iteration 1: EUC-JP --
+-- ASCII String --
+Encoding EUC-JP recognised
+-- Multibyte String --
+Encoding EUC-JP recognised
+
+-- Iteration 1: SJIS --
+-- ASCII String --
+Encoding SJIS recognised
+-- Multibyte String --
+Encoding SJIS recognised
+
+-- Iteration 1: eucJP-win --
+-- ASCII String --
+Encoding eucJP-win recognised
+-- Multibyte String --
+Encoding eucJP-win recognised
+
+-- Iteration 1: SJIS-win --
+-- ASCII String --
+Encoding SJIS-win recognised
+-- Multibyte String --
+Encoding SJIS-win recognised
+
+-- Iteration 1: ISO-2022-JP --
+-- ASCII String --
+Encoding ISO-2022-JP recognised
+-- Multibyte String --
+Encoding ISO-2022-JP recognised
+
+-- Iteration 1: JIS --
+-- ASCII String --
+Encoding JIS recognised
+-- Multibyte String --
+Encoding JIS recognised
+
+-- Iteration 1: ISO-8859-1 --
+-- ASCII String --
+Encoding ISO-8859-1 recognised
+-- Multibyte String --
+Encoding ISO-8859-1 recognised
+
+-- Iteration 1: ISO-8859-2 --
+-- ASCII String --
+Encoding ISO-8859-2 recognised
+-- Multibyte String --
+Encoding ISO-8859-2 recognised
+
+-- Iteration 1: ISO-8859-3 --
+-- ASCII String --
+Encoding ISO-8859-3 recognised
+-- Multibyte String --
+Encoding ISO-8859-3 recognised
+
+-- Iteration 1: ISO-8859-4 --
+-- ASCII String --
+Encoding ISO-8859-4 recognised
+-- Multibyte String --
+Encoding ISO-8859-4 recognised
+
+-- Iteration 1: ISO-8859-5 --
+-- ASCII String --
+Encoding ISO-8859-5 recognised
+-- Multibyte String --
+Encoding ISO-8859-5 recognised
+
+-- Iteration 1: ISO-8859-6 --
+-- ASCII String --
+Encoding ISO-8859-6 recognised
+-- Multibyte String --
+Encoding ISO-8859-6 recognised
+
+-- Iteration 1: ISO-8859-7 --
+-- ASCII String --
+Encoding ISO-8859-7 recognised
+-- Multibyte String --
+Encoding ISO-8859-7 recognised
+
+-- Iteration 1: ISO-8859-8 --
+-- ASCII String --
+Encoding ISO-8859-8 recognised
+-- Multibyte String --
+Encoding ISO-8859-8 recognised
+
+-- Iteration 1: ISO-8859-9 --
+-- ASCII String --
+Encoding ISO-8859-9 recognised
+-- Multibyte String --
+Encoding ISO-8859-9 recognised
+
+-- Iteration 1: ISO-8859-10 --
+-- ASCII String --
+Encoding ISO-8859-10 recognised
+-- Multibyte String --
+Encoding ISO-8859-10 recognised
+
+-- Iteration 1: ISO-8859-13 --
+-- ASCII String --
+Encoding ISO-8859-13 recognised
+-- Multibyte String --
+Encoding ISO-8859-13 recognised
+
+-- Iteration 1: ISO-8859-14 --
+-- ASCII String --
+Encoding ISO-8859-14 recognised
+-- Multibyte String --
+Encoding ISO-8859-14 recognised
+
+-- Iteration 1: ISO-8859-15 --
+-- ASCII String --
+Encoding ISO-8859-15 recognised
+-- Multibyte String --
+Encoding ISO-8859-15 recognised
+
+-- Iteration 1: byte2be --
+-- ASCII String --
+Encoding byte2be recognised
+-- Multibyte String --
+Encoding byte2be recognised
+
+-- Iteration 1: byte2le --
+-- ASCII String --
+Encoding byte2le recognised
+-- Multibyte String --
+Encoding byte2le recognised
+
+-- Iteration 1: byte4be --
+-- ASCII String --
+Encoding byte4be recognised
+-- Multibyte String --
+Encoding byte4be recognised
+
+-- Iteration 1: byte4le --
+-- ASCII String --
+Encoding byte4le recognised
+-- Multibyte String --
+Encoding byte4le recognised
+
+-- Iteration 1: BASE64 --
+-- ASCII String --
+Encoding BASE64 recognised
+-- Multibyte String --
+Encoding BASE64 recognised
+
+-- Iteration 1: HTML-ENTITIES --
+-- ASCII String --
+Encoding HTML-ENTITIES recognised
+-- Multibyte String --
+Encoding HTML-ENTITIES recognised
+
+-- Iteration 1: 7bit --
+-- ASCII String --
+Encoding 7bit recognised
+-- Multibyte String --
+Encoding 7bit recognised
+
+-- Iteration 1: 8bit --
+-- ASCII String --
+Encoding 8bit recognised
+-- Multibyte String --
+Encoding 8bit recognised
+
+-- Iteration 1: EUC-CN --
+-- ASCII String --
+Encoding EUC-CN recognised
+-- Multibyte String --
+Encoding EUC-CN recognised
+
+-- Iteration 1: CP936 --
+-- ASCII String --
+Encoding CP936 recognised
+-- Multibyte String --
+Encoding CP936 recognised
+
+-- Iteration 1: HZ --
+-- ASCII String --
+Encoding HZ recognised
+-- Multibyte String --
+Encoding HZ recognised
+
+-- Iteration 1: EUC-TW --
+-- ASCII String --
+Encoding EUC-TW recognised
+-- Multibyte String --
+Encoding EUC-TW recognised
+
+-- Iteration 1: CP950 --
+-- ASCII String --
+Encoding CP950 recognised
+-- Multibyte String --
+Encoding CP950 recognised
+
+-- Iteration 1: BIG-5 --
+-- ASCII String --
+Encoding BIG-5 recognised
+-- Multibyte String --
+Encoding BIG-5 recognised
+
+-- Iteration 1: EUC-KR --
+-- ASCII String --
+Encoding EUC-KR recognised
+-- Multibyte String --
+Encoding EUC-KR recognised
+
+-- Iteration 1: UHC --
+-- ASCII String --
+Encoding UHC recognised
+-- Multibyte String --
+Encoding UHC recognised
+
+-- Iteration 1: ISO-2022-KR --
+-- ASCII String --
+Encoding ISO-2022-KR recognised
+-- Multibyte String --
+Encoding ISO-2022-KR recognised
+
+-- Iteration 1: Windows-1251 --
+-- ASCII String --
+Encoding Windows-1251 recognised
+-- Multibyte String --
+Encoding Windows-1251 recognised
+
+-- Iteration 1: Windows-1252 --
+-- ASCII String --
+Encoding Windows-1252 recognised
+-- Multibyte String --
+Encoding Windows-1252 recognised
+
+-- Iteration 1: CP866 --
+-- ASCII String --
+Encoding CP866 recognised
+-- Multibyte String --
+Encoding CP866 recognised
+
+-- Iteration 1: KOI8-R --
+-- ASCII String --
+Encoding KOI8-R recognised
+-- Multibyte String --
+Encoding KOI8-R recognised
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation4.phpt b/ext/mbstring/tests/mb_substr_variation4.phpt
new file mode 100644
index 000000000..d2c4de3ce
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_variation4.phpt
@@ -0,0 +1,131 @@
+--TEST--
+Test mb_substr() function : usage variations - pass different integers to $start arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test how mb_substr() behaves when passed a range of integers as $start argument
+ */
+
+echo "*** Testing mb_substr() : usage variations ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = '+Is an English string'; //21 chars
+
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); //21 chars
+
+/*
+ * Loop through integers as multiples of ten for $offset argument
+ * 60 is larger than *BYTE* count for $string_mb
+ */
+for ($i = -60; $i <= 60; $i += 10) {
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ var_dump($a = mb_substr($string_ascii, $i, 4));
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, $i, 4, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(base64_encode($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
+
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing mb_substr() : usage variations ***
+
+**-- Offset is: -60 --**
+-- ASCII String --
+string(4) "+Is "
+--Multibyte String --
+string(16) "5pel5pys6Kqe44OG"
+
+**-- Offset is: -50 --**
+-- ASCII String --
+string(4) "+Is "
+--Multibyte String --
+string(16) "5pel5pys6Kqe44OG"
+
+**-- Offset is: -40 --**
+-- ASCII String --
+string(4) "+Is "
+--Multibyte String --
+string(16) "5pel5pys6Kqe44OG"
+
+**-- Offset is: -30 --**
+-- ASCII String --
+string(4) "+Is "
+--Multibyte String --
+string(16) "5pel5pys6Kqe44OG"
+
+**-- Offset is: -20 --**
+-- ASCII String --
+string(4) "Is a"
+--Multibyte String --
+string(16) "5pys6Kqe44OG44Kt"
+
+**-- Offset is: -10 --**
+-- ASCII String --
+string(4) "ish "
+--Multibyte String --
+string(8) "MTIzNA=="
+
+**-- Offset is: 0 --**
+-- ASCII String --
+string(4) "+Is "
+--Multibyte String --
+string(16) "5pel5pys6Kqe44OG"
+
+**-- Offset is: 10 --**
+-- ASCII String --
+string(4) "lish"
+--Multibyte String --
+string(8) "MDEyMw=="
+
+**-- Offset is: 20 --**
+-- ASCII String --
+string(1) "g"
+--Multibyte String --
+string(4) "44CC"
+
+**-- Offset is: 30 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: 40 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: 50 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: 60 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/mbstring/tests/mb_substr_variation5.phpt b/ext/mbstring/tests/mb_substr_variation5.phpt
new file mode 100644
index 000000000..02ea6d3aa
--- /dev/null
+++ b/ext/mbstring/tests/mb_substr_variation5.phpt
@@ -0,0 +1,134 @@
+--TEST--
+Test mb_substr() function : usage variations - pass different integers to $length arg
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_substr') or die("skip mb_substr() is not available in this build");
+?>
+--FILE--
+
+<?php
+/* Prototype : string mb_substr(string $str, int $start [, int $length [, string $encoding]])
+ * Description: Returns part of a string
+ * Source code: ext/mbstring/mbstring.c
+ */
+
+/*
+ * Test how mb_substr() behaves when passed a range of integers as $length argument
+ */
+
+echo "*** Testing mb_substr() : usage variations ***\n";
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = '+Is an English string'; //21 chars
+
+//Japanese string, 21 characters
+$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+/*
+ * Loop through integers as multiples of ten for $offset argument
+ * 60 is larger than *BYTE* count for $string_mb
+ */
+for ($i = -60; $i <= 60; $i += 10) {
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ var_dump($a = mb_substr($string_ascii, 1, $i));
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, 1, $i, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(base64_encode($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
+
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing mb_substr() : usage variations ***
+
+**-- Offset is: -60 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: -50 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: -40 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: -30 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: -20 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: -10 --**
+-- ASCII String --
+string(10) "Is an Engl"
+--Multibyte String --
+string(40) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMA=="
+
+**-- Offset is: 0 --**
+-- ASCII String --
+string(0) ""
+--Multibyte String --
+string(0) ""
+
+**-- Offset is: 10 --**
+-- ASCII String --
+string(10) "Is an Engl"
+--Multibyte String --
+string(40) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMA=="
+
+**-- Offset is: 20 --**
+-- ASCII String --
+string(20) "Is an English string"
+--Multibyte String --
+string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+
+**-- Offset is: 30 --**
+-- ASCII String --
+string(20) "Is an English string"
+--Multibyte String --
+string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+
+**-- Offset is: 40 --**
+-- ASCII String --
+string(20) "Is an English string"
+--Multibyte String --
+string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+
+**-- Offset is: 50 --**
+-- ASCII String --
+string(20) "Is an English string"
+--Multibyte String --
+string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+
+**-- Offset is: 60 --**
+-- ASCII String --
+string(20) "Is an English string"
+--Multibyte String --
+string(68) "5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII="
+Done \ No newline at end of file
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index fb2463db7..a05b0314d 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
| Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/
-/* $Id: mcrypt.c,v 1.91.2.3.2.11 2007/07/19 14:32:55 tony2001 Exp $ */
+/* $Id: mcrypt.c,v 1.91.2.3.2.12 2007/12/31 07:20:08 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h
index 46b7e92bd..428c90d00 100644
--- a/ext/mcrypt/php_mcrypt.h
+++ b/ext/mcrypt/php_mcrypt.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
| Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_mcrypt.h,v 1.26.2.1.2.2 2007/01/01 09:36:02 sebastian Exp $ */
+/* $Id: php_mcrypt.h,v 1.26.2.1.2.3 2007/12/31 07:20:08 sebastian Exp $ */
#ifndef PHP_MCRYPT_H
#define PHP_MCRYPT_H
diff --git a/ext/mhash/mhash.c b/ext/mhash/mhash.c
index f3fcd7fc6..dccf0158b 100644
--- a/ext/mhash/mhash.c
+++ b/ext/mhash/mhash.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
| Nikos Mavroyanopoulos <nmav@hellug.gr> (HMAC, KEYGEN) |
+----------------------------------------------------------------------+
*/
-/* $Id: mhash.c,v 1.48.2.3.2.5 2007/02/27 03:28:16 iliaa Exp $ */
+/* $Id: mhash.c,v 1.48.2.3.2.6 2007/12/31 07:20:08 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/mhash/php_mhash.h b/ext/mhash/php_mhash.h
index bf30d19bb..0258c9e3f 100644
--- a/ext/mhash/php_mhash.h
+++ b/ext/mhash/php_mhash.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
| Nikos Mavroyanopoulos <nmav@hellug.gr> (HMAC, KEYGEN) |
+----------------------------------------------------------------------+
*/
-/* $Id: php_mhash.h,v 1.12.2.1.2.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: php_mhash.h,v 1.12.2.1.2.2 2007/12/31 07:20:08 sebastian Exp $ */
#ifndef PHP_MHASH_H
#define PHP_MHASH_H
diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c
index 0deb6a3d1..f864f6079 100644
--- a/ext/mime_magic/mime_magic.c
+++ b/ext/mime_magic/mime_magic.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
- $Id: mime_magic.c,v 1.42.2.5.2.7 2007/06/07 08:44:41 tony2001 Exp $
+ $Id: mime_magic.c,v 1.42.2.5.2.8 2007/12/31 07:20:08 sebastian Exp $
This module contains a lot of stuff taken from Apache mod_mime_magic,
so the license section is a little bit longer than usual:
diff --git a/ext/mime_magic/php_mime_magic.h b/ext/mime_magic/php_mime_magic.h
index 4cf5e506e..43f576ee1 100644
--- a/ext/mime_magic/php_mime_magic.h
+++ b/ext/mime_magic/php_mime_magic.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: |
+----------------------------------------------------------------------+
- $Id: php_mime_magic.h,v 1.11.2.1.2.1 2007/01/01 09:36:03 sebastian Exp $
+ $Id: php_mime_magic.h,v 1.11.2.1.2.2 2007/12/31 07:20:08 sebastian Exp $
*/
#ifndef PHP_MIME_MAGIC_H
diff --git a/ext/mime_magic/phpmimemagic.h b/ext/mime_magic/phpmimemagic.h
index 6b0ec69aa..c8426722b 100644
--- a/ext/mime_magic/phpmimemagic.h
+++ b/ext/mime_magic/phpmimemagic.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: |
+----------------------------------------------------------------------+
- $Id: phpmimemagic.h,v 1.3.2.2.2.1 2007/01/01 09:36:03 sebastian Exp $
+ $Id: phpmimemagic.h,v 1.3.2.2.2.2 2007/12/31 07:20:08 sebastian Exp $
*/
#ifndef PHPMIMEMAGIC_H
diff --git a/ext/ming/ming.c b/ext/ming/ming.c
index 66b511c64..0f63216fa 100644
--- a/ext/ming/ming.c
+++ b/ext/ming/ming.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ming.c,v 1.79.2.4.2.8 2007/01/06 19:25:31 nlopess Exp $ */
+/* $Id: ming.c,v 1.79.2.4.2.9 2007/12/31 07:20:08 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/ming/php_ming.h b/ext/ming/php_ming.h
index 1a6fde889..5de1ab97a 100644
--- a/ext/ming/php_ming.h
+++ b/ext/ming/php_ming.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ming.h,v 1.17.2.1.2.3 2007/01/06 19:25:31 nlopess Exp $ */
+/* $Id: php_ming.h,v 1.17.2.1.2.4 2007/12/31 07:20:08 sebastian Exp $ */
#ifndef _PHP_MING_H
#define _PHP_MING_H
diff --git a/ext/msql/php_msql.c b/ext/msql/php_msql.c
index 47d2baf87..27440a459 100644
--- a/ext/msql/php_msql.c
+++ b/ext/msql/php_msql.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_msql.c,v 1.60.2.4.2.2 2007/02/24 02:17:25 helly Exp $ */
+/* $Id: php_msql.c,v 1.60.2.4.2.3 2007/12/31 07:20:08 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/msql/php_msql.h b/ext/msql/php_msql.h
index ecbdcd41b..4fdca4f58 100644
--- a/ext/msql/php_msql.h
+++ b/ext/msql/php_msql.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_msql.h,v 1.13.2.1.2.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: php_msql.h,v 1.13.2.1.2.2 2007/12/31 07:20:08 sebastian Exp $ */
#ifndef PHP_MSQL_H
#define PHP_MSQL_H
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index fdf670af3..549d3fd40 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mssql.c,v 1.152.2.13.2.5 2007/10/22 22:43:44 iliaa Exp $ */
+/* $Id: php_mssql.c,v 1.152.2.13.2.8 2008/03/05 23:53:23 iliaa Exp $ */
#ifdef COMPILE_DL_MSSQL
#define HAVE_MSSQL 1
diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h
index 9546062ca..049d58a03 100644
--- a/ext/mssql/php_mssql.h
+++ b/ext/mssql/php_mssql.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
*/
-/* $Id: php_mssql.h,v 1.42.2.3.2.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: php_mssql.h,v 1.42.2.3.2.2 2007/12/31 07:20:08 sebastian Exp $ */
#ifndef PHP_MSSQL_H
#define PHP_MSSQL_H
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 515f7314b..4fa30fb4b 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mysql.c,v 1.213.2.6.2.17 2007/10/08 18:25:52 andrey Exp $ */
+/* $Id: php_mysql.c,v 1.213.2.6.2.25 2008/04/16 08:54:44 tony2001 Exp $ */
/* TODO:
*
@@ -419,7 +419,7 @@ PHP_MSHUTDOWN_FUNCTION(mysql)
#ifdef PHP_WIN32
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) {
+ if ((client_ver >= 50046 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
}
#else
@@ -514,14 +514,14 @@ PHP_MINFO_FUNCTION(mysql)
static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
char *user=NULL, *passwd=NULL, *host_and_port=NULL, *socket=NULL, *tmp=NULL, *host=NULL;
+ int user_len, passwd_len, host_len;
char *hashed_details=NULL;
int hashed_details_length, port = MYSQL_PORT;
- int client_flags = 0;
+ long client_flags = 0;
php_mysql_conn *mysql=NULL;
#if MYSQL_VERSION_ID <= 32230
void (*handler) (int);
#endif
- zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL, **z_new_link=NULL, **z_client_flags=NULL;
zend_bool free_host=0, new_link=0;
long connect_timeout;
@@ -556,100 +556,37 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
hashed_details_length = spprintf(&hashed_details, 0, "mysql__%s_", user);
client_flags = CLIENT_INTERACTIVE;
} else {
- host_and_port = MySG(default_host);
- user = MySG(default_user);
- passwd = MySG(default_password);
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- break;
- case 1: {
- if (zend_get_parameters_ex(1, &z_host)==FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- }
- break;
- case 2: {
- if (zend_get_parameters_ex(2, &z_host, &z_user)==FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- user = Z_STRVAL_PP(z_user);
- }
- break;
- case 3: {
- if (zend_get_parameters_ex(3, &z_host, &z_user, &z_passwd) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- }
- break;
- case 4: {
- if (!persistent) {
- if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_new_link) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- convert_to_boolean_ex(z_new_link);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- new_link = Z_BVAL_PP(z_new_link);
- }
- else {
- if (zend_get_parameters_ex(4, &z_host, &z_user, &z_passwd, &z_client_flags) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- convert_to_long_ex(z_client_flags);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- client_flags = Z_LVAL_PP(z_client_flags);
- }
- }
- break;
- case 5: {
- if (zend_get_parameters_ex(5, &z_host, &z_user, &z_passwd, &z_new_link, &z_client_flags) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- convert_to_boolean_ex(z_new_link);
- convert_to_long_ex(z_client_flags);
- user = Z_STRVAL_PP(z_user);
- passwd = Z_STRVAL_PP(z_passwd);
- new_link = Z_BVAL_PP(z_new_link);
- client_flags = Z_LVAL_PP(z_client_flags);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ /* mysql_pconnect does not support new_link parameter */
+ if (persistent) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!l", &host_and_port, &host_len,
+ &user, &user_len, &passwd, &passwd_len,
+ &client_flags)==FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bl", &host_and_port, &host_len,
+ &user, &user_len, &passwd, &passwd_len,
+ &new_link, &client_flags)==FAILURE) {
+ return;
+ }
}
+
+ if (!host_and_port) {
+ host_and_port = MySG(default_host);
+ }
+ if (!user) {
+ user = MySG(default_user);
+ }
+ if (!passwd) {
+ passwd = MySG(default_password);
+ }
+
/* disable local infile option for open_basedir */
if (((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) && (client_flags & CLIENT_LOCAL_FILES)) {
client_flags ^= CLIENT_LOCAL_FILES;
}
- if (z_host) {
- SEPARATE_ZVAL(z_host); /* We may modify z_host if it contains a port, separate */
- convert_to_string_ex(z_host);
- host_and_port = Z_STRVAL_PP(z_host);
- if (z_user) {
- convert_to_string_ex(z_user);
- user = Z_STRVAL_PP(z_user);
- if (z_passwd) {
- convert_to_string_ex(z_passwd);
- passwd = Z_STRVAL_PP(z_passwd);
- }
- }
- }
-
- hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s_%d", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
+ hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s_%ld", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
}
/* We cannot use mysql_port anymore in windows, need to use
diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h
index 6de1d3bc6..95b5e433e 100644
--- a/ext/mysql/php_mysql.h
+++ b/ext/mysql/php_mysql.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
*/
-/* $Id: php_mysql.h,v 1.37.2.1.2.3 2007/10/08 18:25:52 andrey Exp $ */
+/* $Id: php_mysql.h,v 1.37.2.1.2.4 2007/12/31 07:20:08 sebastian Exp $ */
#ifndef PHP_MYSQL_H
#define PHP_MYSQL_H
diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h
index c0f9a0bec..d4947f640 100644
--- a/ext/mysql/php_mysql_structs.h
+++ b/ext/mysql/php_mysql_structs.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
*/
-/* $Id: php_mysql_structs.h,v 1.1.4.2 2007/10/08 18:25:52 andrey Exp $ */
+/* $Id: php_mysql_structs.h,v 1.1.4.3 2007/12/31 07:20:08 sebastian Exp $ */
#ifndef PHP_MYSQL_STRUCTS_H
#define PHP_MYSQL_STRUCTS_H
diff --git a/ext/mysql/tests/001.phpt b/ext/mysql/tests/001.phpt
index 4f79ae3ef..4f1a3cc98 100755
--- a/ext/mysql/tests/001.phpt
+++ b/ext/mysql/tests/001.phpt
@@ -14,7 +14,7 @@ $test .= ($db) ? '1' : '0';
mysql_close($db);
/*** test mysql_connect localhost:port ***/
-$db = mysql_connect("{$host}:3306", $user, $passwd, '');
+$db = mysql_connect("{$host}:3306", $user, $passwd, true);
$test .= ($db) ? '1' : '0';
mysql_close($db);
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 7a5ce3335..90d941991 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli.c,v 1.72.2.16.2.21 2007/10/22 10:35:33 andrey Exp $
+ $Id: mysqli.c,v 1.72.2.16.2.25 2008/03/08 14:59:37 andrey Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -669,7 +669,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli)
#ifdef PHP_WIN32
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) {
+ if ((client_ver >= 50046 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
}
#else
@@ -693,7 +693,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli)
*/
PHP_RINIT_FUNCTION(mysqli)
{
-#ifdef ZTS && MYSQL_VERSION_ID >= 40000
+#if defined(ZTS) && MYSQL_VERSION_ID >= 40000
if (mysql_thread_init()) {
return FAILURE;
}
@@ -709,7 +709,7 @@ PHP_RINIT_FUNCTION(mysqli)
*/
PHP_RSHUTDOWN_FUNCTION(mysqli)
{
-#ifdef ZTS && MYSQL_VERSION_ID >= 40000
+#if defined(ZTS) && MYSQL_VERSION_ID >= 40000
mysql_thread_end();
#endif
if (MyG(error_msg)) {
@@ -1194,7 +1194,9 @@ void php_local_infile_end(void *ptr)
return;
}
- php_stream_close(mysql->li_stream);
+ if (mysql->li_stream) {
+ php_stream_close(mysql->li_stream);
+ }
free(data);
return;
}
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index aa1af4f0a..57cc96a88 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_api.c,v 1.118.2.22.2.18 2007/10/17 08:19:50 tony2001 Exp $
+ $Id: mysqli_api.c,v 1.118.2.22.2.20 2008/01/01 16:51:09 hholzgra Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -1438,6 +1438,9 @@ PHP_FUNCTION(mysqli_real_connect)
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_INITIALIZED);
+
+ /* set some required options */
+ flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */
/* remove some insecure options */
flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */
if ((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) {
diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c
index 3d153b9dc..6fd4fb74a 100644
--- a/ext/mysqli/mysqli_driver.c
+++ b/ext/mysqli/mysqli_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/mysqli/mysqli_embedded.c b/ext/mysqli/mysqli_embedded.c
index 12affc87c..042fb42ec 100644
--- a/ext/mysqli/mysqli_embedded.c
+++ b/ext/mysqli/mysqli_embedded.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c
index 1fa3ecae3..e523a6322 100644
--- a/ext/mysqli/mysqli_exception.c
+++ b/ext/mysqli/mysqli_exception.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c
index e10f97e62..1eb2ec83b 100644
--- a/ext/mysqli/mysqli_fe.c
+++ b/ext/mysqli/mysqli_fe.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_fe.c,v 1.49.2.5.2.1 2007/01/01 09:36:03 sebastian Exp $
+ $Id: mysqli_fe.c,v 1.49.2.5.2.2 2007/12/31 07:20:08 sebastian Exp $
*/
#ifdef HAVE_CONFIG_H
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 2a2f41d89..3bc8fc183 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_nonapi.c,v 1.54.2.7.2.5 2007/09/06 10:07:42 andrey Exp $
+ $Id: mysqli_nonapi.c,v 1.54.2.7.2.6 2007/12/31 07:20:08 sebastian Exp $
*/
#ifdef HAVE_CONFIG_H
diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c
index 4d8bba823..9fc9047e0 100644
--- a/ext/mysqli/mysqli_prop.c
+++ b/ext/mysqli/mysqli_prop.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_prop.c,v 1.23.2.5.2.3 2007/10/16 13:00:32 andrey Exp $
+ $Id: mysqli_prop.c,v 1.23.2.5.2.4 2007/12/31 07:20:08 sebastian Exp $
*/
#ifdef HAVE_CONFIG_H
diff --git a/ext/mysqli/mysqli_repl.c b/ext/mysqli/mysqli_repl.c
index f32f1de6d..bc4e89d79 100644
--- a/ext/mysqli/mysqli_repl.c
+++ b/ext/mysqli/mysqli_repl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_repl.c,v 1.3.2.2.2.1 2007/01/01 09:36:03 sebastian Exp $
+ $Id: mysqli_repl.c,v 1.3.2.2.2.2 2007/12/31 07:20:08 sebastian Exp $
*/
#ifdef HAVE_CONFIG_H
diff --git a/ext/mysqli/mysqli_report.c b/ext/mysqli/mysqli_report.c
index 4241a3308..26a6ba267 100644
--- a/ext/mysqli/mysqli_report.c
+++ b/ext/mysqli/mysqli_report.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_report.c,v 1.11.2.2.2.2 2007/01/01 09:36:03 sebastian Exp $
+ $Id: mysqli_report.c,v 1.11.2.2.2.3 2007/12/31 07:20:08 sebastian Exp $
*/
#ifdef HAVE_CONFIG_H
diff --git a/ext/mysqli/mysqli_report.h b/ext/mysqli/mysqli_report.h
index db3b10d93..a4a9fda3d 100644
--- a/ext/mysqli/mysqli_report.h
+++ b/ext/mysqli/mysqli_report.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_report.h,v 1.5.2.1.2.1 2007/01/01 09:36:03 sebastian Exp $
+ $Id: mysqli_report.h,v 1.5.2.1.2.2 2007/12/31 07:20:08 sebastian Exp $
*/
#ifndef __HAVE_MYSQLI_PROFILER_H__
diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c
index 12a05122d..5608ef1ac 100644
--- a/ext/mysqli/mysqli_warning.c
+++ b/ext/mysqli/mysqli_warning.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h
index e16ff8314..e83113aee 100644
--- a/ext/mysqli/php_mysqli.h
+++ b/ext/mysqli/php_mysqli.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: php_mysqli.h,v 1.54.2.7.2.6 2007/09/12 09:12:56 andrey Exp $
+ $Id: php_mysqli.h,v 1.54.2.7.2.7 2007/12/31 07:20:08 sebastian Exp $
*/
/* A little hack to prevent build break, when mysql is used together with
diff --git a/ext/mysqli/tests/047.phpt b/ext/mysqli/tests/047.phpt
index 4b5df9867..cca5c3c67 100644
--- a/ext/mysqli/tests/047.phpt
+++ b/ext/mysqli/tests/047.phpt
@@ -58,9 +58,9 @@ array(2) {
["max_length"]=>
int(0)
["length"]=>
- int(11)
+ int(%d)
["charsetnr"]=>
- int(63)
+ int(%d)
["flags"]=>
int(32768)
["type"]=>
@@ -83,9 +83,9 @@ array(2) {
["max_length"]=>
int(0)
["length"]=>
- int(10)
+ int(%d)
["charsetnr"]=>
- int(8)
+ int(%d)
["flags"]=>
int(0)
["type"]=>
@@ -110,9 +110,9 @@ object(stdClass)#6 (11) {
["max_length"]=>
int(0)
["length"]=>
- int(11)
+ int(%d)
["charsetnr"]=>
- int(63)
+ int(%d)
["flags"]=>
int(32768)
["type"]=>
@@ -134,9 +134,9 @@ object(stdClass)#6 (11) {
["max_length"]=>
int(0)
["length"]=>
- int(10)
+ int(%d)
["charsetnr"]=>
- int(8)
+ int(%d)
["flags"]=>
int(0)
["type"]=>
@@ -160,9 +160,9 @@ object(stdClass)#6 (11) {
["max_length"]=>
int(0)
["length"]=>
- int(11)
+ int(%d)
["charsetnr"]=>
- int(63)
+ int(%d)
["flags"]=>
int(32768)
["type"]=>
@@ -184,13 +184,13 @@ object(stdClass)#5 (11) {
["max_length"]=>
int(0)
["length"]=>
- int(10)
+ int(%d)
["charsetnr"]=>
- int(8)
+ int(%d)
["flags"]=>
int(0)
["type"]=>
int(253)
["decimals"]=>
int(0)
-} \ No newline at end of file
+}
diff --git a/ext/mysqli/tests/bug42548.phpt b/ext/mysqli/tests/bug42548.phpt
new file mode 100644
index 000000000..541833cf9
--- /dev/null
+++ b/ext/mysqli/tests/bug42548.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Bug #42548 PROCEDURE xxx can't return a result set in the given context (works in 5.2.3!!)
+--SKIPIF--
+<?php if (!extension_loaded("mysqli")) print "skip"; ?>
+--FILE--
+<?php
+include "connect.inc";
+
+$mysqli = mysqli_init();
+$mysqli->real_connect($host, $user, $passwd, 'test');
+if (mysqli_connect_errno()) {
+ printf("Connect failed: %s\n", mysqli_connect_error());
+ exit();
+}
+
+$mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error);
+$mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or die($mysqli->error);
+
+if ($mysqli->multi_query("CALL p1();"))
+{
+ do
+ {
+ if ($objResult = $mysqli->store_result()) {
+ while ($row = $objResult->fetch_assoc()) {
+ print_r($row);
+ }
+ $objResult->close();
+ if ($mysqli->more_results()) {
+ print "----- next result -----------\n";
+ }
+ } else {
+ print "no results found";
+ }
+ } while ($mysqli->more_results() && $mysqli->next_result());
+} else {
+ print $mysqli->error;
+}
+
+$mysqli->query("DROP PROCEDURE p1") or die($mysqli->error);
+$mysqli->close();
+?>
+--EXPECT--
+Array
+(
+ [23] => 23
+)
+----- next result -----------
+Array
+(
+ [42] => 42
+)
+----- next result -----------
+no results found
diff --git a/ext/ncurses/ncurses.c b/ext/ncurses/ncurses.c
index a4e7c51b5..53fdbbcca 100644
--- a/ext/ncurses/ncurses.c
+++ b/ext/ncurses/ncurses.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/ncurses/ncurses_fe.c b/ext/ncurses/ncurses_fe.c
index 8ca6e7104..f790aa029 100644
--- a/ext/ncurses/ncurses_fe.c
+++ b/ext/ncurses/ncurses_fe.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/ncurses/ncurses_functions.c b/ext/ncurses/ncurses_functions.c
index db71779dd..cfce79a3c 100644
--- a/ext/ncurses/ncurses_functions.c
+++ b/ext/ncurses/ncurses_functions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/ncurses/php_ncurses.h b/ext/ncurses/php_ncurses.h
index 12cdd8640..0b9d94181 100644
--- a/ext/ncurses/php_ncurses.h
+++ b/ext/ncurses/php_ncurses.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/ncurses/php_ncurses_fe.h b/ext/ncurses/php_ncurses_fe.h
index 190e3d700..e12b6f8fb 100644
--- a/ext/ncurses/php_ncurses_fe.h
+++ b/ext/ncurses/php_ncurses_fe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index fda720148..37c99e880 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.55.2.3.2.11 2007/08/14 12:15:04 tony2001 Exp $
+dnl $Id: config.m4,v 1.55.2.3.2.12 2008/01/16 00:42:02 sixd Exp $
dnl
if test -z "$SED"; then
@@ -143,7 +143,9 @@ fi
PHP_OCI8_INSTANT_CLIENT="no"
-if test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
+if test "`echo $PHP_OCI8`" = "instantclient"; then
+ PHP_OCI8_INSTANT_CLIENT="yes"
+elif test "`echo $PHP_OCI8 | cut -d, -f2`" = "instantclient"; then
PHP_OCI8_INSTANT_CLIENT="`echo $PHP_OCI8 | cut -d, -f3`"
PHP_OCI8="`echo $PHP_OCI8 | cut -d, -f1,4`"
if test "$PHP_OCI8_INSTANT_CLIENT" = ""; then
@@ -345,14 +347,21 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
elif test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
+ AC_CHECK_SIZEOF(long int, 4)
+ LIBDIR_SUFFIX=""
+ if test "$ac_cv_sizeof_long_int" = "8" ; then
+ LIBDIR_SUFFIX=64
+ fi
+
AC_MSG_CHECKING([Oracle Instant Client directory])
if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then
+dnl Find the directory if user specified "instantclient" but did not give a dir.
dnl Generally the Instant Client can be anywhere so the user must pass in the
dnl directory to the libraries. But on Linux we default to the most recent
dnl version in /usr/lib
- PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client/lib 2> /dev/null | tail -1`
+ PHP_OCI8_INSTANT_CLIENT=`ls -d /usr/lib/oracle/*/client${LIBDIR_SUFFIX}/lib 2> /dev/null | tail -1`
if test -z "$PHP_OCI8_INSTANT_CLIENT"; then
- AC_MSG_ERROR([Oracle Instant Client directory not found. Try --with-oci8=instantclient,DIR])
+ AC_MSG_ERROR([Oracle Instant Client directory /usr/lib/oracle/.../client${LIBDIR_SUFFIX}/lib not found. Try --with-oci8=instantclient,DIR])
fi
fi
AC_MSG_RESULT($PHP_OCI8_INSTANT_CLIENT)
@@ -362,7 +371,7 @@ dnl version in /usr/lib
AC_MSG_CHECKING([Oracle Instant Client SDK header directory])
dnl Header directory for Instant Client SDK RPM install
- OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client/lib[/]*$!/usr/include/oracle/\1/client!'`
+ OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client\(.*\)/lib/*$!/usr/include/oracle/\1/client\2!'`
dnl Header directory for Instant Client SDK zip file install
OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 08a0629bf..8f8a2b8cd 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.38 2007/08/31 22:30:27 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.43 2008/04/10 21:53:46 sixd 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.4",
+ "1.2.5",
#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.4");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.38 $");
+ php_info_print_table_row(2, "Version", "1.2.5");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.43 $");
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -1604,6 +1604,7 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
ub4 lob_length;
int column_size;
char *lob_buffer;
+ int lob_fetch_status;
if (column->indicator == -1) { /* column is NULL */
ZVAL_NULL(value);
@@ -1634,7 +1635,11 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
if (column->data_type != SQLT_RDD && (mode & PHP_OCI_RETURN_LOBS)) {
/* PHP_OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
- if (php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC)) {
+ lob_fetch_status = php_oci_lob_read(descriptor, -1, 0, &lob_buffer, &lob_length TSRMLS_CC);
+#ifdef HAVE_OCI8_TEMP_LOB
+ php_oci_temp_lob_close(descriptor TSRMLS_CC);
+#endif
+ if (lob_fetch_status) {
ZVAL_FALSE(value);
return 1;
} else {
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 3e7b30b56..73879a674 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_collection.c,v 1.5.2.3.2.7 2007/07/31 19:21:08 tony2001 Exp $ */
+/* $Id: oci8_collection.c,v 1.5.2.3.2.9 2008/02/15 23:05:19 sixd Exp $ */
@@ -44,9 +44,9 @@
/* {{{ php_oci_collection_create()
Create and return connection handle */
-php_oci_collection * php_oci_collection_create(php_oci_connection* connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
+php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
{
- dvoid *dschp1;
+ dvoid *dschp1 = NULL;
dvoid *parmp1;
dvoid *parmp2;
php_oci_collection *collection;
@@ -219,11 +219,17 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
goto CLEANUP;
}
+ /* free the describe handle (Bug #44113) */
+ PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
return collection;
CLEANUP:
+ if (dschp1) {
+ /* free the describe handle (Bug #44113) */
+ PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
+ }
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
php_oci_collection_close(collection TSRMLS_CC);
return NULL;
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index c6a78a24f..071bfaba4 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_interface.c,v 1.8.2.7.2.13 2007/08/02 19:04:37 sixd Exp $ */
+/* $Id: oci8_interface.c,v 1.8.2.7.2.16 2008/04/02 14:56:43 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1509,11 +1509,8 @@ PHP_FUNCTION(oci_free_statement)
}
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
- if (!statement->nested) {
- /* nested cursors cannot be freed, they are allocated once and used during the fetch */
- zend_list_delete(statement->id);
- }
-
+
+ zend_list_delete(statement->id);
RETURN_TRUE;
}
/* }}} */
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 066ff0a3b..1bccf3188 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_lob.c,v 1.7.2.6.2.14 2007/07/31 19:21:08 tony2001 Exp $ */
+/* $Id: oci8_lob.c,v 1.7.2.6.2.18 2008/02/25 23:52:10 sixd Exp $ */
@@ -88,6 +88,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED; /* buffering is off by default */
descriptor->charset_form = SQLCS_IMPLICIT; /* default value */
descriptor->charset_id = connection->charset;
+ descriptor->is_open = 0;
if (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE) {
/* add Lobs & Files to hash. we'll flush them at the end */
@@ -570,16 +571,31 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
- int is_temporary;
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
+ if (descriptor->is_open) {
+ PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
+ }
if (connection->errcode != OCI_SUCCESS) {
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+
+ if (php_oci_temp_lob_close(descriptor TSRMLS_CC)) {
+ return 1;
+ }
+ return 0;
+} /* }}} */
+
+/* {{{ php_oci_temp_lob_close()
+ Close Temporary LOB */
+int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
+{
+ php_oci_connection *connection = descriptor->connection;
+ int is_temporary;
+
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
if (connection->errcode != OCI_SUCCESS) {
@@ -589,7 +605,6 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
}
if (is_temporary) {
-
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
if (connection->errcode != OCI_SUCCESS) {
@@ -647,7 +662,6 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
Close LOB descriptor and free associated resources */
void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
{
-
if (!descriptor || !descriptor->connection) {
return;
}
@@ -662,6 +676,12 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
php_oci_lob_flush(descriptor, OCI_LOB_BUFFER_FREE TSRMLS_CC);
}
+#ifdef HAVE_OCI8_TEMP_LOB
+ if (descriptor->type == OCI_DTYPE_LOB) {
+ php_oci_temp_lob_close(descriptor TSRMLS_CC);
+ }
+#endif
+
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
zend_list_delete(descriptor->connection->rsrc_id);
@@ -891,6 +911,8 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
return 1;
}
+ descriptor->is_open = 1;
+
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
} /* }}} */
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 52e0c3546..603dbe5d9 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.7.2.14.2.28 2007/08/02 19:04:37 sixd Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.33 2008/04/02 14:56:43 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
@@ -106,7 +106,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
statement->connection = connection;
statement->has_data = 0;
- statement->nested = 0;
+ statement->parent_stmtid = 0;
zend_list_addref(statement->connection->rsrc_id);
if (OCI_G(default_prefetch) > 0) {
@@ -336,6 +336,7 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
if (!nested_stmt) {
return OCI_ERROR;
}
+ nested_stmt->parent_stmtid = outcol->statement->id;
zend_list_addref(outcol->statement->id);
outcol->nested_statement = nested_stmt;
outcol->stmtid = nested_stmt->id;
@@ -368,7 +369,6 @@ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **buf
if (!descr) {
return OCI_ERROR;
}
- zend_list_addref(outcol->statement->id);
outcol->descid = descr->id;
descr->charset_form = outcol->charset_form;
@@ -776,7 +776,11 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
zend_hash_destroy(statement->defines);
efree(statement->defines);
}
-
+
+ if (statement->parent_stmtid) {
+ zend_list_delete(statement->parent_stmtid);
+ }
+
zend_list_delete(statement->connection->rsrc_id);
efree(statement);
@@ -1175,6 +1179,14 @@ sb4 php_oci_bind_out_callback(
}
if (Z_TYPE_P(val) == IS_RESOURCE) {
+ /* Processing for ref-cursor out binds */
+ if (phpbind->statement != NULL) {
+ *bufpp = phpbind->statement;
+ *alenpp = &phpbind->dummy_len;
+ *piecep = OCI_ONE_PIECE;
+ *rcodepp = &phpbind->retcode;
+ *indpp = &phpbind->indicator;
+ }
retval = OCI_CONTINUE;
} else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!phpbind->descriptor) {
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 08bd51fba..f4f332af7 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8.h,v 1.36.2.2.2.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: php_oci8.h,v 1.36.2.2.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_H
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index e849a40c3..6e9ed5e93 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.21 2007/08/06 20:32:55 sixd Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.24 2008/02/25 23:52:10 sixd Exp $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -130,6 +130,7 @@ typedef struct { /* php_oci_descriptor {{{ */
ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */
ub1 charset_form; /* charset form, required for NCLOBs */
ub2 charset_id; /* charset ID */
+ unsigned is_open:1; /* helps to determine if LOB is open or not */
} php_oci_descriptor; /* }}} */
typedef struct { /* php_oci_lob_ctx {{{ */
@@ -158,6 +159,7 @@ typedef struct { /* php_oci_define {{{ */
typedef struct { /* php_oci_statement {{{ */
int id;
+ int parent_stmtid; /* parent statement id */
php_oci_connection *connection; /* parent connection handle */
sword errcode; /* last errcode*/
OCIError *err; /* private error handle */
@@ -170,7 +172,6 @@ typedef struct { /* php_oci_statement {{{ */
int ncolumns; /* number of columns in the result */
unsigned executed:1; /* statement executed flag */
unsigned has_data:1; /* statement has more data flag */
- unsigned nested:1; /* statement handle is valid */
ub2 stmttype; /* statement type */
} php_oci_statement; /* }}} */
@@ -342,6 +343,7 @@ int php_oci_lob_get_buffering (php_oci_descriptor *);
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
#ifdef HAVE_OCI8_TEMP_LOB
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
+int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC);
int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
#endif
void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
diff --git a/ext/oci8/tests/bug27303.phpt b/ext/oci8/tests/bug27303.phpt
index 467dbfe63..6f6d01af4 100644
--- a/ext/oci8/tests/bug27303.phpt
+++ b/ext/oci8/tests/bug27303.phpt
@@ -49,7 +49,7 @@ foreach ($create_st as $statement) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
@@ -59,194 +59,194 @@ string(1) "6"
string(1) "7"
string(1) "8"
string(1) "9"
-string(2) "10"
-string(2) "11"
-string(2) "12"
-string(2) "13"
-string(2) "14"
-string(2) "15"
-string(2) "16"
-string(2) "17"
-string(2) "18"
-string(2) "19"
-string(2) "20"
-string(2) "21"
-string(2) "22"
-string(2) "23"
-string(2) "24"
-string(2) "25"
-string(2) "26"
-string(2) "27"
-string(2) "28"
-string(2) "29"
-string(2) "30"
-string(2) "31"
-string(2) "32"
-string(2) "33"
-string(2) "34"
-string(2) "35"
-string(2) "36"
-string(2) "37"
-string(2) "38"
-string(2) "39"
-string(2) "40"
-string(2) "41"
-string(2) "42"
-string(2) "43"
-string(2) "44"
-string(2) "45"
-string(2) "46"
-string(2) "47"
-string(2) "48"
-string(2) "49"
-string(2) "50"
-string(2) "51"
-string(2) "52"
-string(2) "53"
-string(2) "54"
-string(2) "55"
-string(2) "56"
-string(2) "57"
-string(2) "58"
-string(2) "59"
-string(2) "60"
-string(2) "61"
-string(2) "62"
-string(2) "63"
-string(2) "64"
-string(2) "65"
-string(2) "66"
-string(2) "67"
-string(2) "68"
-string(2) "69"
-string(2) "70"
-string(2) "71"
-string(2) "72"
-string(2) "73"
-string(2) "74"
-string(2) "75"
-string(2) "76"
-string(2) "77"
-string(2) "78"
-string(2) "79"
-string(2) "80"
-string(2) "81"
-string(2) "82"
-string(2) "83"
-string(2) "84"
-string(2) "85"
-string(2) "86"
-string(2) "87"
-string(2) "88"
-string(2) "89"
-string(2) "90"
-string(2) "91"
-string(2) "92"
-string(2) "93"
-string(2) "94"
-string(2) "95"
-string(2) "96"
-string(2) "97"
-string(2) "98"
-string(2) "99"
-string(3) "100"
-string(3) "101"
-string(3) "102"
-string(3) "103"
-string(3) "104"
-string(3) "105"
-string(3) "106"
-string(3) "107"
-string(3) "108"
-string(3) "109"
-string(3) "110"
-string(3) "111"
-string(3) "112"
-string(3) "113"
-string(3) "114"
-string(3) "115"
-string(3) "116"
-string(3) "117"
-string(3) "118"
-string(3) "119"
-string(3) "120"
-string(3) "121"
-string(3) "122"
-string(3) "123"
-string(3) "124"
-string(3) "125"
-string(3) "126"
-string(3) "127"
-string(3) "128"
-string(3) "129"
-string(3) "130"
-string(3) "131"
-string(3) "132"
-string(3) "133"
-string(3) "134"
-string(3) "135"
-string(3) "136"
-string(3) "137"
-string(3) "138"
-string(3) "139"
-string(3) "140"
-string(3) "141"
-string(3) "142"
-string(3) "143"
-string(3) "144"
-string(3) "145"
-string(3) "146"
-string(3) "147"
-string(3) "148"
-string(3) "149"
-string(3) "150"
-string(3) "151"
-string(3) "152"
-string(3) "153"
-string(3) "154"
-string(3) "155"
-string(3) "156"
-string(3) "157"
-string(3) "158"
-string(3) "159"
-string(3) "160"
-string(3) "161"
-string(3) "162"
-string(3) "163"
-string(3) "164"
-string(3) "165"
-string(3) "166"
-string(3) "167"
-string(3) "168"
-string(3) "169"
-string(3) "170"
-string(3) "171"
-string(3) "172"
-string(3) "173"
-string(3) "174"
-string(3) "175"
-string(3) "176"
-string(3) "177"
-string(3) "178"
-string(3) "179"
-string(3) "180"
-string(3) "181"
-string(3) "182"
-string(3) "183"
-string(3) "184"
-string(3) "185"
-string(3) "186"
-string(3) "187"
-string(3) "188"
-string(3) "189"
-string(3) "190"
-string(3) "191"
-string(3) "192"
-string(3) "193"
-string(3) "194"
-string(3) "195"
-string(3) "196"
-string(3) "197"
-string(3) "198"
-string(3) "199"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
Done
diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt
index 97acefa30..3ab90a1a6 100644
--- a/ext/oci8/tests/bug27303_2.phpt
+++ b/ext/oci8/tests/bug27303_2.phpt
@@ -49,7 +49,7 @@ foreach ($create_st as $statement) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
@@ -149,104 +149,104 @@ string(2) "96"
string(2) "97"
string(2) "98"
string(2) "99"
-string(3) "100"
-string(3) "101"
-string(3) "102"
-string(3) "103"
-string(3) "104"
-string(3) "105"
-string(3) "106"
-string(3) "107"
-string(3) "108"
-string(3) "109"
-string(3) "110"
-string(3) "111"
-string(3) "112"
-string(3) "113"
-string(3) "114"
-string(3) "115"
-string(3) "116"
-string(3) "117"
-string(3) "118"
-string(3) "119"
-string(3) "120"
-string(3) "121"
-string(3) "122"
-string(3) "123"
-string(3) "124"
-string(3) "125"
-string(3) "126"
-string(3) "127"
-string(3) "128"
-string(3) "129"
-string(3) "130"
-string(3) "131"
-string(3) "132"
-string(3) "133"
-string(3) "134"
-string(3) "135"
-string(3) "136"
-string(3) "137"
-string(3) "138"
-string(3) "139"
-string(3) "140"
-string(3) "141"
-string(3) "142"
-string(3) "143"
-string(3) "144"
-string(3) "145"
-string(3) "146"
-string(3) "147"
-string(3) "148"
-string(3) "149"
-string(3) "150"
-string(3) "151"
-string(3) "152"
-string(3) "153"
-string(3) "154"
-string(3) "155"
-string(3) "156"
-string(3) "157"
-string(3) "158"
-string(3) "159"
-string(3) "160"
-string(3) "161"
-string(3) "162"
-string(3) "163"
-string(3) "164"
-string(3) "165"
-string(3) "166"
-string(3) "167"
-string(3) "168"
-string(3) "169"
-string(3) "170"
-string(3) "171"
-string(3) "172"
-string(3) "173"
-string(3) "174"
-string(3) "175"
-string(3) "176"
-string(3) "177"
-string(3) "178"
-string(3) "179"
-string(3) "180"
-string(3) "181"
-string(3) "182"
-string(3) "183"
-string(3) "184"
-string(3) "185"
-string(3) "186"
-string(3) "187"
-string(3) "188"
-string(3) "189"
-string(3) "190"
-string(3) "191"
-string(3) "192"
-string(3) "193"
-string(3) "194"
-string(3) "195"
-string(3) "196"
-string(3) "197"
-string(3) "198"
-string(3) "199"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "10"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "11"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "12"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "13"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "14"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "15"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "16"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "17"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "18"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
+string(2) "19"
Done
diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt
index ed178f1a7..70d6b5688 100644
--- a/ext/oci8/tests/bug27303_4.phpt
+++ b/ext/oci8/tests/bug27303_4.phpt
@@ -49,7 +49,7 @@ foreach ($create_st as $statement) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
@@ -59,194 +59,194 @@ string(1) "6"
string(1) "7"
string(1) "8"
string(1) "9"
-string(2) "10"
-string(2) "11"
-string(2) "12"
-string(2) "13"
-string(2) "14"
-string(2) "15"
-string(2) "16"
-string(2) "17"
-string(2) "18"
-string(2) "19"
-string(2) "20"
-string(2) "21"
-string(2) "22"
-string(2) "23"
-string(2) "24"
-string(2) "25"
-string(2) "26"
-string(2) "27"
-string(2) "28"
-string(2) "29"
-string(2) "30"
-string(2) "31"
-string(2) "32"
-string(2) "33"
-string(2) "34"
-string(2) "35"
-string(2) "36"
-string(2) "37"
-string(2) "38"
-string(2) "39"
-string(2) "40"
-string(2) "41"
-string(2) "42"
-string(2) "43"
-string(2) "44"
-string(2) "45"
-string(2) "46"
-string(2) "47"
-string(2) "48"
-string(2) "49"
-string(2) "50"
-string(2) "51"
-string(2) "52"
-string(2) "53"
-string(2) "54"
-string(2) "55"
-string(2) "56"
-string(2) "57"
-string(2) "58"
-string(2) "59"
-string(2) "60"
-string(2) "61"
-string(2) "62"
-string(2) "63"
-string(2) "64"
-string(2) "65"
-string(2) "66"
-string(2) "67"
-string(2) "68"
-string(2) "69"
-string(2) "70"
-string(2) "71"
-string(2) "72"
-string(2) "73"
-string(2) "74"
-string(2) "75"
-string(2) "76"
-string(2) "77"
-string(2) "78"
-string(2) "79"
-string(2) "80"
-string(2) "81"
-string(2) "82"
-string(2) "83"
-string(2) "84"
-string(2) "85"
-string(2) "86"
-string(2) "87"
-string(2) "88"
-string(2) "89"
-string(2) "90"
-string(2) "91"
-string(2) "92"
-string(2) "93"
-string(2) "94"
-string(2) "95"
-string(2) "96"
-string(2) "97"
-string(2) "98"
-string(2) "99"
-string(3) "100"
-string(3) "101"
-string(3) "102"
-string(3) "103"
-string(3) "104"
-string(3) "105"
-string(3) "106"
-string(3) "107"
-string(3) "108"
-string(3) "109"
-string(3) "110"
-string(3) "111"
-string(3) "112"
-string(3) "113"
-string(3) "114"
-string(3) "115"
-string(3) "116"
-string(3) "117"
-string(3) "118"
-string(3) "119"
-string(3) "120"
-string(3) "121"
-string(3) "122"
-string(3) "123"
-string(3) "124"
-string(3) "125"
-string(3) "126"
-string(3) "127"
-string(3) "128"
-string(3) "129"
-string(3) "130"
-string(3) "131"
-string(3) "132"
-string(3) "133"
-string(3) "134"
-string(3) "135"
-string(3) "136"
-string(3) "137"
-string(3) "138"
-string(3) "139"
-string(3) "140"
-string(3) "141"
-string(3) "142"
-string(3) "143"
-string(3) "144"
-string(3) "145"
-string(3) "146"
-string(3) "147"
-string(3) "148"
-string(3) "149"
-string(3) "150"
-string(3) "151"
-string(3) "152"
-string(3) "153"
-string(3) "154"
-string(3) "155"
-string(3) "156"
-string(3) "157"
-string(3) "158"
-string(3) "159"
-string(3) "160"
-string(3) "161"
-string(3) "162"
-string(3) "163"
-string(3) "164"
-string(3) "165"
-string(3) "166"
-string(3) "167"
-string(3) "168"
-string(3) "169"
-string(3) "170"
-string(3) "171"
-string(3) "172"
-string(3) "173"
-string(3) "174"
-string(3) "175"
-string(3) "176"
-string(3) "177"
-string(3) "178"
-string(3) "179"
-string(3) "180"
-string(3) "181"
-string(3) "182"
-string(3) "183"
-string(3) "184"
-string(3) "185"
-string(3) "186"
-string(3) "187"
-string(3) "188"
-string(3) "189"
-string(3) "190"
-string(3) "191"
-string(3) "192"
-string(3) "193"
-string(3) "194"
-string(3) "195"
-string(3) "196"
-string(3) "197"
-string(3) "198"
-string(3) "199"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "2"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "3"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "4"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "5"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "6"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "7"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "8"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "9"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
Done
diff --git a/ext/oci8/tests/bug42496_1.phpt b/ext/oci8/tests/bug42496_1.phpt
new file mode 100644
index 000000000..4d7e2c585
--- /dev/null
+++ b/ext/oci8/tests/bug42496_1.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "DROP table bug42496_tab",
+ "CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
+ "INSERT INTO bug42496_tab VALUES('test1', 'test1')",
+ "INSERT INTO bug42496_tab VALUES('test2', 'test2')",
+ "INSERT INTO bug42496_tab VALUES('test3', 'test3')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+for ($i = 0; $i < 15000; $i++) {
+ $s = oci_parse($c, "SELECT * from bug42496_tab");
+ oci_define_by_name($s, "C1", $col1);
+ oci_define_by_name($s, "C2", $col2);
+ if (oci_execute($s)) {
+ $arr = array();
+ while ($arr = oci_fetch_assoc($s)) {
+ $arr['C1']->free();
+ $arr['C2']->free();
+ }
+ }
+ oci_free_statement($s);
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug42496_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECTF--
+Test 1
+Done
diff --git a/ext/oci8/tests/bug42496_2.phpt b/ext/oci8/tests/bug42496_2.phpt
new file mode 100644
index 000000000..e2800bbd8
--- /dev/null
+++ b/ext/oci8/tests/bug42496_2.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "DROP table bug42496_tab",
+ "CREATE table bug42496_tab(c1 CLOB, c2 CLOB)",
+ "INSERT INTO bug42496_tab VALUES('test1', 'test1')",
+ "INSERT INTO bug42496_tab VALUES('test2', 'test2')",
+ "INSERT INTO bug42496_tab VALUES('test3', 'test3')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+
+echo "Test 2\n";
+
+for ($i = 0; $i < 15000; $i++) {
+ $s = oci_parse($c, "SELECT * from bug42496_tab");
+ if (oci_execute($s)) {
+ $arr = array();
+ while ($arr = oci_fetch_assoc($s)) {
+ $arr['C1']->free();
+ $arr['C2']->free();
+ }
+ }
+ oci_free_statement($s);
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug42496_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECTF--
+Test 2
+Done
diff --git a/ext/oci8/tests/bug42841.phpt b/ext/oci8/tests/bug42841.phpt
new file mode 100644
index 000000000..921c8149d
--- /dev/null
+++ b/ext/oci8/tests/bug42841.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Bug #42841 (REF CURSOR and oci_new_cursor PHP crash)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.statement_cache_size=20
+--FILE--
+<?php
+
+require dirname(__FILE__).'/details.inc';
+
+// note a oci_new_connect() occurs lower in the script
+$c = oci_connect($user, $password, $dbase);
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
+ begin
+ open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
+ end bug42841_proc;",
+
+ "create or replace package bug43449_pkg is
+ type cursortype is ref Cursor;
+ function testcursor return cursortype;
+ end bug43449_pkg;",
+
+ "create or replace package body bug43449_pkg is
+ function testcursor return cursortype is
+ retCursor cursorType;
+ begin
+ Open retCursor For 'select * from dual';
+ return retCursor;
+ end;
+ end bug43449_pkg;"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Main code
+
+function do_bug42841($c)
+{
+ echo "First attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data1[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data1);
+
+ echo "Second attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data2[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data2);
+}
+
+function do_bug43449($c)
+{
+
+ for ($i = 0; $i < 2; $i++) {
+ var_dump(bug43449_getCur($c));
+ }
+}
+
+function bug43449_getCur($c)
+{
+ $cur = oci_new_cursor($c);
+ $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
+ oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cur, OCI_DEFAULT);
+
+ $ret = array();
+
+ while (ocifetchinto($cur, $row, OCI_ASSOC)) {
+ $ret[] = $row;
+ }
+
+ oci_free_statement($cur);
+ oci_free_statement($stmt);
+ return $ret;
+}
+
+echo "Test bug 42841: Procedure with OUT cursor parameter\n";
+do_bug42841($c);
+
+$c = oci_new_connect($user, $password, $dbase);
+
+echo "Test bug 43449: Cursor as function result\n";
+do_bug43449($c);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop procedure bug42841_proc",
+ "drop package bug43449_pkg"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test bug 42841: Procedure with OUT cursor parameter
+First attempt
+array(3) {
+ [0]=>
+ array(1) {
+ [11]=>
+ string(2) "11"
+ }
+ [1]=>
+ array(1) {
+ [11]=>
+ string(2) "12"
+ }
+ [2]=>
+ array(1) {
+ [11]=>
+ string(2) "13"
+ }
+}
+Second attempt
+array(3) {
+ [0]=>
+ array(1) {
+ [11]=>
+ string(2) "11"
+ }
+ [1]=>
+ array(1) {
+ [11]=>
+ string(2) "12"
+ }
+ [2]=>
+ array(1) {
+ [11]=>
+ string(2) "13"
+ }
+}
+Test bug 43449: Cursor as function result
+array(1) {
+ [0]=>
+ array(1) {
+ ["DUMMY"]=>
+ string(1) "X"
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ ["DUMMY"]=>
+ string(1) "X"
+ }
+}
+Done
diff --git a/ext/oci8/tests/bug43492.phpt b/ext/oci8/tests/bug43492.phpt
new file mode 100644
index 000000000..d28aabfce
--- /dev/null
+++ b/ext/oci8/tests/bug43492.phpt
@@ -0,0 +1,378 @@
+--TEST--
+Bug #43492 (Nested cursor leaks)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$stmtarray = array(
+ "DROP table bug43492_tab",
+ "CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
+ "INSERT INTO bug43492_tab VALUES ('A')",
+ "INSERT INTO bug43492_tab VALUES ('B')",
+ "INSERT INTO bug43492_tab VALUES ('C')",
+ "INSERT INTO bug43492_tab VALUES ('D')",
+ "INSERT INTO bug43492_tab VALUES ('E')",
+ "INSERT INTO bug43492_tab VALUES ('F')",
+ "INSERT INTO bug43492_tab VALUES ('G')",
+ "INSERT INTO bug43492_tab VALUES ('H')",
+ "INSERT INTO bug43492_tab VALUES ('I')",
+ "INSERT INTO bug43492_tab VALUES ('J')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+/*
+
+While fetching data from a ref cursor, the parent statement needs to
+be around. Also when the parent statement goes out of scope, it is
+not automatically released which causes a cursor leak.
+
+If either or both of the lines marked (*) are removed, then the script
+will fail with the error "ORA-01000: maximum open cursors exceeded".
+
+*/
+
+function fetch($c, $i) {
+ global $s; // (*) Allow parent statement to be available when child is used
+ $s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
+ ociexecute($s, OCI_DEFAULT);
+ ocifetchinto($s, $result, OCI_ASSOC);
+ ociexecute($result['C'], OCI_DEFAULT);
+ return $result['C'];
+}
+
+for($i = 0; $i < 300; $i++) {
+ $cur = fetch($c, $i);
+ for($j = 0; $j < 10; $j++) {
+ ocifetchinto($cur, $row, OCI_NUM);
+ echo "$row[0] ";
+ }
+ echo "\n";
+ ocifreestatement($cur);
+ ocifreestatement($s); // (*) Free the parent statement cleanly
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug43492_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECT--
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+Done
diff --git a/ext/oci8/tests/bug43492_2.phpt b/ext/oci8/tests/bug43492_2.phpt
new file mode 100644
index 000000000..fcf96e984
--- /dev/null
+++ b/ext/oci8/tests/bug43492_2.phpt
@@ -0,0 +1,369 @@
+--TEST--
+Bug #43492 (Nested cursor leaks after related bug #44206 fixed)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+// This test is similar to bug43492.phpt without the explict free.
+// Now that bug 44206 is fixed an automatic clean up will occur -
+// though it is still recommended in practice.
+
+require dirname(__FILE__).'/connect.inc';
+
+$stmtarray = array(
+ "DROP table bug43492_tab",
+ "CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
+ "INSERT INTO bug43492_tab VALUES ('A')",
+ "INSERT INTO bug43492_tab VALUES ('B')",
+ "INSERT INTO bug43492_tab VALUES ('C')",
+ "INSERT INTO bug43492_tab VALUES ('D')",
+ "INSERT INTO bug43492_tab VALUES ('E')",
+ "INSERT INTO bug43492_tab VALUES ('F')",
+ "INSERT INTO bug43492_tab VALUES ('G')",
+ "INSERT INTO bug43492_tab VALUES ('H')",
+ "INSERT INTO bug43492_tab VALUES ('I')",
+ "INSERT INTO bug43492_tab VALUES ('J')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+function fetch($c, $i) {
+ $s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
+ ociexecute($s, OCI_DEFAULT);
+ ocifetchinto($s, $result, OCI_ASSOC);
+ ociexecute($result['C'], OCI_DEFAULT);
+ return $result['C'];
+}
+
+for($i = 0; $i < 300; $i++) {
+ $cur = fetch($c, $i);
+ for($j = 0; $j < 10; $j++) {
+ ocifetchinto($cur, $row, OCI_NUM);
+ echo "$row[0] ";
+ }
+ echo "\n";
+ ocifreestatement($cur);
+}
+
+echo "Done\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "DROP table bug43492_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+--EXPECT--
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+A B C D E F G H I J
+Done
diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt
new file mode 100644
index 000000000..908fe5897
--- /dev/null
+++ b/ext/oci8/tests/bug43497.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+function sessionid($c) // determines and returns current session ID
+{
+ $query = "select sid from v\$session where audsid = userenv('sessionid')";
+
+ $stmt = oci_parse($c, $query);
+
+ if (oci_execute($stmt, OCI_DEFAULT)) {
+ $row = oci_fetch($stmt);
+ return oci_result($stmt, 1);
+ }
+
+ return null;
+}
+
+
+function templobs($c, $sid) // returns number of temporary LOBs
+{
+ $query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid;
+
+ $stmt = oci_parse($c, $query);
+
+ if (oci_execute($stmt, OCI_DEFAULT)) {
+ $row = oci_fetch($stmt);
+ $val = oci_result($stmt, 1);
+ oci_free_statement($stmt);
+ return $val;
+ }
+ return null;
+}
+
+
+// Read all XML data using explicit LOB locator
+function readxmltab_ex($c)
+{
+ $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
+
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM)) {
+ $result[0]->free(); // cleanup properly
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
+}
+
+// Read all XML data using explicit LOB locator but without freeing the temp lobs
+function readxmltab_ex_nofree($c)
+{
+ $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
+
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM)) {
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
+}
+
+// Read all XML data using implicit LOB locator
+function readxmltab_im($c)
+{
+ $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
+
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) {
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
+}
+
+function createxmltab($c) // create table w/ field of XML type
+{
+ @dropxmltab($c);
+ $stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)");
+ oci_execute($stmt);
+}
+
+function dropxmltab($c) // delete table
+{
+ $stmt = oci_parse($c, "drop table bug43497_tab");
+ oci_execute($stmt);
+}
+
+
+function fillxmltab($c)
+{
+ for ($id = 1; $id <= 100; $id++) {
+
+ // create an XML element string with random data
+ $s = "<data>";
+ for ($j = 0; $j < 128; $j++) {
+ $s .= rand();
+ }
+ $s .= "</data>\n";
+ for ($j = 0; $j < 4; $j++) {
+ $s .= $s;
+ }
+ $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
+
+ // insert XML data into database
+
+ $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
+ oci_bind_by_name($stmt, ":id", $id);
+ $clob = oci_new_descriptor($c, OCI_D_LOB);
+ oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
+ $clob->writetemporary($data);
+ oci_execute($stmt);
+
+ $clob->close();
+ $clob->free();
+ }
+}
+
+
+// Initialize
+
+createxmltab($c);
+fillxmltab($c);
+
+// Run Test
+
+$sid = sessionid($c);
+
+echo "Explicit LOB use\n";
+for ($i = 1; $i <= 10; $i++) {
+ echo "\nRun = " . $i . "\n";
+ echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
+ readxmltab_ex($c);
+}
+
+echo "\nImplicit LOB use\n";
+for ($i = 1; $i <= 10; $i++) {
+ echo "\nRun = " . $i . "\n";
+ echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
+ readxmltab_im($c);
+}
+
+echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n";
+for ($i = 1; $i <= 10; $i++) {
+ echo "\nRun = " . $i . "\n";
+ echo "Temporary LOBs = " . templobs($c, $sid) . "\n";
+ readxmltab_ex_nofree($c);
+}
+
+
+
+// Cleanup
+
+dropxmltab($c);
+
+oci_close($c);
+
+echo "Done\n";
+?>
+--EXPECT--
+Explicit LOB use
+
+Run = 1
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 0
+Loop count check = 100
+
+Implicit LOB use
+
+Run = 1
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 0
+Loop count check = 100
+
+Explicit LOB with no free (i.e. a temp lob leak)
+
+Run = 1
+Temporary LOBs = 0
+Loop count check = 100
+
+Run = 2
+Temporary LOBs = 99
+Loop count check = 100
+
+Run = 3
+Temporary LOBs = 198
+Loop count check = 100
+
+Run = 4
+Temporary LOBs = 297
+Loop count check = 100
+
+Run = 5
+Temporary LOBs = 396
+Loop count check = 100
+
+Run = 6
+Temporary LOBs = 495
+Loop count check = 100
+
+Run = 7
+Temporary LOBs = 594
+Loop count check = 100
+
+Run = 8
+Temporary LOBs = 693
+Loop count check = 100
+
+Run = 9
+Temporary LOBs = 792
+Loop count check = 100
+
+Run = 10
+Temporary LOBs = 891
+Loop count check = 100
+Done
diff --git a/ext/oci8/tests/bug44008.phpt b/ext/oci8/tests/bug44008.phpt
new file mode 100644
index 000000000..fd10b26b8
--- /dev/null
+++ b/ext/oci8/tests/bug44008.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #44008 (Incorrect usage of OCI-Lob->close doesn't crash PHP)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bug44008_proc (p in out clob)
+ as begin p := 'A';
+ end;"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+
+$s = oci_parse($c, 'begin bug44008_proc(:data); end;');
+$textLob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ":data", $textLob, -1, OCI_B_CLOB);
+oci_execute($s, OCI_DEFAULT);
+$r = $textLob->load();
+echo "$r\n";
+
+// Incorrectly closing the lob doesn't cause a crash.
+// OCI-LOB->close() is documented for use only with OCI-Lob->writeTemporary()
+$textLob->close();
+
+// Cleanup
+
+$stmtarray = array(
+ "drop procedure bug44008_proc"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+A
+Done
diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt
new file mode 100644
index 000000000..646f09b7c
--- /dev/null
+++ b/ext/oci8/tests/bug44113.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Bug #44113 (New collection creation can fail with OCI-22303)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace type bug44113_list_t as table of number"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+// Run Test
+// The test can take some time to complete and can exceed PHP's test
+// timout limit on slow networks.
+
+for ($x = 0; $x < 70000; $x++)
+{
+ if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
+ print "Failed new collection creation on $x\n";
+ break;
+ }
+}
+
+print "Completed $x\n";
+
+// Cleanup
+
+$stmtarray = array(
+ "drop type bug44113_list_t"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Completed 70000
+Done
diff --git a/ext/oci8/tests/bug44206.phpt b/ext/oci8/tests/bug44206.phpt
new file mode 100644
index 000000000..ebf31f715
--- /dev/null
+++ b/ext/oci8/tests/bug44206.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+for ($x = 0; $x < 400; $x++) {
+ $stmt = "select cursor (select $x from dual) a,
+ cursor (select $x from dual) b
+ from dual";
+ $s = oci_parse($c, $stmt);
+ $r = oci_execute($s);
+ if (!$r) {
+ echo "Exiting $x\n";
+ exit;
+ }
+ $result = oci_fetch_array($s, OCI_ASSOC);
+ oci_execute($result['A']);
+ oci_execute($result['B']);
+ oci_fetch_array($result['A'], OCI_ASSOC);
+ oci_fetch_array($result['B'], OCI_ASSOC);
+ oci_free_statement($result['A']);
+ oci_free_statement($result['B']);
+ oci_free_statement($s);
+}
+
+echo "Completed $x\n";
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Completed 400
+Done
diff --git a/ext/oci8/tests/bug6109.phpt b/ext/oci8/tests/bug6109.phpt
new file mode 100644
index 000000000..029c5dddb
--- /dev/null
+++ b/ext/oci8/tests/bug6109.phpt
@@ -0,0 +1,46 @@
+--TEST--
+PECL Bug #6109 (Error messages not kept)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+echo "Test 1\n";
+
+echo "Once Oracle has popped the message from its stack, the message is\n";
+echo "no longer available.\n";
+
+
+$s = oci_parse($c, 'delete from table_does_not_exist');
+$r = @oci_execute($s);
+
+if ($r) {
+ echo "whoops - table does exist\n";
+} else {
+ for ($i = 0; $i < 5; $i++) {
+ $err = oci_error($s);
+ echo ($i) .' -> '.$err['message'] ."\n";
+ }
+}
+
+// Cleanup
+
+oci_close($c);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+Once Oracle has popped the message from its stack, the message is
+no longer available.
+0 -> ORA-00942: %s
+1 ->
+2 ->
+3 ->
+4 ->
+Done
diff --git a/ext/oci8/tests/lob_014.phpt b/ext/oci8/tests/lob_014.phpt
index 60ed94531..1ba29ee64 100644
--- a/ext/oci8/tests/lob_014.phpt
+++ b/ext/oci8/tests/lob_014.phpt
@@ -43,9 +43,7 @@ echo "Done\n";
?>
--EXPECTF--
int(4)
-
-Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %slob_014.php on line %d
-bool(false)
+bool(true)
int(4)
bool(true)
diff --git a/ext/oci8/tests/lob_021.phpt b/ext/oci8/tests/lob_021.phpt
index 32ef6f9fe..0ae6b377a 100644
--- a/ext/oci8/tests/lob_021.phpt
+++ b/ext/oci8/tests/lob_021.phpt
@@ -20,8 +20,6 @@ $blob = oci_new_descriptor($c,OCI_D_LOB);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
-$blob;
-
var_dump($blob->write("test"));
var_dump($blob->close());
var_dump($blob->write("test"));
@@ -50,9 +48,7 @@ echo "Done\n";
?>
--EXPECTF--
int(4)
-
-Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %s on line %d
-bool(false)
+bool(true)
int(4)
bool(true)
diff --git a/ext/oci8/tests/lob_039.phpt b/ext/oci8/tests/lob_039.phpt
index 93251c8d8..5675f5a92 100644
--- a/ext/oci8/tests/lob_039.phpt
+++ b/ext/oci8/tests/lob_039.phpt
@@ -57,9 +57,9 @@ array(1) {
[0]=>
string(11) "clob test 1"
[1]=>
- string(11) "clob test 2"
+ string(22) " clob test 2"
[2]=>
- string(11) "clob test 3"
+ string(33) " clob test 3"
}
}
Done
diff --git a/ext/oci8/tests/lob_041.phpt b/ext/oci8/tests/lob_041.phpt
new file mode 100644
index 000000000..d04b43606
--- /dev/null
+++ b/ext/oci8/tests/lob_041.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Check LOBS are valid after statement free
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+ "DROP table lob_041_tab",
+ "CREATE table lob_041_tab(c1 CLOB)",
+ "INSERT INTO lob_041_tab VALUES('test data')"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+echo "Test 1 - explicit statement close\n";
+
+$s = oci_parse($c, "SELECT C1 FROM lob_041_tab");
+$desc = oci_new_descriptor($c, OCI_DTYPE_LOB);
+oci_define_by_name($s, "C1", $desc);
+oci_execute($s);
+$data = oci_fetch_assoc($s);
+oci_free_statement($s);
+echo $data['C1']->load(), "\n";
+oci_free_descriptor($desc);
+
+echo "\nTest 2 - implicit statement close\n";
+
+$s = oci_parse($c, "SELECT C1 FROM lob_041_tab");
+$desc = oci_new_descriptor($c, OCI_DTYPE_LOB);
+oci_define_by_name($s, "C1", $desc);
+oci_execute($s);
+$data = oci_fetch_assoc($s);
+$s = null;
+echo $data['C1']->load(), "\n";
+oci_free_descriptor($desc);
+var_dump($desc);
+
+echo "\nTest 3 - no preallocated descriptor\n";
+
+$s = oci_parse($c, "SELECT C1 FROM lob_041_tab");
+oci_execute($s);
+$data = oci_fetch_assoc($s);
+$s = null;
+echo $data['C1']->load(), "\n";
+var_dump($data);
+
+// Cleanup
+
+echo "Done\n";
+
+$stmtarray = array(
+ "DROP table lob_041_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ @oci_execute($s);
+}
+
+oci_close($c);
+
+?>
+
+--EXPECTF--
+Test 1 - explicit statement close
+test data
+
+Test 2 - implicit statement close
+test data
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+
+Test 3 - no preallocated descriptor
+test data
+array(1) {
+ ["C1"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+Done
diff --git a/ext/oci8/tests/lob_042.phpt b/ext/oci8/tests/lob_042.phpt
new file mode 100644
index 000000000..d79b4846e
--- /dev/null
+++ b/ext/oci8/tests/lob_042.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Check various LOB error messages
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+// test some LOB error messages
+
+require(dirname(__FILE__).'/connect.inc');
+require(dirname(__FILE__).'/create_table.inc');
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+var_dump($blob->writeTemporary("test", OCI_D_LOB));
+
+$str = "string";
+var_dump($blob->write($str));
+var_dump($blob->truncate(1));
+var_dump($blob->truncate(1));
+var_dump($blob->truncate(2));
+var_dump($blob->truncate(-1));
+var_dump($blob->read(2));
+
+var_dump($blob->import("does_not_exist"));
+var_dump($blob->saveFile("does_not_exist"));
+
+require(dirname(__FILE__).'/drop_table.inc');
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+
+Warning: OCI-Lob::writetemporary(): Invalid temporary lob type: %d in %s on line %d
+bool(false)
+int(6)
+bool(true)
+bool(true)
+
+Warning: OCI-Lob::truncate(): Size must be less than or equal to the current LOB size in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::read(): Offset must be less than size of the LOB in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::import(): Can't open file %s in %s on line %d
+bool(false)
+
+Warning: OCI-Lob::savefile(): Can't open file %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c
index 64a21f368..a7ab2753c 100644
--- a/ext/odbc/birdstep.c
+++ b/ext/odbc/birdstep.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: birdstep.c,v 1.13.2.2.2.2 2007/08/31 07:42:00 jani Exp $ */
+/* $Id: birdstep.c,v 1.13.2.2.2.3 2007/12/31 07:20:09 sebastian Exp $ */
/*
* TODO:
diff --git a/ext/odbc/php_birdstep.h b/ext/odbc/php_birdstep.h
index 9450dc19f..5fbb72ff2 100644
--- a/ext/odbc/php_birdstep.h
+++ b/ext/odbc/php_birdstep.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_birdstep.h,v 1.5.2.1.2.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: php_birdstep.h,v 1.5.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_BIRDSTEP_H
#define PHP_BIRDSTEP_H
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index c473f7cde..47fcd4514 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.c,v 1.189.2.4.2.7 2007/03/13 00:04:38 stas Exp $ */
+/* $Id: php_odbc.c,v 1.189.2.4.2.8 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
index 88926c20f..5f0b1e1aa 100644
--- a/ext/odbc/php_odbc.h
+++ b/ext/odbc/php_odbc.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.h,v 1.60.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_odbc.h,v 1.60.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_ODBC_H
#define PHP_ODBC_H
diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h
index 7c736967b..9ccbd7b76 100644
--- a/ext/odbc/php_odbc_includes.h
+++ b/ext/odbc/php_odbc_includes.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc_includes.h,v 1.12.2.1.2.4 2007/03/13 00:04:38 stas Exp $ */
+/* $Id: php_odbc_includes.h,v 1.12.2.1.2.5 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_ODBC_INCLUDES_H
#define PHP_ODBC_INCLUDES_H
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index ea50d5c41..516ff1748 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: openssl.c,v 1.98.2.5.2.42 2007/10/31 13:23:06 jani Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.45 2008/04/07 10:44:03 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1962,7 +1962,7 @@ PHP_FUNCTION(openssl_csr_sign)
X509 * cert = NULL, *new_cert = NULL;
X509_REQ * csr;
EVP_PKEY * key = NULL, *priv_key = NULL;
- long csr_resource, certresource, keyresource;
+ long csr_resource, certresource = 0, keyresource;
int i;
struct php_x509_request req;
@@ -3522,6 +3522,7 @@ PHP_FUNCTION(openssl_sign)
efree(sigbuf);
RETVAL_FALSE;
}
+ EVP_MD_CTX_cleanup(&md_ctx);
if (keyresource == -1) {
EVP_PKEY_free(pkey);
}
@@ -3561,6 +3562,7 @@ PHP_FUNCTION(openssl_verify)
EVP_VerifyInit (&md_ctx, mdtype);
EVP_VerifyUpdate (&md_ctx, data, data_len);
err = EVP_VerifyFinal (&md_ctx, (unsigned char *)signature, signature_len, pkey);
+ EVP_MD_CTX_cleanup(&md_ctx);
if (keyresource == -1) {
EVP_PKEY_free(pkey);
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index 15023b233..83a42867e 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_openssl.h,v 1.16.2.1.2.4 2007/04/04 21:24:01 pajoye Exp $ */
+/* $Id: php_openssl.h,v 1.16.2.1.2.5 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_OPENSSL_H
#define PHP_OPENSSL_H
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 940d608ad..fc29a82b6 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xp_ssl.c,v 1.22.2.3.2.9 2007/07/02 16:42:10 iliaa Exp $ */
+/* $Id: xp_ssl.c,v 1.22.2.3.2.11 2008/04/08 14:11:49 jorton Exp $ */
#include "php.h"
#include "ext/standard/file.h"
@@ -728,7 +728,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret TS
case PHP_STREAM_AS_FD_FOR_SELECT:
if (ret) {
- *ret = (void*)sslsock->s.socket;
+ *(int *)ret = sslsock->s.socket;
}
return SUCCESS;
@@ -738,7 +738,7 @@ static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret TS
return FAILURE;
}
if (ret) {
- *ret = (void*)sslsock->s.socket;
+ *(int *)ret = sslsock->s.socket;
}
return SUCCESS;
default:
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index fe0f0b4df..153502700 100755
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pcntl.c,v 1.48.2.2.2.4 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.6 2007/12/31 07:20:09 sebastian Exp $ */
#define PCNTL_DEBUG 0
@@ -225,7 +225,7 @@ PHP_FUNCTION(pcntl_fork)
id = fork();
if (id == -1) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error %d", errno);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno);
}
RETURN_LONG((long) id);
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
index 52b239ba7..c7c46bf60 100644
--- a/ext/pcntl/php_pcntl.h
+++ b/ext/pcntl/php_pcntl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcntl.h,v 1.20.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pcntl.h,v 1.20.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PCNTL_H
#define PHP_PCNTL_H
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 2b7ef6b0c..c6c5208de 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_signal.c,v 1.9.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_signal.c,v 1.9.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#include "php_signal.h"
diff --git a/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h
index 5b1881046..2a2a0556a 100644
--- a/ext/pcntl/php_signal.h
+++ b/ext/pcntl/php_signal.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_signal.h,v 1.9.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_signal.h,v 1.9.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#include <signal.h>
#ifndef PHP_SIGNAL_H
diff --git a/ext/pcre/pcrelib/AUTHORS b/ext/pcre/pcrelib/AUTHORS
index 36e4aafbd..88b993b69 100644
--- a/ext/pcre/pcrelib/AUTHORS
+++ b/ext/pcre/pcrelib/AUTHORS
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2007 University of Cambridge
+Copyright (c) 1997-2008 University of Cambridge
All rights reserved
@@ -17,7 +17,7 @@ THE C++ WRAPPER LIBRARY
Written by: Google Inc.
-Copyright (c) 2007 Google Inc
+Copyright (c) 2007-2008 Google Inc
All rights reserved
####
diff --git a/ext/pcre/pcrelib/ChangeLog b/ext/pcre/pcrelib/ChangeLog
index 3b18524fe..3ebbb4522 100644
--- a/ext/pcre/pcrelib/ChangeLog
+++ b/ext/pcre/pcrelib/ChangeLog
@@ -1,6 +1,266 @@
ChangeLog for PCRE
------------------
+Version 7.6 28-Jan-08
+---------------------
+
+1. A character class containing a very large number of characters with
+ codepoints greater than 255 (in UTF-8 mode, of course) caused a buffer
+ overflow.
+
+2. Patch to cut out the "long long" test in pcrecpp_unittest when
+ HAVE_LONG_LONG is not defined.
+
+3. Applied Christian Ehrlicher's patch to update the CMake build files to
+ bring them up to date and include new features. This patch includes:
+
+ - Fixed PH's badly added libz and libbz2 support.
+ - Fixed a problem with static linking.
+ - Added pcredemo. [But later removed - see 7 below.]
+ - Fixed dftables problem and added an option.
+ - Added a number of HAVE_XXX tests, including HAVE_WINDOWS_H and
+ HAVE_LONG_LONG.
+ - Added readline support for pcretest.
+ - Added an listing of the option settings after cmake has run.
+
+4. A user submitted a patch to Makefile that makes it easy to create
+ "pcre.dll" under mingw when using Configure/Make. I added stuff to
+ Makefile.am that cause it to include this special target, without
+ affecting anything else. Note that the same mingw target plus all
+ the other distribution libraries and programs are now supported
+ when configuring with CMake (see 6 below) instead of with
+ Configure/Make.
+
+5. Applied Craig's patch that moves no_arg into the RE class in the C++ code.
+ This is an attempt to solve the reported problem "pcrecpp::no_arg is not
+ exported in the Windows port". It has not yet been confirmed that the patch
+ solves the problem, but it does no harm.
+
+6. Applied Sheri's patch to CMakeLists.txt to add NON_STANDARD_LIB_PREFIX and
+ NON_STANDARD_LIB_SUFFIX for dll names built with mingw when configured
+ with CMake, and also correct the comment about stack recursion.
+
+7. Remove the automatic building of pcredemo from the ./configure system and
+ from CMakeLists.txt. The whole idea of pcredemo.c is that it is an example
+ of a program that users should build themselves after PCRE is installed, so
+ building it automatically is not really right. What is more, it gave
+ trouble in some build environments.
+
+8. Further tidies to CMakeLists.txt from Sheri and Christian.
+
+
+Version 7.5 10-Jan-08
+---------------------
+
+1. Applied a patch from Craig: "This patch makes it possible to 'ignore'
+ values in parens when parsing an RE using the C++ wrapper."
+
+2. Negative specials like \S did not work in character classes in UTF-8 mode.
+ Characters greater than 255 were excluded from the class instead of being
+ included.
+
+3. The same bug as (2) above applied to negated POSIX classes such as
+ [:^space:].
+
+4. PCRECPP_STATIC was referenced in pcrecpp_internal.h, but nowhere was it
+ defined or documented. It seems to have been a typo for PCRE_STATIC, so
+ I have changed it.
+
+5. The construct (?&) was not diagnosed as a syntax error (it referenced the
+ first named subpattern) and a construct such as (?&a) would reference the
+ first named subpattern whose name started with "a" (in other words, the
+ length check was missing). Both these problems are fixed. "Subpattern name
+ expected" is now given for (?&) (a zero-length name), and this patch also
+ makes it give the same error for \k'' (previously it complained that that
+ was a reference to a non-existent subpattern).
+
+6. The erroneous patterns (?+-a) and (?-+a) give different error messages;
+ this is right because (?- can be followed by option settings as well as by
+ digits. I have, however, made the messages clearer.
+
+7. Patterns such as (?(1)a|b) (a pattern that contains fewer subpatterns
+ than the number used in the conditional) now cause a compile-time error.
+ This is actually not compatible with Perl, which accepts such patterns, but
+ treats the conditional as always being FALSE (as PCRE used to), but it
+ seems to me that giving a diagnostic is better.
+
+8. Change "alphameric" to the more common word "alphanumeric" in comments
+ and messages.
+
+9. Fix two occurrences of "backslash" in comments that should have been
+ "backspace".
+
+10. Remove two redundant lines of code that can never be obeyed (their function
+ was moved elsewhere).
+
+11. The program that makes PCRE's Unicode character property table had a bug
+ which caused it to generate incorrect table entries for sequences of
+ characters that have the same character type, but are in different scripts.
+ It amalgamated them into a single range, with the script of the first of
+ them. In other words, some characters were in the wrong script. There were
+ thirteen such cases, affecting characters in the following ranges:
+
+ U+002b0 - U+002c1
+ U+0060c - U+0060d
+ U+0061e - U+00612
+ U+0064b - U+0065e
+ U+0074d - U+0076d
+ U+01800 - U+01805
+ U+01d00 - U+01d77
+ U+01d9b - U+01dbf
+ U+0200b - U+0200f
+ U+030fc - U+030fe
+ U+03260 - U+0327f
+ U+0fb46 - U+0fbb1
+ U+10450 - U+1049d
+
+12. The -o option (show only the matching part of a line) for pcregrep was not
+ compatible with GNU grep in that, if there was more than one match in a
+ line, it showed only the first of them. It now behaves in the same way as
+ GNU grep.
+
+13. If the -o and -v options were combined for pcregrep, it printed a blank
+ line for every non-matching line. GNU grep prints nothing, and pcregrep now
+ does the same. The return code can be used to tell if there were any
+ non-matching lines.
+
+14. Added --file-offsets and --line-offsets to pcregrep.
+
+15. The pattern (?=something)(?R) was not being diagnosed as a potentially
+ infinitely looping recursion. The bug was that positive lookaheads were not
+ being skipped when checking for a possible empty match (negative lookaheads
+ and both kinds of lookbehind were skipped).
+
+16. Fixed two typos in the Windows-only code in pcregrep.c, and moved the
+ inclusion of <windows.h> to before rather than after the definition of
+ INVALID_FILE_ATTRIBUTES (patch from David Byron).
+
+17. Specifying a possessive quantifier with a specific limit for a Unicode
+ character property caused pcre_compile() to compile bad code, which led at
+ runtime to PCRE_ERROR_INTERNAL (-14). Examples of patterns that caused this
+ are: /\p{Zl}{2,3}+/8 and /\p{Cc}{2}+/8. It was the possessive "+" that
+ caused the error; without that there was no problem.
+
+18. Added --enable-pcregrep-libz and --enable-pcregrep-libbz2.
+
+19. Added --enable-pcretest-libreadline.
+
+20. In pcrecpp.cc, the variable 'count' was incremented twice in
+ RE::GlobalReplace(). As a result, the number of replacements returned was
+ double what it should be. I removed one of the increments, but Craig sent a
+ later patch that removed the other one (the right fix) and added unit tests
+ that check the return values (which was not done before).
+
+21. Several CMake things:
+
+ (1) Arranged that, when cmake is used on Unix, the libraries end up with
+ the names libpcre and libpcreposix, not just pcre and pcreposix.
+
+ (2) The above change means that pcretest and pcregrep are now correctly
+ linked with the newly-built libraries, not previously installed ones.
+
+ (3) Added PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, PCRE_SUPPORT_LIBBZ2.
+
+22. In UTF-8 mode, with newline set to "any", a pattern such as .*a.*=.b.*
+ crashed when matching a string such as a\x{2029}b (note that \x{2029} is a
+ UTF-8 newline character). The key issue is that the pattern starts .*;
+ this means that the match must be either at the beginning, or after a
+ newline. The bug was in the code for advancing after a failed match and
+ checking that the new position followed a newline. It was not taking
+ account of UTF-8 characters correctly.
+
+23. PCRE was behaving differently from Perl in the way it recognized POSIX
+ character classes. PCRE was not treating the sequence [:...:] as a
+ character class unless the ... were all letters. Perl, however, seems to
+ allow any characters between [: and :], though of course it rejects as
+ unknown any "names" that contain non-letters, because all the known class
+ names consist only of letters. Thus, Perl gives an error for [[:1234:]],
+ for example, whereas PCRE did not - it did not recognize a POSIX character
+ class. This seemed a bit dangerous, so the code has been changed to be
+ closer to Perl. The behaviour is not identical to Perl, because PCRE will
+ diagnose an unknown class for, for example, [[:l\ower:]] where Perl will
+ treat it as [[:lower:]]. However, PCRE does now give "unknown" errors where
+ Perl does, and where it didn't before.
+
+24. Rewrite so as to remove the single use of %n from pcregrep because in some
+ Windows environments %n is disabled by default.
+
+
+Version 7.4 21-Sep-07
+---------------------
+
+1. Change 7.3/28 was implemented for classes by looking at the bitmap. This
+ means that a class such as [\s] counted as "explicit reference to CR or
+ LF". That isn't really right - the whole point of the change was to try to
+ help when there was an actual mention of one of the two characters. So now
+ the change happens only if \r or \n (or a literal CR or LF) character is
+ encountered.
+
+2. The 32-bit options word was also used for 6 internal flags, but the numbers
+ of both had grown to the point where there were only 3 bits left.
+ Fortunately, there was spare space in the data structure, and so I have
+ moved the internal flags into a new 16-bit field to free up more option
+ bits.
+
+3. The appearance of (?J) at the start of a pattern set the DUPNAMES option,
+ but did not set the internal JCHANGED flag - either of these is enough to
+ control the way the "get" function works - but the PCRE_INFO_JCHANGED
+ facility is supposed to tell if (?J) was ever used, so now (?J) at the
+ start sets both bits.
+
+4. Added options (at build time, compile time, exec time) to change \R from
+ matching any Unicode line ending sequence to just matching CR, LF, or CRLF.
+
+5. doc/pcresyntax.html was missing from the distribution.
+
+6. Put back the definition of PCRE_ERROR_NULLWSLIMIT, for backward
+ compatibility, even though it is no longer used.
+
+7. Added macro for snprintf to pcrecpp_unittest.cc and also for strtoll and
+ strtoull to pcrecpp.cc to select the available functions in WIN32 when the
+ windows.h file is present (where different names are used). [This was
+ reversed later after testing - see 16 below.]
+
+8. Changed all #include <config.h> to #include "config.h". There were also
+ some further <pcre.h> cases that I changed to "pcre.h".
+
+9. When pcregrep was used with the --colour option, it missed the line ending
+ sequence off the lines that it output.
+
+10. It was pointed out to me that arrays of string pointers cause lots of
+ relocations when a shared library is dynamically loaded. A technique of
+ using a single long string with a table of offsets can drastically reduce
+ these. I have refactored PCRE in four places to do this. The result is
+ dramatic:
+
+ Originally: 290
+ After changing UCP table: 187
+ After changing error message table: 43
+ After changing table of "verbs" 36
+ After changing table of Posix names 22
+
+ Thanks to the folks working on Gregex for glib for this insight.
+
+11. --disable-stack-for-recursion caused compiling to fail unless -enable-
+ unicode-properties was also set.
+
+12. Updated the tests so that they work when \R is defaulted to ANYCRLF.
+
+13. Added checks for ANY and ANYCRLF to pcrecpp.cc where it previously
+ checked only for CRLF.
+
+14. Added casts to pcretest.c to avoid compiler warnings.
+
+15. Added Craig's patch to various pcrecpp modules to avoid compiler warnings.
+
+16. Added Craig's patch to remove the WINDOWS_H tests, that were not working,
+ and instead check for _strtoi64 explicitly, and avoid the use of snprintf()
+ entirely. This removes changes made in 7 above.
+
+17. The CMake files have been updated, and there is now more information about
+ building with CMake in the NON-UNIX-USE document.
+
+
Version 7.3 28-Aug-07
---------------------
diff --git a/ext/pcre/pcrelib/LICENCE b/ext/pcre/pcrelib/LICENCE
index 4baa7d83a..03fabc6ae 100644
--- a/ext/pcre/pcrelib/LICENCE
+++ b/ext/pcre/pcrelib/LICENCE
@@ -22,7 +22,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2007 University of Cambridge
+Copyright (c) 1997-2008 University of Cambridge
All rights reserved.
@@ -31,7 +31,7 @@ THE C++ WRAPPER FUNCTIONS
Contributed by: Google Inc.
-Copyright (c) 2007, Google Inc.
+Copyright (c) 2007-2008, Google Inc.
All rights reserved.
diff --git a/ext/pcre/pcrelib/NEWS b/ext/pcre/pcrelib/NEWS
index 6a30805bb..d274541ba 100644
--- a/ext/pcre/pcrelib/NEWS
+++ b/ext/pcre/pcrelib/NEWS
@@ -1,6 +1,33 @@
News about PCRE releases
------------------------
+Release 7.6 28-Jan-08
+---------------------
+
+The main reason for having this release so soon after 7.5 is because it fixes a
+potential buffer overflow problem in pcre_compile() when run in UTF-8 mode. In
+addition, the CMake configuration files have been brought up to date.
+
+
+Release 7.5 10-Jan-08
+---------------------
+
+This is mainly a bug-fix release. However the ability to link pcregrep with
+libz or libbz2 and the ability to link pcretest with libreadline have been
+added. Also the --line-offsets and --file-offsets options were added to
+pcregrep.
+
+
+Release 7.4 21-Sep-07
+---------------------
+
+The only change of specification is the addition of options to control whether
+\R matches any Unicode line ending (the default) or just CR, LF, and CRLF.
+Otherwise, the changes are bug fixes and a refactoring to reduce the number of
+relocations needed in a shared library. There have also been some documentation
+updates, in particular, some more information about using CMake to build PCRE
+has been added to the NON-UNIX-USE file.
+
Release 7.3 28-Aug-07
---------------------
diff --git a/ext/pcre/pcrelib/NON-UNIX-USE b/ext/pcre/pcrelib/NON-UNIX-USE
index f1047baa7..e6726faaa 100644
--- a/ext/pcre/pcrelib/NON-UNIX-USE
+++ b/ext/pcre/pcrelib/NON-UNIX-USE
@@ -8,7 +8,11 @@ This document contains the following sections:
The C++ wrapper functions
Building for virtual Pascal
Stack size in Windows environments
+ Linking programs in Windows environments
Comments about Win32 builds
+ Building PCRE on Windows with CMake
+ Use of relative paths with CMake on Windows
+ Testing with runtest.bat
Building under Windows with BCC5.5
Building PCRE on OpenVMS
@@ -30,9 +34,12 @@ library consists entirely of code written in Standard C, and so should compile
successfully on any system that has a Standard C compiler and library. The C++
wrapper functions are a separate issue (see below).
-The PCRE distribution contains some experimental support for "cmake", but this
-is incomplete and not documented. However if you are a "cmake" user you might
-like to try building with "cmake".
+The PCRE distribution includes a "configure" file for use by the Configure/Make
+build system, as found in many Unix-like environments. There is also support
+support for CMake, which some users prefer, in particular in Windows
+environments. There are some instructions for CMake under Windows in the
+section entitled "Building PCRE with CMake" below. CMake can also be used to
+build PCRE in Unix-like systems.
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY
@@ -42,10 +49,13 @@ 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.
+ define the NEWLINE macro. When you compile any of the PCRE modules, you
+ must specify -DHAVE_CONFIG_H to your compiler so that config.h is included
+ in the sources.
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.
+ compiler command line to make any changes that you need to the
+ configuration options. In this case -DHAVE_CONFIG_H must not be set.
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
@@ -59,13 +69,14 @@ The following are generic comments about building the PCRE C library "by hand".
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.
+ Compile dftables.c as a stand-alone program (using -DHAVE_CONFIG_H if
+ you have set up config.h), 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.
@@ -78,11 +89,13 @@ The following are generic comments about building the PCRE C library "by hand".
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.
+ when building a debugging version of PCRE, and is also used by pcretest.
pcre_printint.src
- (6) Compile the following source files:
+ (6) Compile the following source files, setting -DHAVE_CONFIG_H as a compiler
+ option if you have set up config.h with your configuration, or else use
+ other -D settings to change the configuration as required.
pcre_chartables.c
pcre_compile.c
@@ -115,18 +128,21 @@ The following are generic comments about building the PCRE C library "by hand".
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.
+ (8) Similarly, compile pcreposix.c (remembering -DHAVE_CONFIG_H if necessary)
+ 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.
+ (9) Compile the test program pcretest.c (again, don't forget -DHAVE_CONFIG_H).
+ 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.
+ a different convention. If you are using Windows, you probably should use
+ the wintestinput3 file instead of testinput3 (and the corresponding output
+ file). This is a locale test; wintestinput3 sets the locale to "french"
+ rather than "fr_FR", and there some minor output differences.
(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).
@@ -158,19 +174,30 @@ 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.
+be too small for some pattern/subject combinations.
+PCRE has a compile configuration option to disable the use of stack for
+recursion so that heap is used instead. However, pattern matching is
+significantly slower when this is done. There is more about stack usage in the
+"pcrestack" documentation.
-COMMENTS ABOUT WIN32 BUILDS
+
+LINKING PROGRAMS IN WINDOWS ENVIRONMENTS
+
+If you want to statically link a program against a PCRE library in the form of
+a non-dll .a file, you must define PCRE_STATIC before including pcre.h,
+otherwise the pcre_malloc() and pcre_free() exported functions will be declared
+__declspec(dllimport), with unwanted results.
+
+
+COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below)
There are two ways of building PCRE using the "configure, make, make install"
paradigm on Windows systems: using MinGW or using Cygwin. These are not at all
the same thing; they are completely different from each other. There is also
-some experimental, undocumented support for building using "cmake", which you
-might like to try if you are familiar with "cmake". However, at the present
-time, the "cmake" process builds only a static library (not a dll), and the
-tests are not automatically run.
+support for building using CMake, which some users find a more straightforward
+way of building PCRE under Windows. However, the tests are not run
+automatically when CMake is used.
The MinGW home page (http://www.mingw.org/) says this:
@@ -202,10 +229,13 @@ also link with libpcre, which contains the basic functions. (Some earlier
releases of PCRE included the basic libpcre functions in libpcreposix. This no
longer happens.)
-If you want to statically link your program against a non-dll .a file, you must
-define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc() and
-pcre_free() exported functions will be declared __declspec(dllimport), with
-unwanted results.
+A user submitted a special-purpose patch that makes it easy to create
+"pcre.dll" under mingw32 using the "msys" environment. It provides "pcre.dll"
+as a special target. If you use this target, no other files are built, and in
+particular, the pcretest and pcregrep programs are not built. An example of how
+this might be used is:
+
+ ./configure --enable-utf --disable-cpp CFLAGS="-03 -s"; make pcre.dll
Using Cygwin's compiler generates libraries and executables that depend on
cygwin1.dll. If a library that is generated this way is distributed,
@@ -237,6 +267,89 @@ terminators in order to get some of the tests to work. We hope to improve
things in this area in future.
+BUILDING PCRE ON WINDOWS WITH CMAKE
+
+CMake is an alternative build facility that can be used instead of the
+traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles,
+MinGW makefiles, MSYS makefiles, NMake makefiles, UNIX makefiles, Visual Studio
+6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions
+were contributed by a PCRE user.
+
+1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure
+ that cmake\bin is on your path.
+
+2. Unzip (retaining folder structure) the PCRE source tree into a source
+ directory such as C:\pcre.
+
+3. Create a new, empty build directory: C:\pcre\build\
+
+4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys
+ for Msys/MinGW or Visual Studio Command Prompt for VC/VC++
+
+5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build
+ directories, respectively
+
+6. Hit the "Configure" button.
+
+7. Select the particular IDE / build tool that you are using (Visual Studio,
+ MSYS makefiles, MinGW makefiles, etc.)
+
+8. The GUI will then list several configuration options. This is where you can
+ enable UTF-8 support, etc.
+
+9. Hit "Configure" again. The adjacent "OK" button should now be active.
+
+10. Hit "OK".
+
+11. The build directory should now contain a usable build system, be it a
+ solution file for Visual Studio, makefiles for MinGW, etc.
+
+
+USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS
+
+A PCRE user comments as follows:
+
+I thought that others may want to know the current state of
+CMAKE_USE_RELATIVE_PATHS support on Windows.
+
+Here it is:
+-- AdditionalIncludeDirectories is only partially modified (only the
+first path - see below)
+-- Only some of the contained file paths are modified - shown below for
+pcre.vcproj
+-- It properly modifies
+
+I am sure CMake people can fix that if they want to. Until then one will
+need to replace existing absolute paths in project files with relative
+paths manually (e.g. from VS) - relative to project file location. I did
+just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big
+deal.
+
+AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;"
+AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;"
+
+RelativePath="pcre.h">
+RelativePath="pcre_chartables.c">
+RelativePath="pcre_chartables.c.rule">
+
+
+TESTING WITH RUNTEST.BAT
+
+1. Copy RunTest.bat into the directory where pcretest.exe has been created.
+
+2. Edit RunTest.bat and insert a line that indentifies the relative location of
+ the pcre source, e.g.:
+
+ set srcdir=..\pcre-7.4-RC3
+
+3. Run RunTest.bat from a command shell environment. Test outputs will
+ automatically be compared to expected results, and discrepancies will
+ identified in the console output.
+
+4. To test pcrecpp, run pcrecpp_unittest.exe, pcre_stringpiece_unittest.exe and
+ pcre_scanner_unittest.exe.
+
+
BUILDING UNDER WINDOWS WITH BCC5.5
Michael Roy sent these comments about building PCRE under Windows with BCC5.5:
@@ -315,5 +428,5 @@ $! Locale could not be set to fr
$!
=========================
-Last Updated: 01 August 2007
+Last Updated: 25 January 2008
****
diff --git a/ext/pcre/pcrelib/README b/ext/pcre/pcrelib/README
index 2f4d3c577..98d52f13a 100644
--- a/ext/pcre/pcrelib/README
+++ b/ext/pcre/pcrelib/README
@@ -103,7 +103,9 @@ Building PCRE on non-Unix systems
For a non-Unix system, please read the comments in the file NON-UNIX-USE,
though if your system supports the use of "configure" and "make" you may be
-able to build PCRE in the same way as for Unix-like systems.
+able to build PCRE in the same way as for Unix-like systems. PCRE can also be
+configured in many platform environments using the GUI facility of CMake's
+CMakeSetup. It creates Makefiles, solution files, etc.
PCRE has been compiled on many different operating systems. It should be
straightforward to build PCRE on any system that has a Standard C compiler and
@@ -117,9 +119,9 @@ If you are using HP's ANSI C++ compiler (aCC), please see the special note
in the section entitled "Using HP's ANSI C++ compiler (aCC)" below.
The following instructions assume the use of the widely used "configure, make,
-make install" process. There is also some experimental support for "cmake" in
-the PCRE distribution, but it is incomplete and not documented. However, if you
-are a "cmake" user, you might want to try it.
+make install" process. There is also support for CMake in the PCRE
+distribution; there are some comments about using CMake in the NON-UNIX-USE
+file, though it can also be used in Unix-like systems.
To build PCRE on a Unix-like system, first run the "configure" command from the
PCRE distribution directory, with your current directory set to the directory
@@ -184,6 +186,12 @@ library. You can read more about them in the pcrebuild man page.
--enable-newline-is-any, many tests should succeed, but there may be some
failures.
+. By default, the sequence \R in a pattern matches any Unicode line ending
+ sequence. This is independent of the option specifying what PCRE considers to
+ be the end of a line (see above). However, the caller of PCRE can restrict \R
+ to match only CR, LF, or CRLF. You can make this the default by adding
+ --enable-bsr-anycrlf to the "configure" command (bsr = "backslash R").
+
. When called via the POSIX interface, PCRE uses malloc() to get additional
storage for processing capturing parentheses if there are more than 10 of
them in a pattern. You can increase this threshold by setting, for example,
@@ -250,6 +258,24 @@ library. You can read more about them in the pcrebuild man page.
This automatically implies --enable-rebuild-chartables (see above).
+. It is possible to compile pcregrep to use libz and/or libbz2, in order to
+ read .gz and .bz2 files (respectively), by specifying one or both of
+
+ --enable-pcregrep-libz
+ --enable-pcregrep-libbz2
+
+ Of course, the relevant libraries must be installed on your system.
+
+. It is possible to compile pcretest so that it links with the libreadline
+ library, by specifying
+
+ --enable-pcretest-libreadline
+
+ If this is done, when pcretest's input is from a terminal, it reads it using
+ the readline() function. This provides line-editing and history facilities.
+ Note that libreadline is GPL-licenced, so if you distribute a binary of
+ pcretest linked in this way, there may be licensing issues.
+
The "configure" script builds the following files for the basic C library:
. Makefile is the makefile that builds the library
@@ -277,12 +303,12 @@ script that can be run to recreate the configuration, and config.log, which
contains compiler output from tests that "configure" runs.
Once "configure" has run, you can run "make". It builds two libraries, called
-libpcre and libpcreposix, a test program called pcretest, a demonstration
-program called pcredemo, and the pcregrep command. If a C++ compiler was found
-on your system, "make" also builds the C++ wrapper library, which is called
-libpcrecpp, and some test programs called pcrecpp_unittest,
-pcre_scanner_unittest, and pcre_stringpiece_unittest. Building the C++ wrapper
-can be disabled by adding --disable-cpp to the "configure" command.
+libpcre and libpcreposix, a test program called pcretest, and the pcregrep
+command. If a C++ compiler was found on your system, "make" also builds the C++
+wrapper library, which is called libpcrecpp, and some test programs called
+pcrecpp_unittest, pcre_scanner_unittest, and pcre_stringpiece_unittest.
+Building the C++ wrapper can be disabled by adding --disable-cpp to the
+"configure" command.
The command "make check" runs all the appropriate tests. Details of the PCRE
tests are given below in a separate section of this document.
@@ -334,9 +360,6 @@ system. The following are installed (file names are all relative to the
pcretest.txt the pcretest man page
pcregrep.txt the pcregrep man page
-Note that the pcredemo program that is built by "configure" is *not* installed
-anywhere. It is a demonstration for programmers wanting to use PCRE.
-
If you want to remove PCRE from your system, you can run "make uninstall".
This removes all the files that "make install" installed. However, it does not
remove any directories, because these are often shared with other programs.
@@ -500,7 +523,10 @@ in the comparison output, it means that locale is not available on your system,
despite being listed by "locale". This does not mean that PCRE is broken.
[If you are trying to run this test on Windows, you may be able to get it to
-work by changing "fr_FR" to "french" everywhere it occurs.]
+work by changing "fr_FR" to "french" everywhere it occurs. Alternatively, use
+RunTest.bat. The version of RunTest.bat included with PCRE 7.4 and above uses
+Windows versions of test 2. More info on using RunTest.bat is included in the
+document entitled NON-UNIX-USE.]
The fourth test checks the UTF-8 support. It is not run automatically unless
PCRE is built with UTF-8 support. To do this you must set --enable-utf8 when
@@ -714,4 +740,4 @@ The distribution should contain the following files:
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
-Last updated: 24 April 2007
+Last updated: 25 January 2008
diff --git a/ext/pcre/pcrelib/config.h b/ext/pcre/pcrelib/config.h
index b16c6b650..0b753d686 100644
--- a/ext/pcre/pcrelib/config.h
+++ b/ext/pcre/pcrelib/config.h
@@ -20,13 +20,24 @@ it to run on SunOS4 and other "close to standard" systems.
If you are going to build PCRE "by hand" on a system without "configure" you
should copy the distributed config.h.generic to config.h, and then set up the
-macros the way you need them. Alternatively, you can avoid editing by using -D
-on the compiler command line to set the macro values.
+macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
+all of your compile commands, so that config.h is included at the start of
+every source.
+
+Alternatively, you can avoid editing by using -D on the compiler command line
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.
PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
them both to 0; an emulation function will be used. */
+/* By default, the \R escape sequence matches any Unicode line ending
+ character or sequence of characters. If BSR_ANYCRLF is defined, this is
+ changed so that backslash-R matches only CR, LF, or CRLF. The build- time
+ default can be overridden by the user of PCRE at runtime. On systems that
+ support it, "configure" can be used to override the default. */
+/* #undef BSR_ANYCRLF */
+
/* If you are compiling for a system that uses EBCDIC instead of ASCII
character codes, define this macro as 1. On systems that can use
"configure", this can be done via --enable-ebcdic. */
@@ -40,6 +51,11 @@ them both to 0; an emulation function will be used. */
/* Define to 1 if you have the <bits/type_traits.h> header file. */
/* #undef HAVE_BITS_TYPE_TRAITS_H */
+/* Define to 1 if you have the <bzlib.h> header file. */
+#ifndef HAVE_BZLIB_H
+#define HAVE_BZLIB_H 1
+#endif
+
/* Define to 1 if you have the <dirent.h> header file. */
#ifndef HAVE_DIRENT_H
#define HAVE_DIRENT_H 1
@@ -75,6 +91,16 @@ them both to 0; an emulation function will be used. */
#define HAVE_MEMORY_H 1
#endif
+/* Define to 1 if you have the <readline/history.h> header file. */
+#ifndef HAVE_READLINE_HISTORY_H
+#define HAVE_READLINE_HISTORY_H 1
+#endif
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#ifndef HAVE_READLINE_READLINE_H
+#define HAVE_READLINE_READLINE_H 1
+#endif
+
/* Define to 1 if you have the <stdint.h> header file. */
#ifndef HAVE_STDINT_H
#define HAVE_STDINT_H 1
@@ -141,6 +167,14 @@ them both to 0; an emulation function will be used. */
/* Define to 1 if you have the <windows.h> header file. */
/* #undef HAVE_WINDOWS_H */
+/* Define to 1 if you have the <zlib.h> header file. */
+#ifndef HAVE_ZLIB_H
+#define HAVE_ZLIB_H 1
+#endif
+
+/* Define to 1 if you have the `_strtoi64' function. */
+/* #undef HAVE__STRTOI64 */
+
/* The value of LINK_SIZE determines the number of bytes used to store links
as offsets within the compiled regex. The default is 2, which allows for
compiled patterns up to 64K long. This covers the vast majority of cases.
@@ -189,10 +223,10 @@ them both to 0; an emulation function will be used. */
#define MAX_NAME_SIZE 32
#endif
-/* The value of NEWLINE determines the newline character sequence. On
- Unix-like systems, "configure" can be used to override the default, which
- is 10. The possible values are 10 (LF), 13 (CR), 3338 (CRLF), -1 (ANY), or
- -2 (ANYCRLF). */
+/* The value of NEWLINE determines the newline character sequence. On systems
+ that support it, "configure" can be used to override the default, which is
+ 10. The possible values are 10 (LF), 13 (CR), 3338 (CRLF), -1 (ANY), or -2
+ (ANYCRLF). */
#ifndef NEWLINE
#define NEWLINE 10
#endif
@@ -217,13 +251,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.3"
+#define PACKAGE_STRING "PCRE 7.6"
/* 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.3"
+#define PACKAGE_VERSION "7.6"
/* If you are compiling for a system other than a Unix-like system or
@@ -257,6 +291,17 @@ them both to 0; an emulation function will be used. */
#define STDC_HEADERS 1
#endif
+/* Define to allow pcregrep to be linked with libbz2, so that it is able to
+ handle .bz2 files. */
+/* #undef SUPPORT_LIBBZ2 */
+
+/* Define to allow pcretest to be linked with libreadline. */
+/* #undef SUPPORT_LIBREADLINE */
+
+/* Define to allow pcregrep to be linked with libz, so that it is able to
+ handle .gz files. */
+/* #undef SUPPORT_LIBZ */
+
/* Define to enable support for Unicode properties */
/* #undef SUPPORT_UCP */
@@ -265,7 +310,7 @@ them both to 0; an emulation function will be used. */
/* Version number of package */
#ifndef VERSION
-#define VERSION "7.3"
+#define VERSION "7.6"
#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 cf3b21052..63fc7074e 100644
--- a/ext/pcre/pcrelib/dftables.c
+++ b/ext/pcre/pcrelib/dftables.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@ 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 "config.h"
#include <ctype.h>
#include <stdio.h>
@@ -108,7 +108,7 @@ fprintf(f,
"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"
+ "#include \"config.h\"\n"
"#endif\n\n"
"#include \"pcre_internal.h\"\n\n");
fprintf(f,
diff --git a/ext/pcre/pcrelib/doc/pcre.txt b/ext/pcre/pcrelib/doc/pcre.txt
index f924f6de8..9be2c6f36 100644
--- a/ext/pcre/pcrelib/doc/pcre.txt
+++ b/ext/pcre/pcrelib/doc/pcre.txt
@@ -271,19 +271,24 @@ NAME
PCRE BUILD-TIME OPTIONS
This document describes the optional features of PCRE that can be
- selected when the library is compiled. They are all selected, or dese-
- lected, by providing options to the configure script that is run before
- the make command. The complete list of options for configure (which
- includes the standard ones such as the selection of the installation
- directory) can be obtained by running
+ selected when the library is compiled. It assumes use of the configure
+ script, where the optional features are selected or deselected by pro-
+ viding options to configure before running the make command. However,
+ the same options can be selected in both Unix-like and non-Unix-like
+ environments using the GUI facility of CMakeSetup if you are using
+ CMake instead of configure to build PCRE.
+
+ The complete list of options for configure (which includes the standard
+ ones such as the selection of the installation directory) can be
+ obtained by running
./configure --help
- The following sections include descriptions of options whose names
+ The following sections include descriptions of options whose names
begin with --enable or --disable. These settings specify changes to the
- defaults for the configure command. Because of the way that configure
- works, --enable and --disable always come in pairs, so the complemen-
- tary option always exists as well, but as it specifies the default, it
+ defaults for the configure command. Because of the way that configure
+ works, --enable and --disable always come in pairs, so the complemen-
+ tary option always exists as well, but as it specifies the default, it
is not described.
@@ -304,40 +309,40 @@ UTF-8 SUPPORT
--enable-utf8
- to the configure command. Of itself, this does not make PCRE treat
- strings as UTF-8. As well as compiling PCRE with this option, you also
- have have to set the PCRE_UTF8 option when you call the pcre_compile()
+ to the configure command. Of itself, this does not make PCRE treat
+ strings as UTF-8. As well as compiling PCRE with this option, you also
+ have have to set the PCRE_UTF8 option when you call the pcre_compile()
function.
UNICODE CHARACTER PROPERTY SUPPORT
- UTF-8 support allows PCRE to process character values greater than 255
- in the strings that it handles. On its own, however, it does not pro-
+ UTF-8 support allows PCRE to process character values greater than 255
+ in the strings that it handles. On its own, however, it does not pro-
vide any facilities for accessing the properties of such characters. If
- you want to be able to use the pattern escapes \P, \p, and \X, which
+ you want to be able to use the pattern escapes \P, \p, and \X, which
refer to Unicode character properties, you must add
--enable-unicode-properties
- to the configure command. This implies UTF-8 support, even if you have
+ to the configure command. This implies UTF-8 support, even if you have
not explicitly requested it.
- Including Unicode property support adds around 30K of tables to the
- PCRE library. Only the general category properties such as Lu and Nd
+ Including Unicode property support adds around 30K of tables to the
+ PCRE library. Only the general category properties such as Lu and Nd
are supported. Details are given in the pcrepattern documentation.
CODE VALUE OF NEWLINE
- By default, PCRE interprets character 10 (linefeed, LF) as indicating
- the end of a line. This is the normal newline character on Unix-like
+ By default, PCRE interprets character 10 (linefeed, LF) as indicating
+ the end of a line. This is the normal newline character on Unix-like
systems. You can compile PCRE to use character 13 (carriage return, CR)
instead, by adding
--enable-newline-is-cr
- to the configure command. There is also a --enable-newline-is-lf
+ to the configure command. There is also a --enable-newline-is-lf
option, which explicitly specifies linefeed as the newline character.
Alternatively, you can specify that line endings are to be indicated by
@@ -349,22 +354,35 @@ CODE VALUE OF NEWLINE
--enable-newline-is-anycrlf
- which causes PCRE to recognize any of the three sequences CR, LF, or
+ which causes PCRE to recognize any of the three sequences CR, LF, or
CRLF as indicating a line ending. Finally, a fifth option, specified by
--enable-newline-is-any
causes PCRE to recognize any Unicode newline sequence.
- Whatever line ending convention is selected when PCRE is built can be
- overridden when the library functions are called. At build time it is
+ Whatever line ending convention is selected when PCRE is built can be
+ overridden when the library functions are called. At build time it is
conventional to use the standard for your operating system.
+WHAT \R MATCHES
+
+ By default, the sequence \R in a pattern matches any Unicode newline
+ sequence, whatever has been selected as the line ending sequence. If
+ you specify
+
+ --enable-bsr-anycrlf
+
+ the default is changed so that \R matches only CR, LF, or CRLF. What-
+ ever is selected when PCRE is built can be overridden when the library
+ functions are called.
+
+
BUILDING SHARED AND STATIC LIBRARIES
- The PCRE building process uses libtool to build both shared and static
- Unix libraries by default. You can suppress one of these by adding one
+ The PCRE building process uses libtool to build both shared and static
+ Unix libraries by default. You can suppress one of these by adding one
of
--disable-shared
@@ -376,9 +394,9 @@ BUILDING SHARED AND STATIC LIBRARIES
POSIX MALLOC USAGE
When PCRE is called through the POSIX interface (see the pcreposix doc-
- umentation), additional working storage is required for holding the
- pointers to capturing substrings, because PCRE requires three integers
- per substring, whereas the POSIX interface provides only two. If the
+ umentation), additional working storage is required for holding the
+ pointers to capturing substrings, because PCRE requires three integers
+ per substring, whereas the POSIX interface provides only two. If the
number of expected substrings is small, the wrapper function uses space
on the stack, because this is faster than using malloc() for each call.
The default threshold above which the stack is no longer used is 10; it
@@ -391,114 +409,141 @@ POSIX MALLOC USAGE
HANDLING VERY LARGE PATTERNS
- Within a compiled pattern, offset values are used to point from one
- part to another (for example, from an opening parenthesis to an alter-
- nation metacharacter). By default, two-byte values are used for these
- offsets, leading to a maximum size for a compiled pattern of around
- 64K. This is sufficient to handle all but the most gigantic patterns.
- Nevertheless, some people do want to process enormous patterns, so it
- is possible to compile PCRE to use three-byte or four-byte offsets by
+ Within a compiled pattern, offset values are used to point from one
+ part to another (for example, from an opening parenthesis to an alter-
+ nation metacharacter). By default, two-byte values are used for these
+ offsets, leading to a maximum size for a compiled pattern of around
+ 64K. This is sufficient to handle all but the most gigantic patterns.
+ Nevertheless, some people do want to process enormous patterns, so it
+ is possible to compile PCRE to use three-byte or four-byte offsets by
adding a setting such as
--with-link-size=3
- to the configure command. The value given must be 2, 3, or 4. Using
- longer offsets slows down the operation of PCRE because it has to load
+ to the configure command. The value given must be 2, 3, or 4. Using
+ longer offsets slows down the operation of PCRE because it has to load
additional bytes when handling them.
AVOIDING EXCESSIVE STACK USAGE
When matching with the pcre_exec() function, PCRE implements backtrack-
- ing by making recursive calls to an internal function called match().
- In environments where the size of the stack is limited, this can se-
- verely limit PCRE's operation. (The Unix environment does not usually
+ ing by making recursive calls to an internal function called match().
+ In environments where the size of the stack is limited, this can se-
+ verely limit PCRE's operation. (The Unix environment does not usually
suffer from this problem, but it may sometimes be necessary to increase
- the maximum stack size. There is a discussion in the pcrestack docu-
- mentation.) An alternative approach to recursion that uses memory from
- the heap to remember data, instead of using recursive function calls,
- has been implemented to work round the problem of limited stack size.
+ the maximum stack size. There is a discussion in the pcrestack docu-
+ mentation.) An alternative approach to recursion that uses memory from
+ the heap to remember data, instead of using recursive function calls,
+ has been implemented to work round the problem of limited stack size.
If you want to build a version of PCRE that works this way, add
--disable-stack-for-recursion
- to the configure command. With this configuration, PCRE will use the
- pcre_stack_malloc and pcre_stack_free variables to call memory manage-
- ment functions. By default these point to malloc() and free(), but you
+ to the configure command. With this configuration, PCRE will use the
+ pcre_stack_malloc and pcre_stack_free variables to call memory manage-
+ ment functions. By default these point to malloc() and free(), but you
can replace the pointers so that your own functions are used.
- Separate functions are provided rather than using pcre_malloc and
- pcre_free because the usage is very predictable: the block sizes
- requested are always the same, and the blocks are always freed in
- reverse order. A calling program might be able to implement optimized
- functions that perform better than malloc() and free(). PCRE runs
+ Separate functions are provided rather than using pcre_malloc and
+ pcre_free because the usage is very predictable: the block sizes
+ requested are always the same, and the blocks are always freed in
+ reverse order. A calling program might be able to implement optimized
+ functions that perform better than malloc() and free(). PCRE runs
noticeably more slowly when built in this way. This option affects only
- the pcre_exec() function; it is not relevant for the the
+ the pcre_exec() function; it is not relevant for the the
pcre_dfa_exec() function.
LIMITING PCRE RESOURCE USAGE
- Internally, PCRE has a function called match(), which it calls repeat-
- edly (sometimes recursively) when matching a pattern with the
- pcre_exec() function. By controlling the maximum number of times this
- function may be called during a single matching operation, a limit can
- be placed on the resources used by a single call to pcre_exec(). The
- limit can be changed at run time, as described in the pcreapi documen-
- tation. The default is 10 million, but this can be changed by adding a
+ Internally, PCRE has a function called match(), which it calls repeat-
+ edly (sometimes recursively) when matching a pattern with the
+ pcre_exec() function. By controlling the maximum number of times this
+ function may be called during a single matching operation, a limit can
+ be placed on the resources used by a single call to pcre_exec(). The
+ limit can be changed at run time, as described in the pcreapi documen-
+ tation. The default is 10 million, but this can be changed by adding a
setting such as
--with-match-limit=500000
- to the configure command. This setting has no effect on the
+ to the configure command. This setting has no effect on the
pcre_dfa_exec() matching function.
- In some environments it is desirable to limit the depth of recursive
+ In some environments it is desirable to limit the depth of recursive
calls of match() more strictly than the total number of calls, in order
- to restrict the maximum amount of stack (or heap, if --disable-stack-
+ to restrict the maximum amount of stack (or heap, if --disable-stack-
for-recursion is specified) that is used. A second limit controls this;
- it defaults to the value that is set for --with-match-limit, which
- imposes no additional constraints. However, you can set a lower limit
+ it defaults to the value that is set for --with-match-limit, which
+ imposes no additional constraints. However, you can set a lower limit
by adding, for example,
--with-match-limit-recursion=10000
- to the configure command. This value can also be overridden at run
+ to the configure command. This value can also be overridden at run
time.
CREATING CHARACTER TABLES AT BUILD TIME
- PCRE uses fixed tables for processing characters whose code values are
- less than 256. By default, PCRE is built with a set of tables that are
- distributed in the file pcre_chartables.c.dist. These tables are for
+ PCRE uses fixed tables for processing characters whose code values are
+ less than 256. By default, PCRE is built with a set of tables that are
+ distributed in the file pcre_chartables.c.dist. These tables are for
ASCII codes only. If you add
--enable-rebuild-chartables
- to the configure command, the distributed tables are no longer used.
- Instead, a program called dftables is compiled and run. This outputs
+ to the configure command, the distributed tables are no longer used.
+ Instead, a program called dftables is compiled and run. This outputs
the source for new set of tables, created in the default locale of your
C runtime system. (This method of replacing the tables does not work if
- you are cross compiling, because dftables is run on the local host. If
- you need to create alternative tables when cross compiling, you will
+ you are cross compiling, because dftables is run on the local host. If
+ you need to create alternative tables when cross compiling, you will
have to do so "by hand".)
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).
- This is the case for most computer operating systems. PCRE can, how-
+ 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).
+ 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. You should only use it if you know that you are in an EBCDIC
+ bles. You should only use it if you know that you are in an EBCDIC
environment (for example, an IBM mainframe operating system).
+PCREGREP OPTIONS FOR COMPRESSED FILE SUPPORT
+
+ By default, pcregrep reads all files as plain text. You can build it so
+ that it recognizes files whose names end in .gz or .bz2, and reads them
+ with libz or libbz2, respectively, by adding one or both of
+
+ --enable-pcregrep-libz
+ --enable-pcregrep-libbz2
+
+ to the configure command. These options naturally require that the rel-
+ evant libraries are installed on your system. Configuration will fail
+ if they are not.
+
+
+PCRETEST OPTION FOR LIBREADLINE SUPPORT
+
+ If you add
+
+ --enable-pcretest-libreadline
+
+ to the configure command, pcretest is linked with the libreadline
+ library, and when its input is from a terminal, it reads it using the
+ readline() function. This provides line-editing and history facilities.
+ Note that libreadline is GPL-licenced, so if you distribute a binary of
+ pcretest linked in this way, there may be licensing issues.
+
+
SEE ALSO
pcreapi(3), pcre_config(3).
@@ -513,7 +558,7 @@ AUTHOR
REVISION
- Last updated: 30 July 2007
+ Last updated: 18 December 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -824,7 +869,7 @@ PCRE API OVERVIEW
a Perl-compatible manner. A sample program that demonstrates the sim-
plest way of using them is provided in the file called pcredemo.c in
the source distribution. The pcresample documentation describes how to
- run it.
+ compile and run it.
A second matching function, pcre_dfa_exec(), which is not Perl-compati-
ble, is also provided. This uses a different algorithm for the match-
@@ -919,18 +964,21 @@ NEWLINES
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. 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.
+ section on pcre_exec() options below.
+
+ The choice of newline convention does not affect the interpretation of
+ the \n or \r escape sequences, nor does it affect what \R matches,
+ which is controlled in a similar way, but by separate options.
MULTITHREADING
- The PCRE functions can be used in multi-threading applications, with
+ The PCRE functions can be used in multi-threading applications, with
the proviso that the memory management functions pointed to by
pcre_malloc, pcre_free, pcre_stack_malloc, and pcre_stack_free, and the
callout function pointed to by pcre_callout, are shared by all threads.
- The compiled form of a regular expression is not altered during match-
+ The compiled form of a regular expression is not altered during match-
ing, so the same compiled pattern can safely be used by several threads
at once.
@@ -938,10 +986,10 @@ MULTITHREADING
SAVING PRECOMPILED PATTERNS FOR LATER USE
The compiled form of a regular expression can be saved and re-used at a
- later time, possibly by a different program, and even on a host other
- than the one on which it was compiled. Details are given in the
- pcreprecompile documentation. However, compiling a regular expression
- with one version of PCRE for use with a different version is not guar-
+ later time, possibly by a different program, and even on a host other
+ than the one on which it was compiled. Details are given in the
+ pcreprecompile documentation. However, compiling a regular expression
+ with one version of PCRE for use with a different version is not guar-
anteed to work and may cause crashes.
@@ -949,69 +997,77 @@ CHECKING BUILD-TIME OPTIONS
int pcre_config(int what, void *where);
- The function pcre_config() makes it possible for a PCRE client to dis-
+ The function pcre_config() makes it possible for a PCRE client to dis-
cover which optional features have been compiled into the PCRE library.
- The pcrebuild documentation has more details about these optional fea-
+ The pcrebuild documentation has more details about these optional fea-
tures.
- The first argument for pcre_config() is an integer, specifying which
+ The first argument for pcre_config() is an integer, specifying which
information is required; the second argument is a pointer to a variable
- into which the information is placed. The following information is
+ into which the information is placed. The following information is
available:
PCRE_CONFIG_UTF8
- The output is an integer that is set to one if UTF-8 support is avail-
+ The output is an integer that is set to one if UTF-8 support is avail-
able; otherwise it is set to zero.
PCRE_CONFIG_UNICODE_PROPERTIES
- The output is an integer that is set to one if support for Unicode
+ The output is an integer that is set to one if support for Unicode
character properties is available; otherwise it is set to zero.
PCRE_CONFIG_NEWLINE
- The output is an integer whose value specifies the default character
- sequence that is recognized as meaning "newline". The four values that
+ The output is an integer whose value specifies the default character
+ sequence that is recognized as meaning "newline". The four values that
are supported are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for ANYCRLF,
- and -1 for ANY. The default should normally be the standard sequence
+ and -1 for ANY. The default should normally be the standard sequence
for your operating system.
+ PCRE_CONFIG_BSR
+
+ The output is an integer whose value indicates what character sequences
+ the \R escape sequence matches by default. A value of 0 means that \R
+ matches any Unicode line ending sequence; a value of 1 means that \R
+ matches only CR, LF, or CRLF. The default can be overridden when a pat-
+ tern is compiled or matched.
+
PCRE_CONFIG_LINK_SIZE
- The output is an integer that contains the number of bytes used for
+ The output is an integer that contains the number of bytes used for
internal linkage in compiled regular expressions. The value is 2, 3, or
- 4. Larger values allow larger regular expressions to be compiled, at
- the expense of slower matching. The default value of 2 is sufficient
- for all but the most massive patterns, since it allows the compiled
+ 4. Larger values allow larger regular expressions to be compiled, at
+ the expense of slower matching. The default value of 2 is sufficient
+ for all but the most massive patterns, since it allows the compiled
pattern to be up to 64K in size.
PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
- The output is an integer that contains the threshold above which the
- POSIX interface uses malloc() for output vectors. Further details are
+ The output is an integer that contains the threshold above which the
+ POSIX interface uses malloc() for output vectors. Further details are
given in the pcreposix documentation.
PCRE_CONFIG_MATCH_LIMIT
The output is an integer that gives the default limit for the number of
- internal matching function calls in a pcre_exec() execution. Further
+ internal matching function calls in a pcre_exec() execution. Further
details are given with pcre_exec() below.
PCRE_CONFIG_MATCH_LIMIT_RECURSION
- The output is an integer that gives the default limit for the depth of
- recursion when calling the internal matching function in a pcre_exec()
+ The output is an integer that gives the default limit for the depth of
+ recursion when calling the internal matching function in a pcre_exec()
execution. Further details are given with pcre_exec() below.
PCRE_CONFIG_STACKRECURSE
- The output is an integer that is set to one if internal recursion when
+ The output is an integer that is set to one if internal recursion when
running pcre_exec() is implemented by recursive function calls that use
- the stack to remember their state. This is the usual way that PCRE is
+ the stack to remember their state. This is the usual way that PCRE is
compiled. The output is zero if PCRE was compiled to use blocks of data
- on the heap instead of recursive function calls. In this case,
- pcre_stack_malloc and pcre_stack_free are called to manage memory
+ on the heap instead of recursive function calls. In this case,
+ pcre_stack_malloc and pcre_stack_free are called to manage memory
blocks on the heap, thus avoiding the use of the stack.
@@ -1028,55 +1084,55 @@ COMPILING A PATTERN
Either of the functions pcre_compile() or pcre_compile2() can be called
to compile a pattern into an internal form. The only difference between
- the two interfaces is that pcre_compile2() has an additional argument,
+ the two interfaces is that pcre_compile2() has an additional argument,
errorcodeptr, via which a numerical error code can be returned.
The pattern is a C string terminated by a binary zero, and is passed in
- the pattern argument. A pointer to a single block of memory that is
- obtained via pcre_malloc is returned. This contains the compiled code
+ the pattern argument. A pointer to a single block of memory that is
+ obtained via pcre_malloc is returned. This contains the compiled code
and related data. The pcre type is defined for the returned block; this
is a typedef for a structure whose contents are not externally defined.
It is up to the caller to free the memory (via pcre_free) when it is no
longer required.
- Although the compiled code of a PCRE regex is relocatable, that is, it
+ Although the compiled code of a PCRE regex is relocatable, that is, it
does not depend on memory location, the complete pcre data block is not
- fully relocatable, because it may contain a copy of the tableptr argu-
+ fully relocatable, because it may contain a copy of the tableptr argu-
ment, which is an address (see below).
The options argument contains various bit settings that affect the com-
- pilation. It should be zero if no options are required. The available
- options are described below. Some of them, in particular, those that
- are compatible with Perl, can also be set and unset from within the
- pattern (see the detailed description in the pcrepattern documenta-
- tion). For these options, the contents of the options argument speci-
- fies their initial settings at the start of compilation and execution.
- The PCRE_ANCHORED and PCRE_NEWLINE_xxx options can be set at the time
+ pilation. It should be zero if no options are required. The available
+ options are described below. Some of them, in particular, those that
+ are compatible with Perl, can also be set and unset from within the
+ pattern (see the detailed description in the pcrepattern documenta-
+ tion). For these options, the contents of the options argument speci-
+ fies their initial settings at the start of compilation and execution.
+ The PCRE_ANCHORED and PCRE_NEWLINE_xxx options can be set at the time
of matching as well as at compile time.
If errptr is NULL, pcre_compile() returns NULL immediately. Otherwise,
- if compilation of a pattern fails, pcre_compile() returns NULL, and
+ if compilation of a pattern fails, pcre_compile() returns NULL, and
sets the variable pointed to by errptr to point to a textual error mes-
sage. This is a static string that is part of the library. You must not
try to free it. The offset from the start of the pattern to the charac-
ter where the error was discovered is placed in the variable pointed to
- by erroffset, which must not be NULL. If it is, an immediate error is
+ by erroffset, which must not be NULL. If it is, an immediate error is
given.
- If pcre_compile2() is used instead of pcre_compile(), and the error-
- codeptr argument is not NULL, a non-zero error code number is returned
- via this argument in the event of an error. This is in addition to the
+ If pcre_compile2() is used instead of pcre_compile(), and the error-
+ codeptr argument is not NULL, a non-zero error code number is returned
+ via this argument in the event of an error. This is in addition to the
textual error message. Error codes and messages are listed below.
- If the final argument, tableptr, is NULL, PCRE uses a default set of
- character tables that are built when PCRE is compiled, using the
- default C locale. Otherwise, tableptr must be an address that is the
- result of a call to pcre_maketables(). This value is stored with the
- compiled pattern, and used again by pcre_exec(), unless another table
+ If the final argument, tableptr, is NULL, PCRE uses a default set of
+ character tables that are built when PCRE is compiled, using the
+ default C locale. Otherwise, tableptr must be an address that is the
+ result of a call to pcre_maketables(). This value is stored with the
+ compiled pattern, and used again by pcre_exec(), unless another table
pointer is passed to it. For more discussion, see the section on locale
support below.
- This code fragment shows a typical straightforward call to pcre_com-
+ This code fragment shows a typical straightforward call to pcre_com-
pile():
pcre *re;
@@ -1089,111 +1145,120 @@ COMPILING A PATTERN
&erroffset, /* for error offset */
NULL); /* use default character tables */
- The following names for option bits are defined in the pcre.h header
+ The following names for option bits are defined in the pcre.h header
file:
PCRE_ANCHORED
If this bit is set, the pattern is forced to be "anchored", that is, it
- is constrained to match only at the first matching point in the string
- that is being searched (the "subject string"). This effect can also be
- achieved by appropriate constructs in the pattern itself, which is the
+ is constrained to match only at the first matching point in the string
+ that is being searched (the "subject string"). This effect can also be
+ achieved by appropriate constructs in the pattern itself, which is the
only way to do it in Perl.
PCRE_AUTO_CALLOUT
If this bit is set, pcre_compile() automatically inserts callout items,
- all with number 255, before each pattern item. For discussion of the
+ all with number 255, before each pattern item. For discussion of the
callout facility, see the pcrecallout documentation.
+ PCRE_BSR_ANYCRLF
+ PCRE_BSR_UNICODE
+
+ These options (which are mutually exclusive) control what the \R escape
+ sequence matches. The choice is either to match only CR, LF, or CRLF,
+ or to match any Unicode newline sequence. The default is specified when
+ PCRE is built. It can be overridden from within the pattern, or by set-
+ ting an option when a compiled pattern is matched.
+
PCRE_CASELESS
- If this bit is set, letters in the pattern match both upper and lower
- case letters. It is equivalent to Perl's /i option, and it can be
- changed within a pattern by a (?i) option setting. 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 values, the concept of case is supported if PCRE is com-
- piled 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
+ If this bit is set, letters in the pattern match both upper and lower
+ case letters. It is equivalent to Perl's /i option, and it can be
+ changed within a pattern by a (?i) option setting. 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 values, the concept of case is supported if PCRE is com-
+ piled 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.
PCRE_DOLLAR_ENDONLY
- If this bit is set, a dollar metacharacter in the pattern matches only
- at the end of the subject string. Without this option, a dollar also
- matches immediately before a newline at the end of the string (but not
- before any other newlines). The PCRE_DOLLAR_ENDONLY option is ignored
- if PCRE_MULTILINE is set. There is no equivalent to this option in
+ If this bit is set, a dollar metacharacter in the pattern matches only
+ at the end of the subject string. Without this option, a dollar also
+ matches immediately before a newline at the end of the string (but not
+ before any other newlines). The PCRE_DOLLAR_ENDONLY option is ignored
+ if PCRE_MULTILINE is set. There is no equivalent to this option in
Perl, and no way to set it within a pattern.
PCRE_DOTALL
If this bit is set, a dot metacharater in the pattern matches all char-
- acters, including those that indicate newline. Without it, a dot does
- not match when the current position is at a newline. This option is
- equivalent to Perl's /s option, and it can be changed within a pattern
- by a (?s) option setting. A negative class such as [^a] always matches
+ acters, including those that indicate newline. Without it, a dot does
+ not match when the current position is at a newline. This option is
+ equivalent to Perl's /s option, and it can be changed within a pattern
+ by a (?s) option setting. A negative class such as [^a] always matches
newline characters, independent of the setting of this option.
PCRE_DUPNAMES
- If this bit is set, names used to identify capturing subpatterns need
+ If this bit is set, names used to identify capturing subpatterns need
not be unique. This can be helpful for certain types of pattern when it
- is known that only one instance of the named subpattern can ever be
- matched. There are more details of named subpatterns below; see also
+ is known that only one instance of the named subpattern can ever be
+ matched. There are more details of named subpatterns below; see also
the pcrepattern documentation.
PCRE_EXTENDED
- If this bit is set, whitespace data characters in the pattern are
+ If this bit is set, whitespace data characters in the pattern are
totally ignored except when escaped or inside a character class. White-
space does not include the VT character (code 11). In addition, charac-
ters between an unescaped # outside a character class and the next new-
- line, inclusive, are also ignored. This is equivalent to Perl's /x
- option, and it can be changed within a pattern by a (?x) option set-
+ line, inclusive, are also ignored. This is equivalent to Perl's /x
+ option, and it can be changed within a pattern by a (?x) option set-
ting.
- This option makes it possible to include comments inside complicated
- patterns. Note, however, that this applies only to data characters.
- Whitespace characters may never appear within special character
- sequences in a pattern, for example within the sequence (?( which
+ This option makes it possible to include comments inside complicated
+ patterns. Note, however, that this applies only to data characters.
+ Whitespace characters may never appear within special character
+ sequences in a pattern, for example within the sequence (?( which
introduces a conditional subpattern.
PCRE_EXTRA
- This option was invented in order to turn on additional functionality
- of PCRE that is incompatible with Perl, but it is currently of very
- little use. When set, any backslash in a pattern that is followed by a
- letter that has no special meaning causes an error, thus reserving
- these combinations for future expansion. By default, as in Perl, a
- backslash followed by a letter with no special meaning is treated as a
- literal. (Perl can, however, be persuaded to give a warning for this.)
- There are at present no other features controlled by this option. It
+ This option was invented in order to turn on additional functionality
+ of PCRE that is incompatible with Perl, but it is currently of very
+ little use. When set, any backslash in a pattern that is followed by a
+ letter that has no special meaning causes an error, thus reserving
+ these combinations for future expansion. By default, as in Perl, a
+ backslash followed by a letter with no special meaning is treated as a
+ literal. (Perl can, however, be persuaded to give a warning for this.)
+ There are at present no other features controlled by this option. It
can also be set by a (?X) option setting within a pattern.
PCRE_FIRSTLINE
- If this option is set, an unanchored pattern is required to match
- before or at the first newline in the subject string, though the
+ If this option is set, an unanchored pattern is required to match
+ before or at the first newline in the subject string, though the
matched text may continue over the newline.
PCRE_MULTILINE
- By default, PCRE treats the subject string as consisting of a single
- line of characters (even if it actually contains newlines). The "start
- of line" metacharacter (^) matches only at the start of the string,
- while the "end of line" metacharacter ($) matches only at the end of
+ By default, PCRE treats the subject string as consisting of a single
+ line of characters (even if it actually contains newlines). The "start
+ of line" metacharacter (^) matches only at the start of the string,
+ while the "end of line" metacharacter ($) matches only at the end of
the string, or before a terminating newline (unless PCRE_DOLLAR_ENDONLY
is set). This is the same as Perl.
- When PCRE_MULTILINE it is set, the "start of line" and "end of line"
- constructs match immediately following or immediately before internal
- newlines in the subject string, respectively, as well as at the very
- start and end. This is equivalent to Perl's /m option, and it can be
+ When PCRE_MULTILINE it is set, the "start of line" and "end of line"
+ constructs match immediately following or immediately before internal
+ newlines in the subject string, respectively, as well as at the very
+ start and end. This is equivalent to Perl's /m option, and it can be
changed within a pattern by a (?m) option setting. If there are no new-
- lines in a subject string, or no occurrences of ^ or $ in a pattern,
+ lines in a subject string, or no occurrences of ^ or $ in a pattern,
setting PCRE_MULTILINE has no effect.
PCRE_NEWLINE_CR
@@ -1202,81 +1267,81 @@ COMPILING A PATTERN
PCRE_NEWLINE_ANYCRLF
PCRE_NEWLINE_ANY
- These options override the default newline definition that was chosen
- when PCRE was built. Setting the first or the second specifies that a
- newline is indicated by a single character (CR or LF, respectively).
- Setting PCRE_NEWLINE_CRLF specifies that a newline is indicated by the
- two-character CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies
+ These options override the default newline definition that was chosen
+ when PCRE was built. Setting the first or the second specifies that a
+ newline is indicated by a single character (CR or LF, respectively).
+ Setting PCRE_NEWLINE_CRLF specifies that a newline is indicated by the
+ two-character CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies
that any of the three preceding sequences should be recognized. Setting
- PCRE_NEWLINE_ANY specifies that any Unicode newline sequence should be
+ PCRE_NEWLINE_ANY specifies that any Unicode newline sequence should be
recognized. The Unicode newline sequences are the three just mentioned,
- plus the single characters VT (vertical tab, U+000B), FF (formfeed,
- U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
- (paragraph separator, U+2029). The last two are recognized only in
+ plus the single characters VT (vertical tab, U+000B), FF (formfeed,
+ U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS
+ (paragraph separator, U+2029). The last two are recognized only in
UTF-8 mode.
- The newline setting in the options word uses three bits that are
+ The newline setting in the options word uses three bits that are
treated as a number, giving eight possibilities. Currently only six are
- used (default plus the five values above). This means that if you set
- more than one newline option, the combination may or may not be sensi-
+ used (default plus the five values above). This means that if you set
+ more than one newline option, the combination may or may not be sensi-
ble. For example, PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to
- PCRE_NEWLINE_CRLF, but other combinations may yield unused numbers and
+ PCRE_NEWLINE_CRLF, but other combinations may yield unused numbers and
cause an error.
- The only time that a line break is specially recognized when compiling
- a pattern is if PCRE_EXTENDED is set, and an unescaped # outside a
- character class is encountered. This indicates a comment that lasts
- until after the next line break sequence. In other circumstances, line
- break sequences are treated as literal data, except that in
+ The only time that a line break is specially recognized when compiling
+ a pattern is if PCRE_EXTENDED is set, and an unescaped # outside a
+ character class is encountered. This indicates a comment that lasts
+ until after the next line break sequence. In other circumstances, line
+ break sequences are treated as literal data, except that in
PCRE_EXTENDED mode, both CR and LF are treated as whitespace characters
and are therefore ignored.
The newline option that is set at compile time becomes the default that
- is used for pcre_exec() and pcre_dfa_exec(), but it can be overridden.
+ is used for pcre_exec() and pcre_dfa_exec(), but it can be overridden.
PCRE_NO_AUTO_CAPTURE
If this option is set, it disables the use of numbered capturing paren-
- theses in the pattern. Any opening parenthesis that is not followed by
- ? behaves as if it were followed by ?: but named parentheses can still
- be used for capturing (and they acquire numbers in the usual way).
+ theses in the pattern. Any opening parenthesis that is not followed by
+ ? behaves as if it were followed by ?: but named parentheses can still
+ be used for capturing (and they acquire numbers in the usual way).
There is no equivalent of this option in Perl.
PCRE_UNGREEDY
- This option inverts the "greediness" of the quantifiers so that they
- are not greedy by default, but become greedy if followed by "?". It is
- not compatible with Perl. It can also be set by a (?U) option setting
+ This option inverts the "greediness" of the quantifiers so that they
+ are not greedy by default, but become greedy if followed by "?". It is
+ not compatible with Perl. It can also be set by a (?U) option setting
within the pattern.
PCRE_UTF8
- This option causes PCRE to regard both the pattern and the subject as
- strings of UTF-8 characters instead of single-byte character strings.
- However, it is available only when PCRE is built to include UTF-8 sup-
- port. If not, the use of this option provokes an error. Details of how
- this option changes the behaviour of PCRE are given in the section on
+ This option causes PCRE to regard both the pattern and the subject as
+ strings of UTF-8 characters instead of single-byte character strings.
+ However, it is available only when PCRE is built to include UTF-8 sup-
+ port. If not, the use of this option provokes an error. Details of how
+ this option changes the behaviour of PCRE are given in the section on
UTF-8 support in the main pcre page.
PCRE_NO_UTF8_CHECK
When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
- 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
+ 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
+ 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
@@ -1291,7 +1356,7 @@ COMPILATION ERROR CODES
9 nothing to repeat
10 [this code is not in use]
11 internal error: unexpected repeat
- 12 unrecognized character after (?
+ 12 unrecognized character after (? or (?-
13 POSIX named classes are supported only within a class
14 missing )
15 reference to non-existent subpattern
@@ -1299,7 +1364,7 @@ COMPILATION ERROR CODES
17 unknown option bit(s) set
18 missing ) after comment
19 [this code is not in use]
- 20 regular expression too large
+ 20 regular expression is too large
21 failed to get memory
22 unmatched parentheses
23 internal error: code overflow
@@ -1328,18 +1393,26 @@ COMPILATION ERROR CODES
46 malformed \P or \p sequence
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)
+ 49 too many named subpatterns (maximum 10000)
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
- 56 inconsistent NEWLINE options"
+ 56 inconsistent NEWLINE options
57 \g is not followed by a braced name or an optionally braced
non-zero number
58 (?+ or (?- or (?(+ or (?(- must be followed by a non-zero number
+ 59 (*VERB) with an argument is not supported
+ 60 (*VERB) not recognized
+ 61 number is too big
+ 62 subpattern name expected
+ 63 digit expected after (?+
+
+ The numbers 32 and 10000 in errors 48 and 49 are defaults; different
+ values may be used if the limits were changed when PCRE was built.
STUDYING A PATTERN
@@ -1532,21 +1605,22 @@ INFORMATION ABOUT A PATTERN
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.
+ variable. An explicit match is either a literal CR or LF character, or
+ \r or \n.
PCRE_INFO_JCHANGED
- 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.
+ Return 1 if the (?J) or (?-J) option setting is used in the pattern,
+ otherwise 0. The fourth argument should point to an int variable. (?J)
+ and (?-J) set and unset the local PCRE_DUPNAMES option, respectively.
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.
@@ -1554,34 +1628,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 ??:
@@ -1590,29 +1664,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 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,
+ 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
@@ -1626,7 +1700,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.
@@ -1634,9 +1708,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.
@@ -1644,21 +1718,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).
@@ -1666,21 +1740,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.)
@@ -1690,18 +1764,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():
@@ -1720,10 +1794,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;
@@ -1733,7 +1807,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
@@ -1742,77 +1816,85 @@ 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_BSR_ANYCRLF
+ PCRE_BSR_UNICODE
+
+ These options (which are mutually exclusive) control what the \R escape
+ sequence matches. The choice is either to match only CR, LF, or CRLF,
+ or to match any Unicode newline sequence. These options override the
+ choice that was made or defaulted when the pattern was compiled.
+
PCRE_NEWLINE_CR
PCRE_NEWLINE_LF
PCRE_NEWLINE_CRLF
@@ -1829,7 +1911,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
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
+ explicit matches for CR or LF characters, the match position is
advanced by two characters instead of one, in other words, to after the
CRLF.
@@ -1839,194 +1921,197 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
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.
+ acter after the first failure.
+
+ An explicit match for CR of LF is either a literal appearance of one of
+ those characters, or one of the \r or \n escape sequences. Implicit
+ matches such as [^X] do not count, nor does \s (which includes CR and
+ LF in the characters that it matches).
- Notwithstanding the above, anomalous effects may still occur when CRLF
+ 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
This option specifies that first character of the subject string is not
- the beginning of a line, so the circumflex metacharacter should not
- match before it. Setting this without PCRE_MULTILINE (at compile time)
- causes circumflex never to match. This option affects only the behav-
+ the beginning of a line, so the circumflex metacharacter should not
+ match before it. Setting this without PCRE_MULTILINE (at compile time)
+ causes circumflex never to match. This option affects only the behav-
iour of the circumflex metacharacter. It does not affect \A.
PCRE_NOTEOL
This option specifies that the end of the subject string is not the end
- of a line, so the dollar metacharacter should not match it nor (except
- in multiline mode) a newline immediately before it. Setting this with-
+ of a line, so the dollar metacharacter should not match it nor (except
+ in multiline mode) a newline immediately before it. Setting this with-
out PCRE_MULTILINE (at compile time) causes dollar never to match. This
- option affects only the behaviour of the dollar metacharacter. It does
+ option affects only the behaviour of the dollar metacharacter. It does
not affect \Z or \z.
PCRE_NOTEMPTY
An empty string is not considered to be a valid match if this option is
- set. If there are alternatives in the pattern, they are tried. If all
- the alternatives match the empty string, the entire match fails. For
+ set. If there are alternatives in the pattern, they are tried. If all
+ the alternatives match the empty string, the entire match fails. For
example, if the pattern
a?b?
- is applied to a string not beginning with "a" or "b", it matches the
- empty string at the start of the subject. With PCRE_NOTEMPTY set, this
+ is applied to a string not beginning with "a" or "b", it matches the
+ empty string at the start of the subject. With PCRE_NOTEMPTY set, this
match is not valid, so PCRE searches further into the string for occur-
rences of "a" or "b".
Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a spe-
- cial case of a pattern match of the empty string within its split()
- function, and when using the /g modifier. It is possible to emulate
+ cial case of a pattern match of the empty string within its split()
+ function, and when using the /g modifier. It is possible to emulate
Perl's behaviour after matching a null string by first trying the match
again at the same offset with PCRE_NOTEMPTY and PCRE_ANCHORED, and then
- if that fails by advancing the starting offset (see below) and trying
+ if that fails by advancing the starting offset (see below) and trying
an ordinary match again. There is some code that demonstrates how to do
this in the pcredemo.c sample program.
PCRE_NO_UTF8_CHECK
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. 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-
+ 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. 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-
+ 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)
@@ -2035,7 +2120,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)
@@ -2044,79 +2129,79 @@ 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_BADNEWLINE (-23)
@@ -2139,78 +2224,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.
@@ -2229,7 +2314,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+)...
@@ -2238,27 +2323,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).
@@ -2267,47 +2352,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-
+ 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,
+ 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
+ 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.
@@ -2318,25 +2403,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():
@@ -2358,47 +2443,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
<.*>
@@ -2413,62 +2498,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
@@ -2480,8 +2565,8 @@ AUTHOR
REVISION
- Last updated: 21 August 2007
- Copyright (c) 1997-2007 University of Cambridge.
+ Last updated: 23 January 2008
+ Copyright (c) 1997-2008 University of Cambridge.
------------------------------------------------------------------------------
@@ -2765,16 +2850,23 @@ DIFFERENCES BETWEEN PCRE AND PERL
(f) The PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and PCRE_NO_AUTO_CAP-
TURE options for pcre_exec() have no Perl equivalents.
- (g) The callout facility is PCRE-specific.
+ (g) The \R escape sequence can be restricted to match only CR, LF, or
+ CRLF by the PCRE_BSR_ANYCRLF option.
- (h) The partial matching facility is PCRE-specific.
+ (h) The callout facility is PCRE-specific.
- (i) Patterns compiled by PCRE can be saved and re-used at a later time,
+ (i) The partial matching facility is PCRE-specific.
+
+ (j) Patterns compiled by PCRE can be saved and re-used at a later time,
even on different hosts that have the other endianness.
- (j) The alternative matching function (pcre_dfa_exec()) matches in a
+ (k) The alternative matching function (pcre_dfa_exec()) matches in a
different way and is not Perl-compatible.
+ (l) PCRE recognizes some special sequences such as (*CR) at the start
+ of a pattern that set overall options that cannot be changed within the
+ pattern.
+
AUTHOR
@@ -2785,7 +2877,7 @@ AUTHOR
REVISION
- Last updated: 08 August 2007
+ Last updated: 11 September 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -2853,36 +2945,43 @@ NEWLINE CONVENTIONS
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.
+ and that they must be in upper case. If more than one of them is
+ present, the last one is used.
+
+ The newline convention does not affect what the \R escape sequence
+ matches. By default, this is any Unicode newline sequence, for Perl
+ compatibility. However, this can be changed; see the description of \R
+ in the section entitled "Newline sequences" below. A change of \R set-
+ ting can be combined with a change of newline convention.
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
@@ -2901,7 +3000,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
@@ -2911,33 +3010,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
@@ -2947,16 +3046,16 @@ 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)
@@ -2970,48 +3069,48 @@ BACKSLASH
\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
+ 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
+ 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 },
+ 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
+ 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-
+ two syntaxes for \x. There is no difference in the way they are han-
dled. For example, \xdc is exactly the same as \x{dc}.
- After \0 up to two further octal digits are read. If there are fewer
- than two digits, just those that are present are used. Thus the
+ After \0 up to two further octal digits are read. If there are fewer
+ than two digits, just those that are present are used. Thus the
sequence \0\x\07 specifies two binary zeros followed by a BEL character
- (code value 7). Make sure you supply two digits after the initial zero
+ (code value 7). Make sure you supply two digits after the initial zero
if the pattern character that follows is itself an octal digit.
The handling of a backslash followed by a digit other than 0 is compli-
cated. Outside a character class, PCRE reads it and any following dig-
- its as a decimal number. If the number is less than 10, or if there
+ its as a decimal number. If the number is less than 10, or if there
have been at least that many previous capturing left parentheses in the
- expression, the entire sequence is taken as a back reference. A
- description of how this works is given later, following the discussion
+ expression, the entire sequence is taken as a back reference. A
+ description of how this works is given later, following the discussion
of parenthesized subpatterns.
- Inside a character class, or if the decimal number is greater than 9
- and there have not been that many capturing subpatterns, PCRE re-reads
+ Inside a character class, or if the decimal number is greater than 9
+ and there have not been that many capturing subpatterns, PCRE re-reads
up to three octal digits following the backslash, and uses them to gen-
- erate a data character. Any subsequent digits stand for themselves. In
- non-UTF-8 mode, the value of a character specified in octal must be
- less than \400. In UTF-8 mode, values up to \777 are permitted. For
+ erate a data character. Any subsequent digits stand for themselves. In
+ non-UTF-8 mode, the value of a character specified in octal must be
+ less than \400. In UTF-8 mode, values up to \777 are permitted. For
example:
\040 is another way of writing a space
@@ -3029,20 +3128,20 @@ BACKSLASH
\81 is either a back reference, or a binary zero
followed by the two characters "8" and "1"
- Note that octal values of 100 or greater must not be introduced by a
+ Note that octal values of 100 or greater must not be introduced by a
leading zero, because no more than three octal digits are ever read.
All the sequences that define a single character value can be used both
- inside and outside character classes. In addition, inside a character
- class, the sequence \b is interpreted as the backspace character (hex
- 08), and the sequences \R and \X are interpreted as the characters "R"
- and "X", respectively. Outside a character class, these sequences have
+ inside and outside character classes. In addition, inside a character
+ class, the sequence \b is interpreted as the backspace character (hex
+ 08), and the sequences \R and \X are interpreted as the characters "R"
+ and "X", respectively. Outside a character class, these sequences have
different meanings (see below).
Absolute and relative back references
- The sequence \g followed by an unsigned or a negative number, option-
- ally enclosed in braces, is an absolute or relative back reference. A
+ 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.
@@ -3063,28 +3162,28 @@ BACKSLASH
\W any "non-word" character
Each pair of escape sequences partitions the complete set of characters
- into two disjoint sets. Any given character matches one, and only one,
+ into two disjoint sets. Any given character matches one, and only one,
of each pair.
These character type sequences can appear both inside and outside char-
- acter classes. They each match one character of the appropriate type.
- If the current matching point is at the end of the subject string, all
+ acter classes. They each match one character of the appropriate type.
+ If the current matching point is at the end of the subject string, all
of them fail, since there is no character to match.
- For compatibility with Perl, \s does not match the VT character (code
- 11). This makes it different from the the POSIX "space" class. The \s
- characters are HT (9), LF (10), FF (12), CR (13), and space (32). If
+ For compatibility with Perl, \s does not match the VT character (code
+ 11). This makes it different from the the POSIX "space" class. The \s
+ characters are HT (9), LF (10), FF (12), CR (13), and space (32). If
"use locale;" is included in a Perl script, \s may match the VT charac-
ter. In PCRE, it never does.
- In UTF-8 mode, characters with values greater than 128 never match \d,
+ In UTF-8 mode, characters with values greater than 128 never match \d,
\s, or \w, and always match \D, \S, and \W. This is true even when Uni-
- code character property support is available. These sequences retain
+ code character property support is available. These sequences retain
their original meanings from before UTF-8 support was available, mainly
for efficiency reasons.
The sequences \h, \H, \v, and \V are Perl 5.10 features. In contrast to
- the other sequences, these do match certain high-valued codepoints in
+ the other sequences, these do match certain high-valued codepoints in
UTF-8 mode. The horizontal space characters are:
U+0009 Horizontal tab
@@ -3118,34 +3217,56 @@ BACKSLASH
U+2029 Paragraph separator
A "word" character is an underscore or any character less than 256 that
- is a letter or digit. The definition of letters and digits is con-
- trolled by PCRE's low-valued character tables, and may vary if locale-
- specific matching is taking place (see "Locale support" in the pcreapi
- page). For example, in a French locale such as "fr_FR" in Unix-like
- systems, or "french" in Windows, some character codes greater than 128
- are used for accented letters, and these are matched by \w. The use of
+ is a letter or digit. The definition of letters and digits is con-
+ trolled by PCRE's low-valued character tables, and may vary if locale-
+ specific matching is taking place (see "Locale support" in the pcreapi
+ page). For example, in a French locale such as "fr_FR" in Unix-like
+ systems, or "french" in Windows, some character codes greater than 128
+ are used for accented letters, and these are matched by \w. The use of
locales with Unicode is discouraged.
Newline sequences
- Outside a character class, the escape sequence \R matches any Unicode
- newline sequence. This is a Perl 5.10 feature. In non-UTF-8 mode \R is
- equivalent to the following:
+ Outside a character class, by default, the escape sequence \R matches
+ any Unicode newline sequence. This is a Perl 5.10 feature. In non-UTF-8
+ mode \R is equivalent to the following:
(?>\r\n|\n|\x0b|\f|\r|\x85)
- This is an example of an "atomic group", details of which are given
+ This is an example of an "atomic group", details of which are given
below. This particular group matches either the two-character sequence
- CR followed by LF, or one of the single characters LF (linefeed,
+ CR followed by LF, or one of the single characters LF (linefeed,
U+000A), VT (vertical tab, U+000B), FF (formfeed, U+000C), CR (carriage
return, U+000D), or NEL (next line, U+0085). The two-character sequence
is treated as a single unit that cannot be split.
- In UTF-8 mode, two additional characters whose codepoints are greater
+ In UTF-8 mode, two additional characters whose codepoints are greater
than 255 are added: LS (line separator, U+2028) and PS (paragraph sepa-
- rator, U+2029). Unicode character property support is not needed for
+ rator, U+2029). Unicode character property support is not needed for
these characters to be recognized.
+ It is possible to restrict \R to match only CR, LF, or CRLF (instead of
+ the complete set of Unicode line endings) by setting the option
+ PCRE_BSR_ANYCRLF either at compile time or when the pattern is matched.
+ (BSR is an abbrevation for "backslash R".) This can be made the default
+ when PCRE is built; if this is the case, the other behaviour can be
+ requested via the PCRE_BSR_UNICODE option. It is also possible to
+ specify these settings by starting a pattern string with one of the
+ following sequences:
+
+ (*BSR_ANYCRLF) CR, LF, or CRLF only
+ (*BSR_UNICODE) any Unicode newline sequence
+
+ These override the default and the options given to pcre_compile(), but
+ they can be overridden by options given to pcre_exec(). 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. If
+ more than one of them is present, the last one is used. They can be
+ combined with a change of newline convention, for example, a pattern
+ can start with:
+
+ (*ANY)(*BSR_ANYCRLF)
+
Inside a character class, \R matches the letter "R".
Unicode character properties
@@ -3601,9 +3722,9 @@ VERTICAL BAR
INTERNAL OPTION SETTING
The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
- PCRE_EXTENDED options can be changed from within the pattern by a
- sequence of Perl option letters enclosed between "(?" and ")". The
- option letters are
+ PCRE_EXTENDED options (which are Perl-compatible) can be changed from
+ within the pattern by a sequence of Perl option letters enclosed
+ between "(?" and ")". The option letters are
i for PCRE_CASELESS
m for PCRE_MULTILINE
@@ -3617,6 +3738,10 @@ INTERNAL OPTION SETTING
is also permitted. If a letter appears both before and after the
hyphen, the option is unset.
+ The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
+ can be changed in the same way as the Perl-compatible options by using
+ the characters J, U and X respectively.
+
When an option change occurs at top level (that is, not inside subpat-
tern parentheses), the change applies to the remainder of the pattern
that follows. If the change is placed right at the start of a pattern,
@@ -3642,9 +3767,11 @@ INTERNAL OPTION SETTING
the effects of option settings happen at compile time. There would be
some very weird behaviour otherwise.
- The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
- can be changed in the same way as the Perl-compatible options by using
- the characters J, U and X respectively.
+ Note: There are other PCRE-specific options that can be set by the
+ application when the compile or match functions are called. In some
+ cases the pattern can contain special leading sequences to override
+ what the application has set or what has been defaulted. Details are
+ given in the section entitled "Newline sequences" above.
SUBPATTERNS
@@ -4644,7 +4771,7 @@ CALLOUTS
is given in the pcrecallout documentation.
-BACTRACKING CONTROL
+BACKTRACKING CONTROL
Perl 5.10 introduced a number of "Special Backtracking Control Verbs",
which are described in the Perl documentation as "experimental and sub-
@@ -4775,7 +4902,7 @@ AUTHOR
REVISION
- Last updated: 21 August 2007
+ Last updated: 17 September 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -4904,7 +5031,7 @@ CHARACTER CLASSES
[^...] negative character class
[x-y] range (can be used for hex characters)
[[:xxx:]] positive POSIX named set
- [[^:xxx:]] negative POSIX named set
+ [[:^xxx:]] negative POSIX named set
alnum alphanumeric
alpha alphabetic
@@ -5074,7 +5201,8 @@ BACKTRACKING CONTROL
NEWLINE CONVENTIONS
- These are recognized only at the very start of a pattern.
+ These are recognized only at the very start of the pattern or after a
+ (*BSR_...) option.
(*CR)
(*LF)
@@ -5083,6 +5211,15 @@ NEWLINE CONVENTIONS
(*ANY)
+WHAT \R MATCHES
+
+ These are recognized only at the very start of the pattern or after a
+ (*...) option that sets the newline convention.
+
+ (*BSR_ANYCRLF)
+ (*BSR_UNICODE)
+
+
CALLOUTS
(?C) callout
@@ -5103,7 +5240,7 @@ AUTHOR
REVISION
- Last updated: 21 August 2007
+ Last updated: 14 November 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -5907,7 +6044,8 @@ MATCHING INTERFACE
c. The "i"th argument has a suitable type for holding the
string captured as the "i"th sub-pattern. If you pass in
- NULL for the "i"th argument, or pass fewer arguments than
+ void * NULL for the "i"th argument, or a non-void * NULL
+ of the correct type, or pass fewer arguments than the
number of sub-patterns, "i"th captured sub-pattern is
ignored.
@@ -6155,7 +6293,7 @@ AUTHOR
REVISION
- Last updated: 06 March 2007
+ Last updated: 12 November 2007
------------------------------------------------------------------------------
@@ -6183,29 +6321,28 @@ PCRE SAMPLE PROGRAM
bility of matching an empty string. Comments in the code explain what
is going on.
- The demonstration program is automatically built if you use "./config-
- ure;make" to build PCRE. Otherwise, if PCRE is installed in the stan-
- dard include and library directories for your system, you should be
- able to compile the demonstration program using this command:
+ If PCRE is installed in the standard include and library directories
+ for your system, you should be able to compile the demonstration pro-
+ gram using this command:
gcc -o pcredemo pcredemo.c -lpcre
- If PCRE is installed elsewhere, you may need to add additional options
- to the command line. For example, on a Unix-like system that has PCRE
- installed in /usr/local, you can compile the demonstration program
+ If PCRE is installed elsewhere, you may need to add additional options
+ to the command line. For example, on a Unix-like system that has PCRE
+ installed in /usr/local, you can compile the demonstration program
using a command like this:
gcc -o pcredemo -I/usr/local/include pcredemo.c \
-L/usr/local/lib -lpcre
- Once you have compiled the demonstration program, you can run simple
+ Once you have compiled the demonstration program, you can run simple
tests like this:
./pcredemo 'cat|dog' 'the cat sat on the mat'
./pcredemo -g 'cat|dog' 'the dog sat on the cat'
- Note that there is a much more comprehensive test program, called
- pcretest, which supports many more facilities for testing regular
+ Note that there is a much more comprehensive test program, called
+ pcretest, which supports many more facilities for testing regular
expressions and the PCRE library. The pcredemo program is provided as a
simple coding example.
@@ -6213,10 +6350,10 @@ PCRE SAMPLE PROGRAM
the standard library directory, you may get an error like this when you
try to run pcredemo:
- ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or
+ ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or
directory
- This is caused by the way shared library support works on those sys-
+ This is caused by the way shared library support works on those sys-
tems. You need to add
-R/usr/local/lib
@@ -6233,8 +6370,8 @@ AUTHOR
REVISION
- Last updated: 13 June 2007
- Copyright (c) 1997-2007 University of Cambridge.
+ Last updated: 23 January 2008
+ Copyright (c) 1997-2008 University of Cambridge.
------------------------------------------------------------------------------
PCRESTACK(3) PCRESTACK(3)
diff --git a/ext/pcre/pcrelib/pcre.h b/ext/pcre/pcrelib/pcre.h
index a002bbd5a..c85c32ea3 100644
--- a/ext/pcre/pcrelib/pcre.h
+++ b/ext/pcre/pcrelib/pcre.h
@@ -5,7 +5,7 @@
/* This is the public header file for the PCRE library, to be #included by
applications that call the PCRE functions.
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
#define PCRE_MAJOR 7
-#define PCRE_MINOR 3
+#define PCRE_MINOR 6
#define PCRE_PRERELEASE
-#define PCRE_DATE 2007-08-28
+#define PCRE_DATE 2008-01-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
@@ -122,6 +122,8 @@ extern "C" {
#define PCRE_NEWLINE_CRLF 0x00300000
#define PCRE_NEWLINE_ANY 0x00400000
#define PCRE_NEWLINE_ANYCRLF 0x00500000
+#define PCRE_BSR_ANYCRLF 0x00800000
+#define PCRE_BSR_UNICODE 0x01000000
/* Exec-time and get/set-time error codes */
@@ -147,7 +149,7 @@ extern "C" {
#define PCRE_ERROR_DFA_WSSIZE (-19)
#define PCRE_ERROR_DFA_RECURSE (-20)
#define PCRE_ERROR_RECURSIONLIMIT (-21)
-#define PCRE_ERROR_NOTUSED (-22)
+#define PCRE_ERROR_NULLWSLIMIT (-22) /* No longer actually used */
#define PCRE_ERROR_BADNEWLINE (-23)
/* Request types for pcre_fullinfo() */
@@ -180,6 +182,7 @@ compatible. */
#define PCRE_CONFIG_STACKRECURSE 5
#define PCRE_CONFIG_UNICODE_PROPERTIES 6
#define PCRE_CONFIG_MATCH_LIMIT_RECURSION 7
+#define PCRE_CONFIG_BSR 8
/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
these bits, just add new ones on the end, in order to remain compatible. */
diff --git a/ext/pcre/pcrelib/pcre_chartables.c b/ext/pcre/pcrelib/pcre_chartables.c
index bec2d0c04..f1dbaaedf 100644
--- a/ext/pcre/pcrelib/pcre_chartables.c
+++ b/ext/pcre/pcrelib/pcre_chartables.c
@@ -20,7 +20,7 @@ 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 "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c
index 77ec51cac..07b6369d6 100644
--- a/ext/pcre/pcrelib/pcre_compile.c
+++ b/ext/pcre/pcrelib/pcre_compile.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
supporting internal functions that are not used by other modules. */
-#include <config.h>
+#include "config.h"
#define NLBLOCK cd /* Block containing newline information */
#define PSSTART start_pattern /* Field containing processed string start */
@@ -138,35 +138,47 @@ static const short int escapes[] = {
#endif
-/* Table of special "verbs" like (*PRUNE) */
+/* Table of special "verbs" like (*PRUNE). This is a short table, so it is
+searched linearly. Put all the names into a single string, in order to reduce
+the number of relocations when a shared library is dynamically linked. */
typedef struct verbitem {
- const char *name;
int len;
int op;
} verbitem;
+static const char verbnames[] =
+ "ACCEPT\0"
+ "COMMIT\0"
+ "F\0"
+ "FAIL\0"
+ "PRUNE\0"
+ "SKIP\0"
+ "THEN";
+
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 }
+ { 6, OP_ACCEPT },
+ { 6, OP_COMMIT },
+ { 1, OP_FAIL },
+ { 4, OP_FAIL },
+ { 5, OP_PRUNE },
+ { 4, OP_SKIP },
+ { 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. */
+/* Tables of names of POSIX character classes and their lengths. The names are
+now all in a single string, to reduce the number of relocations when a shared
+library is dynamically loaded. The list of lengths is terminated by a zero
+length entry. The first three must be alpha, lower, upper, as this is assumed
+for handling case independence. */
-static const char *const posix_names[] = {
- "alpha", "lower", "upper",
- "alnum", "ascii", "blank", "cntrl", "digit", "graph",
- "print", "punct", "space", "word", "xdigit" };
+static const char posix_names[] =
+ "alpha\0" "lower\0" "upper\0" "alnum\0" "ascii\0" "blank\0"
+ "cntrl\0" "digit\0" "graph\0" "print\0" "punct\0" "space\0"
+ "word\0" "xdigit";
static const uschar posix_name_lengths[] = {
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 };
@@ -205,84 +217,90 @@ static const int posix_class_maps[] = {
/* The texts of compile-time error messages. These are "char *" because they
are passed to the outside world. Do not ever re-use any error number, because
they are documented. Always add a new error instead. Messages marked DEAD below
-are no longer used. */
-
-static const char *error_texts[] = {
- "no error",
- "\\ at end of pattern",
- "\\c at end of pattern",
- "unrecognized character follows \\",
- "numbers out of order in {} quantifier",
+are no longer used. This used to be a table of strings, but in order to reduce
+the number of relocations needed when a shared library is loaded dynamically,
+it is now one long string. We cannot use a table of offsets, because the
+lengths of inserts such as XSTRING(MAX_NAME_SIZE) are not known. Instead, we
+simply count through to the one we want - this isn't a performance issue
+because these strings are used only when there is a compilation error. */
+
+static const char error_texts[] =
+ "no error\0"
+ "\\ at end of pattern\0"
+ "\\c at end of pattern\0"
+ "unrecognized character follows \\\0"
+ "numbers out of order in {} quantifier\0"
/* 5 */
- "number too big in {} quantifier",
- "missing terminating ] for character class",
- "invalid escape sequence in character class",
- "range out of order in character class",
- "nothing to repeat",
+ "number too big in {} quantifier\0"
+ "missing terminating ] for character class\0"
+ "invalid escape sequence in character class\0"
+ "range out of order in character class\0"
+ "nothing to repeat\0"
/* 10 */
- "operand of unlimited repeat could match the empty string", /** DEAD **/
- "internal error: unexpected repeat",
- "unrecognized character after (?",
- "POSIX named classes are supported only within a class",
- "missing )",
+ "operand of unlimited repeat could match the empty string\0" /** DEAD **/
+ "internal error: unexpected repeat\0"
+ "unrecognized character after (? or (?-\0"
+ "POSIX named classes are supported only within a class\0"
+ "missing )\0"
/* 15 */
- "reference to non-existent subpattern",
- "erroffset passed as NULL",
- "unknown option bit(s) set",
- "missing ) after comment",
- "parentheses nested too deeply", /** DEAD **/
+ "reference to non-existent subpattern\0"
+ "erroffset passed as NULL\0"
+ "unknown option bit(s) set\0"
+ "missing ) after comment\0"
+ "parentheses nested too deeply\0" /** DEAD **/
/* 20 */
- "regular expression is too large",
- "failed to get memory",
- "unmatched parentheses",
- "internal error: code overflow",
- "unrecognized character after (?<",
+ "regular expression is too large\0"
+ "failed to get memory\0"
+ "unmatched parentheses\0"
+ "internal error: code overflow\0"
+ "unrecognized character after (?<\0"
/* 25 */
- "lookbehind assertion is not fixed length",
- "malformed number or name after (?(",
- "conditional group contains more than two branches",
- "assertion expected after (?(",
- "(?R or (?[+-]digits must be followed by )",
+ "lookbehind assertion is not fixed length\0"
+ "malformed number or name after (?(\0"
+ "conditional group contains more than two branches\0"
+ "assertion expected after (?(\0"
+ "(?R or (?[+-]digits must be followed by )\0"
/* 30 */
- "unknown POSIX class name",
- "POSIX collating elements are not supported",
- "this version of PCRE is not compiled with PCRE_UTF8 support",
- "spare error", /** DEAD **/
- "character value in \\x{...} sequence is too large",
+ "unknown POSIX class name\0"
+ "POSIX collating elements are not supported\0"
+ "this version of PCRE is not compiled with PCRE_UTF8 support\0"
+ "spare error\0" /** DEAD **/
+ "character value in \\x{...} sequence is too large\0"
/* 35 */
- "invalid condition (?(0)",
- "\\C not allowed in lookbehind assertion",
- "PCRE does not support \\L, \\l, \\N, \\U, or \\u",
- "number after (?C is > 255",
- "closing ) for (?C expected",
+ "invalid condition (?(0)\0"
+ "\\C not allowed in lookbehind assertion\0"
+ "PCRE does not support \\L, \\l, \\N, \\U, or \\u\0"
+ "number after (?C is > 255\0"
+ "closing ) for (?C expected\0"
/* 40 */
- "recursive call could loop indefinitely",
- "unrecognized character after (?P",
- "syntax error in subpattern name (missing terminator)",
- "two named subpatterns have the same name",
- "invalid UTF-8 string",
+ "recursive call could loop indefinitely\0"
+ "unrecognized character after (?P\0"
+ "syntax error in subpattern name (missing terminator)\0"
+ "two named subpatterns have the same name\0"
+ "invalid UTF-8 string\0"
/* 45 */
- "support for \\P, \\p, and \\X has not been compiled",
- "malformed \\P or \\p sequence",
- "unknown property name after \\P or \\p",
- "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)",
- "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")",
+ "support for \\P, \\p, and \\X has not been compiled\0"
+ "malformed \\P or \\p sequence\0"
+ "unknown property name after \\P or \\p\0"
+ "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)\0"
+ "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")\0"
/* 50 */
- "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",
- "DEFINE group contains more than one branch",
+ "repeated subpattern is too long\0" /** DEAD **/
+ "octal value is greater than \\377 (not in UTF-8 mode)\0"
+ "internal error: overran compiling workspace\0"
+ "internal error: previously-checked referenced subpattern not found\0"
+ "DEFINE group contains more than one branch\0"
/* 55 */
- "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",
- "(*VERB) with an argument is not supported",
+ "repeating a DEFINE group is not allowed\0"
+ "inconsistent NEWLINE options\0"
+ "\\g is not followed by a braced name or an optionally braced non-zero number\0"
+ "(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number\0"
+ "(*VERB) with an argument is not supported\0"
/* 60 */
- "(*VERB) not recognized",
- "number is too big"
-};
+ "(*VERB) not recognized\0"
+ "number is too big\0"
+ "subpattern name expected\0"
+ "digit expected after (?+";
/* Table to identify digits and hex digits. This is used when compiling
@@ -418,6 +436,28 @@ static BOOL
/*************************************************
+* Find an error text *
+*************************************************/
+
+/* The error texts are now all in one long string, to save on relocations. As
+some of the text is of unknown length, we can't use a table of offsets.
+Instead, just count through the strings. This is not a performance issue
+because it happens only when there has been a compilation error.
+
+Argument: the error number
+Returns: pointer to the error string
+*/
+
+static const char *
+find_error_text(int n)
+{
+const char *s = error_texts;
+for (; n > 0; n--) while (*s++ != 0);
+return s;
+}
+
+
+/*************************************************
* Handle escapes *
*************************************************/
@@ -456,16 +496,16 @@ ptr--; /* Set pointer back to the last byte */
if (c == 0) *errorcodeptr = ERR1;
-/* Non-alphamerics are literals. For digits or letters, do an initial lookup in
-a table. A non-zero result is something that can be returned immediately.
+/* Non-alphanumerics are literals. For digits or letters, do an initial lookup
+in a table. A non-zero result is something that can be returned immediately.
Otherwise further processing may be required. */
#ifndef EBCDIC /* ASCII coding */
-else if (c < '0' || c > 'z') {} /* Not alphameric */
+else if (c < '0' || c > 'z') {} /* Not alphanumeric */
else if ((i = escapes[c - '0']) != 0) c = i;
#else /* EBCDIC coding */
-else if (c < 'a' || (ebcdic_chartab[c] & 0x0E) == 0) {} /* Not alphameric */
+else if (c < 'a' || (ebcdic_chartab[c] & 0x0E) == 0) {} /* Not alphanumeric */
else if ((i = escapes[c - 0x48]) != 0) c = i;
#endif
@@ -682,10 +722,10 @@ else
break;
/* PCRE_EXTRA enables extensions to Perl in the matter of escapes. Any
- other alphameric following \ is an error if PCRE_EXTRA was set; otherwise,
- for Perl compatibility, it is a literal. This code looks a bit odd, but
- there used to be some cases other than the default, and there may be again
- in future, so I haven't "optimized" it. */
+ other alphanumeric following \ is an error if PCRE_EXTRA was set;
+ otherwise, for Perl compatibility, it is a literal. This code looks a bit
+ odd, but there used to be some cases other than the default, and there may
+ be again in future, so I haven't "optimized" it. */
default:
if ((options & PCRE_EXTRA) != 0) switch(c)
@@ -774,7 +814,7 @@ top = _pcre_utt_size;
while (bot < top)
{
i = (bot + top) >> 1;
- c = strcmp(name, _pcre_utt[i].name);
+ c = strcmp(name, _pcre_utt_names + _pcre_utt[i].name_offset);
if (c == 0)
{
*dptr = _pcre_utt[i].value;
@@ -1466,8 +1506,9 @@ for (;;)
can match the empty string or not. It is called from could_be_empty()
below and from compile_branch() when checking for an unlimited repeat of a
group that can match nothing. Note that first_significant_code() skips over
-assertions. If we hit an unclosed bracket, we return "empty" - this means we've
-struck an inner bracket whose current branch will already have been scanned.
+backward and negative forward assertions when its final argument is TRUE. If we
+hit an unclosed bracket, we return "empty" - this means we've struck an inner
+bracket whose current branch will already have been scanned.
Arguments:
code points to start of search
@@ -1489,6 +1530,16 @@ for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE
c = *code;
+ /* Skip over forward assertions; the other assertions are skipped by
+ first_significant_code() with a TRUE final argument. */
+
+ if (c == OP_ASSERT)
+ {
+ do code += GET(code, 1); while (*code == OP_ALT);
+ c = *code;
+ continue;
+ }
+
/* Groups with zero repeats can of course be empty; skip them. */
if (c == OP_BRAZERO || c == OP_BRAMINZERO)
@@ -1684,29 +1735,48 @@ return TRUE;
*************************************************/
/* This function is called when the sequence "[:" or "[." or "[=" is
-encountered in a character class. It checks whether this is followed by an
-optional ^ and then a sequence of letters, terminated by a matching ":]" or
-".]" or "=]".
+encountered in a character class. It checks whether this is followed by a
+sequence of characters terminated by a matching ":]" or ".]" or "=]". If we
+reach an unescaped ']' without the special preceding character, return FALSE.
+
+Originally, this function only recognized a sequence of letters between the
+terminators, but it seems that Perl recognizes any sequence of characters,
+though of course unknown POSIX names are subsequently rejected. Perl gives an
+"Unknown POSIX class" error for [:f\oo:] for example, where previously PCRE
+didn't consider this to be a POSIX class. Likewise for [:1234:].
+
+The problem in trying to be exactly like Perl is in the handling of escapes. We
+have to be sure that [abc[:x\]pqr] is *not* treated as containing a POSIX
+class, but [abc[:x\]pqr:]] is (so that an error can be generated). The code
+below handles the special case of \], but does not try to do any other escape
+processing. This makes it different from Perl for cases such as [:l\ower:]
+where Perl recognizes it as the POSIX class "lower" but PCRE does not recognize
+"l\ower". This is a lesser evil that not diagnosing bad classes when Perl does,
+I think.
-Argument:
+Arguments:
ptr pointer to the initial [
endptr where to return the end pointer
- cd pointer to compile data
Returns: TRUE or FALSE
*/
static BOOL
-check_posix_syntax(const uschar *ptr, const uschar **endptr, compile_data *cd)
+check_posix_syntax(const uschar *ptr, const uschar **endptr)
{
int terminator; /* Don't combine these lines; the Solaris cc */
terminator = *(++ptr); /* compiler warns about "non-constant" initializer. */
-if (*(++ptr) == '^') ptr++;
-while ((cd->ctypes[*ptr] & ctype_letter) != 0) ptr++;
-if (*ptr == terminator && ptr[1] == ']')
+for (++ptr; *ptr != 0; ptr++)
{
- *endptr = ptr;
- return TRUE;
+ if (*ptr == '\\' && ptr[1] == ']') ptr++; else
+ {
+ if (*ptr == ']') return FALSE;
+ if (*ptr == terminator && ptr[1] == ']')
+ {
+ *endptr = ptr;
+ return TRUE;
+ }
+ }
}
return FALSE;
}
@@ -1731,11 +1801,13 @@ Returns: a value representing the name, or -1 if unknown
static int
check_posix_name(const uschar *ptr, int len)
{
+const char *pn = posix_names;
register int yield = 0;
while (posix_name_lengths[yield] != 0)
{
if (len == posix_name_lengths[yield] &&
- strncmp((const char *)ptr, posix_names[yield], len) == 0) return yield;
+ strncmp((const char *)ptr, pn, len) == 0) return yield;
+ pn += posix_name_lengths[yield] + 1;
yield++;
}
return -1;
@@ -2302,6 +2374,7 @@ uschar classbits[32];
BOOL class_utf8;
BOOL utf8 = (options & PCRE_UTF8) != 0;
uschar *class_utf8data;
+uschar *class_utf8data_base;
uschar utf8_char[6];
#else
BOOL utf8 = FALSE;
@@ -2341,6 +2414,7 @@ req_caseopt = ((options & PCRE_CASELESS) != 0)? REQ_CASELESS : 0;
for (;; ptr++)
{
BOOL negate_class;
+ BOOL should_flip_negation;
BOOL possessive_quantifier;
BOOL is_quantifier;
BOOL is_recurse;
@@ -2564,7 +2638,7 @@ for (;; ptr++)
they are encountered at the top level, so we'll do that too. */
if ((ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
- check_posix_syntax(ptr, &tempptr, cd))
+ check_posix_syntax(ptr, &tempptr))
{
*errorcodeptr = (ptr[1] == ':')? ERR13 : ERR31;
goto FAILED;
@@ -2589,6 +2663,12 @@ for (;; ptr++)
else break;
}
+ /* If a class contains a negative special such as \S, we need to flip the
+ negation flag at the end, so that support for characters > 255 works
+ correctly (they are all included in the class). */
+
+ should_flip_negation = FALSE;
+
/* Keep a count of chars with values < 256 so that we can optimize the case
of just a single character (as long as it's < 256). However, For higher
valued UTF-8 characters, we don't yet do any optimization. */
@@ -2606,6 +2686,7 @@ for (;; ptr++)
#ifdef SUPPORT_UTF8
class_utf8 = FALSE; /* No chars >= 256 */
class_utf8data = code + LINK_SIZE + 2; /* For UTF-8 items */
+ class_utf8data_base = class_utf8data; /* For resetting in pass 1 */
#endif
/* Process characters until ] is reached. By writing this as a "do" it
@@ -2621,6 +2702,18 @@ for (;; ptr++)
{ /* Braces are required because the */
GETCHARLEN(c, ptr, ptr); /* macro generates multiple statements */
}
+
+ /* In the pre-compile phase, accumulate the length of any UTF-8 extra
+ data and reset the pointer. This is so that very large classes that
+ contain a zillion UTF-8 characters no longer overwrite the work space
+ (which is on the stack). */
+
+ if (lengthptr != NULL)
+ {
+ *lengthptr += class_utf8data - class_utf8data_base;
+ class_utf8data = class_utf8data_base;
+ }
+
#endif
/* Inside \Q...\E everything is literal except \E */
@@ -2644,7 +2737,7 @@ for (;; ptr++)
if (c == '[' &&
(ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
- check_posix_syntax(ptr, &tempptr, cd))
+ check_posix_syntax(ptr, &tempptr))
{
BOOL local_negate = FALSE;
int posix_class, taboffset, tabopt;
@@ -2661,6 +2754,7 @@ for (;; ptr++)
if (*ptr == '^')
{
local_negate = TRUE;
+ should_flip_negation = TRUE; /* Note negative special */
ptr++;
}
@@ -2735,7 +2829,7 @@ for (;; ptr++)
c = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
if (*errorcodeptr != 0) goto FAILED;
- if (-c == ESC_b) c = '\b'; /* \b is backslash in a class */
+ if (-c == ESC_b) c = '\b'; /* \b is backspace in a class */
else if (-c == ESC_X) c = 'X'; /* \X is literal X in a class */
else if (-c == ESC_R) c = 'R'; /* \R is literal R in a class */
else if (-c == ESC_Q) /* Handle start of quoted string */
@@ -2763,6 +2857,7 @@ for (;; ptr++)
continue;
case ESC_D:
+ should_flip_negation = TRUE;
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_digit];
continue;
@@ -2771,6 +2866,7 @@ for (;; ptr++)
continue;
case ESC_W:
+ should_flip_negation = TRUE;
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word];
continue;
@@ -2780,13 +2876,11 @@ for (;; ptr++)
continue;
case ESC_S:
+ should_flip_negation = TRUE;
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_space];
classbits[1] |= 0x08; /* Perl 5.004 onwards omits VT from \s */
continue;
- case ESC_E: /* Perl ignores an orphan \E */
- continue;
-
default: /* Not recognized; fall through */
break; /* Need "default" setting to stop compiler warning. */
}
@@ -2974,6 +3068,12 @@ for (;; ptr++)
oldptr = ptr;
+ /* Remember \r or \n */
+
+ if (c == '\r' || c == '\n') cd->external_flags |= PCRE_HASCRORLF;
+
+ /* Check for range */
+
if (!inescq && ptr[1] == '-')
{
int d;
@@ -3015,7 +3115,7 @@ for (;; ptr++)
d = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE);
if (*errorcodeptr != 0) goto FAILED;
- /* \b is backslash; \X is literal X; \R is literal R; any other
+ /* \b is backspace; \X is literal X; \R is literal R; any other
special means the '-' was literal */
if (d < 0)
@@ -3041,6 +3141,10 @@ for (;; ptr++)
if (d == c) goto LONE_SINGLE_CHARACTER; /* A few lines below */
+ /* Remember \r or \n */
+
+ if (d == '\r' || d == '\n') cd->external_flags |= PCRE_HASCRORLF;
+
/* In UTF-8 mode, if the upper limit is > 255, or > 127 for caseless
matching, we have to use an XCLASS with extra data items. Caseless
matching for characters > 127 is available only if UCP support is
@@ -3194,16 +3298,24 @@ for (;; ptr++)
goto FAILED;
}
+
+/* This code has been disabled because it would mean that \s counts as
+an explicit \r or \n reference, and that's not really what is wanted. Now
+we set the flag only if there is a literal "\r" or "\n" in the class. */
+
+#if 0
/* Remember whether \r or \n are in this class */
if (negate_class)
{
- if ((classbits[1] & 0x24) != 0x24) cd->external_options |= PCRE_HASCRORLF;
+ if ((classbits[1] & 0x24) != 0x24) cd->external_flags |= PCRE_HASCRORLF;
}
else
{
- if ((classbits[1] & 0x24) != 0) cd->external_options |= PCRE_HASCRORLF;
+ if ((classbits[1] & 0x24) != 0) cd->external_flags |= PCRE_HASCRORLF;
}
+#endif
+
/* If class_charcount is 1, we saw precisely one character whose value is
less than 256. As long as there were no characters >= 128 and there was no
@@ -3267,11 +3379,14 @@ for (;; ptr++)
zeroreqbyte = reqbyte;
/* If there are characters with values > 255, we have to compile an
- extended class, with its own opcode. If there are no characters < 256,
- we can omit the bitmap in the actual compiled code. */
+ extended class, with its own opcode, unless there was a negated special
+ such as \S in the class, because in that case all characters > 255 are in
+ the class, so any that were explicitly given as well can be ignored. If
+ (when there are explicit characters > 255 that must be listed) there are no
+ characters < 256, we can omit the bitmap in the actual compiled code. */
#ifdef SUPPORT_UTF8
- if (class_utf8)
+ if (class_utf8 && !should_flip_negation)
{
*class_utf8data++ = XCL_END; /* Marks the end of extra data */
*code++ = OP_XCLASS;
@@ -3297,20 +3412,19 @@ for (;; ptr++)
}
#endif
- /* If there are no characters > 255, negate the 32-byte map if necessary,
- and copy it into the code vector. If this is the first thing in the branch,
- there can be no first char setting, whatever the repeat count. Any reqbyte
- setting must remain unchanged after any kind of repeat. */
+ /* If there are no characters > 255, set the opcode to OP_CLASS or
+ OP_NCLASS, depending on whether the whole class was negated and whether
+ there were negative specials such as \S in the class. Then copy the 32-byte
+ map into the code vector, negating it if necessary. */
+ *code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS;
if (negate_class)
{
- *code++ = OP_NCLASS;
if (lengthptr == NULL) /* Save time in the pre-compile phase */
for (c = 0; c < 32; c++) code[c] = ~classbits[c];
}
else
{
- *code++ = OP_CLASS;
memcpy(code, classbits, 32);
}
code += 32;
@@ -3496,7 +3610,7 @@ for (;; ptr++)
/* All real repeats make it impossible to handle partial matching (maybe
one day we will be able to remove this restriction). */
- if (repeat_max != 1) cd->nopartial = TRUE;
+ if (repeat_max != 1) cd->external_flags |= PCRE_NOPARTIAL;
/* Combine the op_type with the repeat_type */
@@ -3646,7 +3760,7 @@ for (;; ptr++)
/* All real repeats make it impossible to handle partial matching (maybe
one day we will be able to remove this restriction). */
- if (repeat_max != 1) cd->nopartial = TRUE;
+ if (repeat_max != 1) cd->external_flags |= PCRE_NOPARTIAL;
if (repeat_min == 0 && repeat_max == -1)
*code++ = OP_CRSTAR + repeat_type;
@@ -3946,7 +4060,9 @@ for (;; ptr++)
int len;
if (*tempcode == OP_EXACT || *tempcode == OP_TYPEEXACT ||
*tempcode == OP_NOTEXACT)
- tempcode += _pcre_OP_lengths[*tempcode];
+ tempcode += _pcre_OP_lengths[*tempcode] +
+ ((*tempcode == OP_TYPEEXACT &&
+ (tempcode[3] == OP_PROP || tempcode[3] == OP_NOTPROP))? 2:0);
len = code - tempcode;
if (len > 0) switch (*tempcode)
{
@@ -4004,6 +4120,7 @@ for (;; ptr++)
if (*(++ptr) == '*' && (cd->ctypes[ptr[1]] & ctype_letter) != 0)
{
int i, namelen;
+ const char *vn = verbnames;
const uschar *name = ++ptr;
previous = NULL;
while ((cd->ctypes[*++ptr] & ctype_letter) != 0);
@@ -4021,12 +4138,13 @@ for (;; ptr++)
for (i = 0; i < verbcount; i++)
{
if (namelen == verbs[i].len &&
- strncmp((char *)name, verbs[i].name, namelen) == 0)
+ strncmp((char *)name, vn, namelen) == 0)
{
*code = verbs[i].op;
if (*code++ == OP_ACCEPT) cd->had_accept = TRUE;
break;
}
+ vn += verbs[i].len + 1;
}
if (i < verbcount) continue;
*errorcodeptr = ERR60;
@@ -4171,16 +4289,13 @@ for (;; ptr++)
*errorcodeptr = ERR58;
goto FAILED;
}
- if (refsign == '-')
+ recno = (refsign == '-')?
+ cd->bracount - recno + 1 : recno +cd->bracount;
+ if (recno <= 0 || recno > cd->final_bracount)
{
- recno = cd->bracount - recno + 1;
- if (recno <= 0)
- {
- *errorcodeptr = ERR15;
- goto FAILED;
- }
+ *errorcodeptr = ERR15;
+ goto FAILED;
}
- else recno += cd->bracount;
PUT2(code, 2+LINK_SIZE, recno);
break;
}
@@ -4252,9 +4367,10 @@ for (;; ptr++)
skipbytes = 1;
}
- /* Check for the "name" actually being a subpattern number. */
+ /* Check for the "name" actually being a subpattern number. We are
+ in the second pass here, so final_bracount is set. */
- else if (recno > 0)
+ else if (recno > 0 && recno <= cd->final_bracount)
{
PUT2(code, 2+LINK_SIZE, recno);
}
@@ -4448,7 +4564,9 @@ for (;; ptr++)
/* We come here from the Python syntax above that handles both
references (?P=name) and recursion (?P>name), as well as falling
- through from the Perl recursion syntax (?&name). */
+ through from the Perl recursion syntax (?&name). We also come here from
+ the Perl \k<name> or \k'name' back reference syntax and the \k{name}
+ .NET syntax. */
NAMED_REF_OR_RECURSE:
name = ++ptr;
@@ -4460,6 +4578,11 @@ for (;; ptr++)
if (lengthptr != NULL)
{
+ if (namelen == 0)
+ {
+ *errorcodeptr = ERR62;
+ goto FAILED;
+ }
if (*ptr != terminator)
{
*errorcodeptr = ERR42;
@@ -4473,14 +4596,19 @@ for (;; ptr++)
recno = 0;
}
- /* In the real compile, seek the name in the table */
+ /* In the real compile, seek the name in the table. We check the name
+ first, and then check that we have reached the end of the name in the
+ table. That way, if the name that is longer than any in the table,
+ the comparison will fail without reading beyond the table entry. */
else
{
slot = cd->name_table;
for (i = 0; i < cd->names_found; i++)
{
- if (strncmp((char *)name, (char *)slot+2, namelen) == 0) break;
+ if (strncmp((char *)name, (char *)slot+2, namelen) == 0 &&
+ slot[2+namelen] == 0)
+ break;
slot += cd->name_entry_size;
}
@@ -4517,7 +4645,15 @@ for (;; ptr++)
{
const uschar *called;
- if ((refsign = *ptr) == '+') ptr++;
+ if ((refsign = *ptr) == '+')
+ {
+ ptr++;
+ if ((digitab[*ptr] & ctype_digit) == 0)
+ {
+ *errorcodeptr = ERR63;
+ goto FAILED;
+ }
+ }
else if (refsign == '-')
{
if ((digitab[ptr[1]] & ctype_digit) == 0)
@@ -4643,7 +4779,7 @@ for (;; ptr++)
case 'J': /* Record that it changed in the external options */
*optset |= PCRE_DUPNAMES;
- cd->external_options |= PCRE_JCHANGED;
+ cd->external_flags |= PCRE_JCHANGED;
break;
case 'i': *optset |= PCRE_CASELESS; break;
@@ -5063,7 +5199,7 @@ for (;; ptr++)
/* Remember if \r or \n were seen */
if (mcbuffer[0] == '\r' || mcbuffer[0] == '\n')
- cd->external_options |= PCRE_HASCRORLF;
+ cd->external_flags |= 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.
@@ -5683,7 +5819,6 @@ to fill in forward references to subpatterns. */
uschar cworkspace[COMPILE_WORK_SIZE];
-
/* Set this early so that early errors get offset 0. */
ptr = (const uschar *)pattern;
@@ -5743,24 +5878,46 @@ 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. */
+/* Check for global one-time settings at the start of the pattern, and remember
+the offset for later. */
-if (ptr[0] == '(' && ptr[1] == '*')
+while (ptr[skipatstart] == '(' && ptr[skipatstart+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)
+ int newbsr = 0;
+
+ if (strncmp((char *)(ptr+skipatstart+2), "CR)", 3) == 0)
+ { skipatstart += 5; newnl = PCRE_NEWLINE_CR; }
+ else if (strncmp((char *)(ptr+skipatstart+2), "LF)", 3) == 0)
+ { skipatstart += 5; newnl = PCRE_NEWLINE_LF; }
+ else if (strncmp((char *)(ptr+skipatstart+2), "CRLF)", 5) == 0)
+ { skipatstart += 7; newnl = PCRE_NEWLINE_CR + PCRE_NEWLINE_LF; }
+ else if (strncmp((char *)(ptr+skipatstart+2), "ANY)", 4) == 0)
+ { skipatstart += 6; newnl = PCRE_NEWLINE_ANY; }
+ else if (strncmp((char *)(ptr+skipatstart+2), "ANYCRLF)", 8) == 0)
+ { skipatstart += 10; newnl = PCRE_NEWLINE_ANYCRLF; }
+
+ else if (strncmp((char *)(ptr+skipatstart+2), "BSR_ANYCRLF)", 12) == 0)
+ { skipatstart += 14; newbsr = PCRE_BSR_ANYCRLF; }
+ else if (strncmp((char *)(ptr+skipatstart+2), "BSR_UNICODE)", 12) == 0)
+ { skipatstart += 14; newbsr = PCRE_BSR_UNICODE; }
+
+ if (newnl != 0)
options = (options & ~PCRE_NEWLINE_BITS) | newnl;
+ else if (newbsr != 0)
+ options = (options & ~(PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) | newbsr;
+ else break;
+ }
+
+/* Check validity of \R options. */
+
+switch (options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE))
+ {
+ case 0:
+ case PCRE_BSR_ANYCRLF:
+ case PCRE_BSR_UNICODE:
+ break;
+ default: errorcode = ERR56; goto PCRE_EARLY_ERROR_RETURN;
}
/* Handle different types of newline. The three bits give seven cases. The
@@ -5822,7 +5979,7 @@ to compile parts of the pattern into; the compiled code is discarded when it is
no longer needed, so hopefully this workspace will never overflow, though there
is a test for its doing so. */
-cd->bracount = 0;
+cd->bracount = cd->final_bracount = 0;
cd->names_found = 0;
cd->name_entry_size = 0;
cd->name_table = NULL;
@@ -5832,8 +5989,8 @@ cd->hwm = cworkspace;
cd->start_pattern = (const uschar *)pattern;
cd->end_pattern = (const uschar *)(pattern + strlen(pattern));
cd->req_varyopt = 0;
-cd->nopartial = FALSE;
cd->external_options = options;
+cd->external_flags = 0;
/* Now do the pre-compile. On error, errorcode will be set non-zero, so we
don't need to look at the result of the function here. The initial options have
@@ -5872,14 +6029,16 @@ if (re == NULL)
goto PCRE_EARLY_ERROR_RETURN;
}
-/* Put in the magic number, and save the sizes, initial options, and character
-table pointer. NULL is used for the default character tables. The nullpad field
-is at the end; it's there to help in the case when a regex compiled on a system
-with 4-byte pointers is run on another with 8-byte pointers. */
+/* Put in the magic number, and save the sizes, initial options, internal
+flags, and character table pointer. NULL is used for the default character
+tables. The nullpad field is at the end; it's there to help in the case when a
+regex compiled on a system with 4-byte pointers is run on another with 8-byte
+pointers. */
re->magic_number = MAGIC_NUMBER;
re->size = size;
re->options = cd->external_options;
+re->flags = cd->external_flags;
re->dummy1 = 0;
re->first_byte = 0;
re->req_byte = 0;
@@ -5897,6 +6056,7 @@ field. Reset the bracket count and the names_found field. Also reset the hwm
field; this time it's used for remembering forward references to subpatterns.
*/
+cd->final_bracount = cd->bracount; /* Save for checking forward references */
cd->bracount = 0;
cd->names_found = 0;
cd->name_table = (uschar *)re + re->name_table_offset;
@@ -5904,7 +6064,6 @@ codestart = cd->name_table + re->name_entry_size * re->name_count;
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
@@ -5918,8 +6077,8 @@ code = (uschar *)codestart;
&errorcode, FALSE, FALSE, 0, &firstbyte, &reqbyte, NULL, cd, NULL);
re->top_bracket = cd->bracount;
re->top_backref = cd->top_backref;
+re->flags = cd->external_flags;
-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. */
@@ -5962,7 +6121,7 @@ if (errorcode != 0)
PCRE_EARLY_ERROR_RETURN:
*erroroffset = ptr - (const uschar *)pattern;
PCRE_EARLY_ERROR_RETURN2:
- *errorptr = error_texts[errorcode];
+ *errorptr = find_error_text(errorcode);
if (errorcodeptr != NULL) *errorcodeptr = errorcode;
return NULL;
}
@@ -5991,10 +6150,10 @@ if ((re->options & PCRE_ANCHORED) == 0)
int ch = firstbyte & 255;
re->first_byte = ((firstbyte & REQ_CASELESS) != 0 &&
cd->fcc[ch] == ch)? ch : firstbyte;
- re->options |= PCRE_FIRSTSET;
+ re->flags |= PCRE_FIRSTSET;
}
else if (is_startline(codestart, 0, cd->backref_map))
- re->options |= PCRE_STARTLINE;
+ re->flags |= PCRE_STARTLINE;
}
}
@@ -6008,7 +6167,7 @@ if (reqbyte >= 0 &&
int ch = reqbyte & 255;
re->req_byte = ((reqbyte & REQ_CASELESS) != 0 &&
cd->fcc[ch] == ch)? (reqbyte & ~REQ_CASELESS) : reqbyte;
- re->options |= PCRE_REQCHSET;
+ re->flags |= PCRE_REQCHSET;
}
/* Print out the compiled data if debugging is enabled. This is never the
@@ -6021,7 +6180,7 @@ printf("Length = %d top_bracket = %d top_backref = %d\n",
printf("Options=%08x\n", re->options);
-if ((re->options & PCRE_FIRSTSET) != 0)
+if ((re->flags & PCRE_FIRSTSET) != 0)
{
int ch = re->first_byte & 255;
const char *caseless = ((re->first_byte & REQ_CASELESS) == 0)?
@@ -6030,7 +6189,7 @@ if ((re->options & PCRE_FIRSTSET) != 0)
else printf("First char = \\x%02x%s\n", ch, caseless);
}
-if ((re->options & PCRE_REQCHSET) != 0)
+if ((re->flags & PCRE_REQCHSET) != 0)
{
int ch = re->req_byte & 255;
const char *caseless = ((re->req_byte & REQ_CASELESS) == 0)?
@@ -6047,7 +6206,7 @@ was compiled can be seen. */
if (code - codestart > length)
{
(pcre_free)(re);
- *errorptr = error_texts[ERR23];
+ *errorptr = find_error_text(ERR23);
*erroroffset = ptr - (uschar *)pattern;
if (errorcodeptr != NULL) *errorcodeptr = ERR23;
return NULL;
diff --git a/ext/pcre/pcrelib/pcre_config.c b/ext/pcre/pcrelib/pcre_config.c
index 700a5d291..32f9047b0 100644
--- a/ext/pcre/pcrelib/pcre_config.c
+++ b/ext/pcre/pcrelib/pcre_config.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* This module contains the external function pcre_config(). */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
@@ -85,6 +85,14 @@ switch (what)
*((int *)where) = NEWLINE;
break;
+ case PCRE_CONFIG_BSR:
+#ifdef BSR_ANYCRLF
+ *((int *)where) = 1;
+#else
+ *((int *)where) = 0;
+#endif
+ break;
+
case PCRE_CONFIG_LINK_SIZE:
*((int *)where) = LINK_SIZE;
break;
diff --git a/ext/pcre/pcrelib/pcre_exec.c b/ext/pcre/pcrelib/pcre_exec.c
index 1c570a03b..5520d153b 100644
--- a/ext/pcre/pcrelib/pcre_exec.c
+++ b/ext/pcre/pcrelib/pcre_exec.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ 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>
+#include "config.h"
#define NLBLOCK md /* Block containing newline information */
#define PSSTART start_subject /* Field containing processed string start */
@@ -1524,12 +1524,16 @@ for (;;)
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
break;
+
case 0x000a:
+ break;
+
case 0x000b:
case 0x000c:
case 0x0085:
case 0x2028:
case 0x2029:
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
ecode++;
@@ -2952,12 +2956,16 @@ for (;;)
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
break;
+
case 0x000a:
+ break;
+
case 0x000b:
case 0x000c:
case 0x0085:
case 0x2028:
case 0x2029:
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
}
@@ -3170,9 +3178,12 @@ for (;;)
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
break;
case 0x000a:
+ break;
+
case 0x000b:
case 0x000c:
case 0x0085:
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
}
@@ -3424,11 +3435,14 @@ for (;;)
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
break;
case 0x000a:
+ break;
+
case 0x000b:
case 0x000c:
case 0x0085:
case 0x2028:
case 0x2029:
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
break;
@@ -3580,10 +3594,14 @@ for (;;)
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
break;
+
case 0x000a:
+ break;
+
case 0x000b:
case 0x000c:
case 0x0085:
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
break;
@@ -3881,8 +3899,10 @@ for (;;)
}
else
{
- if (c != 0x000a && c != 0x000b && c != 0x000c &&
- c != 0x0085 && c != 0x2028 && c != 0x2029)
+ if (c != 0x000a &&
+ (md->bsr_anycrlf ||
+ (c != 0x000b && c != 0x000c &&
+ c != 0x0085 && c != 0x2028 && c != 0x2029)))
break;
eptr += len;
}
@@ -4072,7 +4092,9 @@ for (;;)
}
else
{
- if (c != 0x000a && c != 0x000b && c != 0x000c && c != 0x0085)
+ if (c != 0x000a &&
+ (md->bsr_anycrlf ||
+ (c != 0x000b && c != 0x000c && c != 0x0085)))
break;
eptr++;
}
@@ -4222,12 +4244,17 @@ HEAP_RETURN:
switch (frame->Xwhere)
{
LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8)
- LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(16)
- 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(48)
- LBL(49) LBL(50) LBL(51) LBL(52) LBL(53) LBL(54)
+ LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(17)
+ LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33)
+ LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52)
+ LBL(53) LBL(54)
+#ifdef SUPPORT_UTF8
+ LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30)
+ LBL(32) LBL(34) LBL(42) LBL(46)
+#ifdef SUPPORT_UCP
+ LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)
+#endif /* SUPPORT_UCP */
+#endif /* SUPPORT_UTF8 */
default:
DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere));
return PCRE_ERROR_INTERNAL;
@@ -4406,7 +4433,7 @@ if (re->magic_number != MAGIC_NUMBER)
/* Set up other data */
anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
-startline = (re->options & PCRE_STARTLINE) != 0;
+startline = (re->flags & PCRE_STARTLINE) != 0;
firstline = (re->options & PCRE_FIRSTLINE) != 0;
/* The code starts after the real_pcre block and the capture name table. */
@@ -4433,11 +4460,37 @@ md->recursive = NULL; /* No recursion at top level */
md->lcc = tables + lcc_offset;
md->ctypes = tables + ctypes_offset;
+/* Handle different \R options. */
+
+switch (options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE))
+ {
+ case 0:
+ if ((re->options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)) != 0)
+ md->bsr_anycrlf = (re->options & PCRE_BSR_ANYCRLF) != 0;
+ else
+#ifdef BSR_ANYCRLF
+ md->bsr_anycrlf = TRUE;
+#else
+ md->bsr_anycrlf = FALSE;
+#endif
+ break;
+
+ case PCRE_BSR_ANYCRLF:
+ md->bsr_anycrlf = TRUE;
+ break;
+
+ case PCRE_BSR_UNICODE:
+ md->bsr_anycrlf = FALSE;
+ break;
+
+ default: return PCRE_ERROR_BADNEWLINE;
+ }
+
/* Handle different types of newline. The three bits give eight cases. If
nothing is set at run time, whatever was used at compile time applies. */
-switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : (pcre_uint32)options) &
- PCRE_NEWLINE_BITS)
+switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options :
+ (pcre_uint32)options) & PCRE_NEWLINE_BITS)
{
case 0: newline = NEWLINE; break; /* Compile-time default */
case PCRE_NEWLINE_CR: newline = '\r'; break;
@@ -4476,7 +4529,7 @@ else
/* Partial matching is supported only for a restricted set of regexes at the
moment. */
-if (md->partial && (re->options & PCRE_NOPARTIAL) != 0)
+if (md->partial && (re->flags & PCRE_NOPARTIAL) != 0)
return PCRE_ERROR_BADPARTIAL;
/* Check a UTF-8 string if required. Unfortunately there's no way of passing
@@ -4553,7 +4606,7 @@ studied, there may be a bitmap of possible first characters. */
if (!anchored)
{
- if ((re->options & PCRE_FIRSTSET) != 0)
+ if ((re->flags & PCRE_FIRSTSET) != 0)
{
first_byte = re->first_byte & 255;
if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
@@ -4568,7 +4621,7 @@ if (!anchored)
/* For anchored or unanchored matches, there may be a "last known required
character" set. */
-if ((re->options & PCRE_REQCHSET) != 0)
+if ((re->flags & PCRE_REQCHSET) != 0)
{
req_byte = re->req_byte & 255;
req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
@@ -4615,10 +4668,10 @@ for(;;)
if (first_byte_caseless)
while (start_match < end_subject &&
md->lcc[*start_match] != first_byte)
- start_match++;
+ { NEXTCHAR(start_match); }
else
while (start_match < end_subject && *start_match != first_byte)
- start_match++;
+ { NEXTCHAR(start_match); }
}
/* Or to just after a linebreak for a multiline match if possible */
@@ -4628,7 +4681,7 @@ for(;;)
if (start_match > md->start_subject + start_offset)
{
while (start_match <= end_subject && !WAS_NEWLINE(start_match))
- start_match++;
+ { NEXTCHAR(start_match); }
/* If we have just passed a CR and the newline option is ANY or ANYCRLF,
and we are now at a LF, advance the match position by one more character.
@@ -4649,7 +4702,9 @@ for(;;)
while (start_match < end_subject)
{
register unsigned int c = *start_match;
- if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break;
+ if ((start_bits[c/8] & (1 << (c&7))) == 0)
+ { NEXTCHAR(start_match); }
+ else break;
}
}
@@ -4790,7 +4845,7 @@ for(;;)
if (start_match[-1] == '\r' &&
start_match < end_subject &&
*start_match == '\n' &&
- (re->options & PCRE_HASCRORLF) == 0 &&
+ (re->flags & PCRE_HASCRORLF) == 0 &&
(md->nltype == NLTYPE_ANY ||
md->nltype == NLTYPE_ANYCRLF ||
md->nllen == 2))
diff --git a/ext/pcre/pcrelib/pcre_fullinfo.c b/ext/pcre/pcrelib/pcre_fullinfo.c
index 1554292e6..b91ea035e 100644
--- a/ext/pcre/pcrelib/pcre_fullinfo.c
+++ b/ext/pcre/pcrelib/pcre_fullinfo.c
@@ -2,11 +2,11 @@
* Perl-Compatible Regular Expressions *
*************************************************/
-/*PCRE is a library of functions to support regular expressions whose syntax
+/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
information about a compiled pattern. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
@@ -108,8 +108,8 @@ switch (what)
case PCRE_INFO_FIRSTBYTE:
*((int *)where) =
- ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
- ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
+ ((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte :
+ ((re->flags & PCRE_STARTLINE) != 0)? -1 : -2;
break;
/* Make sure we pass back the pointer to the bit vector in the external
@@ -123,7 +123,7 @@ switch (what)
case PCRE_INFO_LASTLITERAL:
*((int *)where) =
- ((re->options & PCRE_REQCHSET) != 0)? re->req_byte : -1;
+ ((re->flags & PCRE_REQCHSET) != 0)? re->req_byte : -1;
break;
case PCRE_INFO_NAMEENTRYSIZE:
@@ -143,15 +143,15 @@ switch (what)
break;
case PCRE_INFO_OKPARTIAL:
- *((int *)where) = (re->options & PCRE_NOPARTIAL) == 0;
+ *((int *)where) = (re->flags & PCRE_NOPARTIAL) == 0;
break;
case PCRE_INFO_JCHANGED:
- *((int *)where) = (re->options & PCRE_JCHANGED) != 0;
+ *((int *)where) = (re->flags & PCRE_JCHANGED) != 0;
break;
case PCRE_INFO_HASCRORLF:
- *((int *)where) = (re->options & PCRE_HASCRORLF) != 0;
+ *((int *)where) = (re->flags & 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 898f051e8..c185c331a 100644
--- a/ext/pcre/pcrelib/pcre_get.c
+++ b/ext/pcre/pcrelib/pcre_get.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@ from the subject string after a regex match has succeeded. The original idea
for these functions came from Scott Wimer. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
@@ -187,7 +187,7 @@ const real_pcre *re = (const real_pcre *)code;
int entrysize;
char *first, *last;
uschar *entry;
-if ((re->options & (PCRE_DUPNAMES | PCRE_JCHANGED)) == 0)
+if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0)
return pcre_get_stringnumber(code, stringname);
entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);
if (entrysize <= 0) return entrysize;
diff --git a/ext/pcre/pcrelib/pcre_globals.c b/ext/pcre/pcrelib/pcre_globals.c
index a56f13aa2..aa3ef90a2 100644
--- a/ext/pcre/pcrelib/pcre_globals.c
+++ b/ext/pcre/pcrelib/pcre_globals.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@ 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 "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_info.c b/ext/pcre/pcrelib/pcre_info.c
index 6970e7953..f653d70bd 100644
--- a/ext/pcre/pcrelib/pcre_info.c
+++ b/ext/pcre/pcrelib/pcre_info.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@ 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 "config.h"
#include "pcre_internal.h"
@@ -83,8 +83,8 @@ if (re->magic_number != MAGIC_NUMBER)
}
if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS);
if (first_byte != NULL)
- *first_byte = ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
- ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
+ *first_byte = ((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte :
+ ((re->flags & PCRE_STARTLINE) != 0)? -1 : -2;
return re->top_bracket;
}
diff --git a/ext/pcre/pcrelib/pcre_internal.h b/ext/pcre/pcrelib/pcre_internal.h
index a2409f942..caf7b831d 100644
--- a/ext/pcre/pcrelib/pcre_internal.h
+++ b/ext/pcre/pcrelib/pcre_internal.h
@@ -7,7 +7,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -363,6 +363,7 @@ 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 NEXTCHAR(p) p++;
#define GETCHAR(c, eptr) c = *eptr;
#define GETCHARTEST(c, eptr) c = *eptr;
#define GETCHARINC(c, eptr) c = *eptr++;
@@ -372,6 +373,13 @@ support is omitted, we don't even define it. */
#else /* SUPPORT_UTF8 */
+/* Advance a character pointer one byte in non-UTF-8 mode and by one character
+in UTF-8 mode. */
+
+#define NEXTCHAR(p) \
+ p++; \
+ if (utf8) { while((*p & 0xc0) == 0x80) p++; }
+
/* Get the next UTF-8 character, not advancing the pointer. This is called when
we know we are in UTF-8 mode. */
@@ -481,18 +489,16 @@ Standard C system should have one. */
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
-/* Private options flags start at the most significant end of the four bytes.
-The public options defined in pcre.h start at the least significant end. Make
-sure they don't overlap! The bits are getting a bit scarce now -- when we run
-out, there is a dummy word in the structure that could be used for the private
-bits. */
+/* Private flags containing information about the compiled regex. They used to
+live at the top end of the options word, but that got almost full, so now they
+are in a 16-bit flags word. */
-#define PCRE_NOPARTIAL 0x80000000 /* can't use partial with this regex */
-#define PCRE_FIRSTSET 0x40000000 /* first_byte is set */
-#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 */
+#define PCRE_NOPARTIAL 0x0001 /* can't use partial with this regex */
+#define PCRE_FIRSTSET 0x0002 /* first_byte is set */
+#define PCRE_REQCHSET 0x0004 /* req_byte is set */
+#define PCRE_STARTLINE 0x0008 /* start after \n for multiline */
+#define PCRE_JCHANGED 0x0010 /* j option used in regex */
+#define PCRE_HASCRORLF 0x0020 /* explicit \r or \n in pattern */
/* Options for the "extra" block produced by pcre_study(). */
@@ -508,15 +514,16 @@ time, run time, or study time, respectively. */
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
- PCRE_DUPNAMES|PCRE_NEWLINE_BITS)
+ PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
#define PUBLIC_EXEC_OPTIONS \
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
- PCRE_PARTIAL|PCRE_NEWLINE_BITS)
+ PCRE_PARTIAL|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
#define PUBLIC_DFA_EXEC_OPTIONS \
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
- PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS)
+ PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS| \
+ PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */
@@ -872,7 +879,7 @@ enum { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9,
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, ERR59,
- ERR60, ERR61 };
+ ERR60, ERR61, ERR62, ERR63 };
/* 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
@@ -894,9 +901,9 @@ NOTE NOTE NOTE:
typedef struct real_pcre {
pcre_uint32 magic_number;
pcre_uint32 size; /* Total that was malloced */
- pcre_uint32 options;
- pcre_uint32 dummy1; /* For future use, maybe */
-
+ pcre_uint32 options; /* Public options */
+ pcre_uint16 flags; /* Private flags */
+ pcre_uint16 dummy1; /* For future use */
pcre_uint16 top_bracket;
pcre_uint16 top_backref;
pcre_uint16 first_byte;
@@ -935,12 +942,13 @@ typedef struct compile_data {
uschar *name_table; /* The name/number table */
int names_found; /* Number of entries so far */
int name_entry_size; /* Size of each entry */
- int bracount; /* Count of capturing parens */
+ int bracount; /* Count of capturing parens as we compile */
+ int final_bracount; /* Saved value after first pass */
int top_backref; /* Maximum back reference */
unsigned int backref_map; /* Bitmap of low back refs */
int external_options; /* External (initial) options */
+ int external_flags; /* External flag bits to be set */
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 */
@@ -1000,6 +1008,7 @@ typedef struct match_data {
BOOL notempty; /* Empty string match not wanted */
BOOL partial; /* PARTIAL flag */
BOOL hitend; /* Hit the end of the subject at some point */
+ BOOL bsr_anycrlf; /* \R is just any CRLF, not full Unicode */
const uschar *start_code; /* For use when recursing */
USPTR start_subject; /* Start of the subject string */
USPTR end_subject; /* End of the subject string */
@@ -1036,7 +1045,7 @@ typedef struct dfa_match_data {
#define ctype_letter 0x02
#define ctype_digit 0x04
#define ctype_xdigit 0x08
-#define ctype_word 0x10 /* alphameric or '_' */
+#define ctype_word 0x10 /* alphanumeric or '_' */
#define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */
/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
@@ -1064,10 +1073,12 @@ total length. */
#define tables_length (ctypes_offset + 256)
/* Layout of the UCP type table that translates property names into types and
-codes. */
+codes. Each entry used to point directly to a name, but to reduce the number of
+relocations in shared libraries, it now has an offset into a single string
+instead. */
typedef struct {
- const char *name;
+ pcre_uint16 name_offset;
pcre_uint16 type;
pcre_uint16 value;
} ucp_type_table;
@@ -1085,6 +1096,7 @@ extern const uschar _pcre_utf8_table4[];
extern const int _pcre_utf8_table1_size;
+extern const char _pcre_utt_names[];
extern const ucp_type_table _pcre_utt[];
extern const int _pcre_utt_size;
diff --git a/ext/pcre/pcrelib/pcre_maketables.c b/ext/pcre/pcrelib/pcre_maketables.c
index cba42260c..2ba612cec 100644
--- a/ext/pcre/pcrelib/pcre_maketables.c
+++ b/ext/pcre/pcrelib/pcre_maketables.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,7 @@ compilation of dftables.c, in which case the macro DFTABLES is defined. */
#ifndef DFTABLES
-# include <config.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 9725c723d..e4223cbb6 100644
--- a/ext/pcre/pcrelib/pcre_newline.c
+++ b/ext/pcre/pcrelib/pcre_newline.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@ and NLTYPE_ANY. The full list of Unicode newline characters is taken from
http://unicode.org/unicode/reports/tr18/. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_ord2utf8.c b/ext/pcre/pcrelib/pcre_ord2utf8.c
index ebb8a9d48..dfd88bcdb 100644
--- a/ext/pcre/pcrelib/pcre_ord2utf8.c
+++ b/ext/pcre/pcrelib/pcre_ord2utf8.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -41,7 +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 "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_printint.src b/ext/pcre/pcrelib/pcre_printint.src
index 90381ed96..98b42aa80 100644
--- a/ext/pcre/pcrelib/pcre_printint.src
+++ b/ext/pcre/pcrelib/pcre_printint.src
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -126,7 +126,7 @@ for (i = _pcre_utt_size - 1; i >= 0; i--)
{
if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break;
}
-return (i >= 0)? _pcre_utt[i].name : "??";
+return (i >= 0)? _pcre_utt_names + _pcre_utt[i].name_offset : "??";
#else
/* It gets harder and harder to shut off unwanted compiler warnings. */
ptype = ptype * pvalue;
diff --git a/ext/pcre/pcrelib/pcre_refcount.c b/ext/pcre/pcrelib/pcre_refcount.c
index 7d3b7981c..f31399ea2 100644
--- a/ext/pcre/pcrelib/pcre_refcount.c
+++ b/ext/pcre/pcrelib/pcre_refcount.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,7 @@ pattern data block. This might be helpful in applications where the block is
shared by different users. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_study.c b/ext/pcre/pcrelib/pcre_study.c
index 8c82d1ce6..b396d7218 100644
--- a/ext/pcre/pcrelib/pcre_study.c
+++ b/ext/pcre/pcrelib/pcre_study.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
supporting functions. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
@@ -525,7 +525,8 @@ code = (uschar *)re + re->name_table_offset +
a multiline pattern that matches only at "line starts", no further processing
at present. */
-if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
+if ((re->options & PCRE_ANCHORED) != 0 ||
+ (re->flags & (PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
return NULL;
/* Set the character tables in the block that is passed around */
diff --git a/ext/pcre/pcrelib/pcre_tables.c b/ext/pcre/pcrelib/pcre_tables.c
index 95d166975..646ddb568 100644
--- a/ext/pcre/pcrelib/pcre_tables.c
+++ b/ext/pcre/pcrelib/pcre_tables.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,7 @@ uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name
clashes with the library. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
@@ -85,115 +85,228 @@ const uschar _pcre_utf8_table4[] = {
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
-/* This table translates Unicode property names into type and code values. It
-is searched by binary chop, so must be in collating sequence of name. */
+/* The pcre_utt[] table below translates Unicode property names into type and
+code values. It is searched by binary chop, so must be in collating sequence of
+name. Originally, the table contained pointers to the name strings in the first
+field of each entry. However, that leads to a large number of relocations when
+a shared library is dynamically loaded. A significant reduction is made by
+putting all the names into a single, large string and then using offsets in the
+table itself. Maintenance is more error-prone, but frequent changes to this
+data is unlikely. */
+
+const char _pcre_utt_names[] =
+ "Any\0"
+ "Arabic\0"
+ "Armenian\0"
+ "Balinese\0"
+ "Bengali\0"
+ "Bopomofo\0"
+ "Braille\0"
+ "Buginese\0"
+ "Buhid\0"
+ "C\0"
+ "Canadian_Aboriginal\0"
+ "Cc\0"
+ "Cf\0"
+ "Cherokee\0"
+ "Cn\0"
+ "Co\0"
+ "Common\0"
+ "Coptic\0"
+ "Cs\0"
+ "Cuneiform\0"
+ "Cypriot\0"
+ "Cyrillic\0"
+ "Deseret\0"
+ "Devanagari\0"
+ "Ethiopic\0"
+ "Georgian\0"
+ "Glagolitic\0"
+ "Gothic\0"
+ "Greek\0"
+ "Gujarati\0"
+ "Gurmukhi\0"
+ "Han\0"
+ "Hangul\0"
+ "Hanunoo\0"
+ "Hebrew\0"
+ "Hiragana\0"
+ "Inherited\0"
+ "Kannada\0"
+ "Katakana\0"
+ "Kharoshthi\0"
+ "Khmer\0"
+ "L\0"
+ "L&\0"
+ "Lao\0"
+ "Latin\0"
+ "Limbu\0"
+ "Linear_B\0"
+ "Ll\0"
+ "Lm\0"
+ "Lo\0"
+ "Lt\0"
+ "Lu\0"
+ "M\0"
+ "Malayalam\0"
+ "Mc\0"
+ "Me\0"
+ "Mn\0"
+ "Mongolian\0"
+ "Myanmar\0"
+ "N\0"
+ "Nd\0"
+ "New_Tai_Lue\0"
+ "Nko\0"
+ "Nl\0"
+ "No\0"
+ "Ogham\0"
+ "Old_Italic\0"
+ "Old_Persian\0"
+ "Oriya\0"
+ "Osmanya\0"
+ "P\0"
+ "Pc\0"
+ "Pd\0"
+ "Pe\0"
+ "Pf\0"
+ "Phags_Pa\0"
+ "Phoenician\0"
+ "Pi\0"
+ "Po\0"
+ "Ps\0"
+ "Runic\0"
+ "S\0"
+ "Sc\0"
+ "Shavian\0"
+ "Sinhala\0"
+ "Sk\0"
+ "Sm\0"
+ "So\0"
+ "Syloti_Nagri\0"
+ "Syriac\0"
+ "Tagalog\0"
+ "Tagbanwa\0"
+ "Tai_Le\0"
+ "Tamil\0"
+ "Telugu\0"
+ "Thaana\0"
+ "Thai\0"
+ "Tibetan\0"
+ "Tifinagh\0"
+ "Ugaritic\0"
+ "Yi\0"
+ "Z\0"
+ "Zl\0"
+ "Zp\0"
+ "Zs\0";
const ucp_type_table _pcre_utt[] = {
- { "Any", PT_ANY, 0 },
- { "Arabic", PT_SC, ucp_Arabic },
- { "Armenian", PT_SC, ucp_Armenian },
- { "Balinese", PT_SC, ucp_Balinese },
- { "Bengali", PT_SC, ucp_Bengali },
- { "Bopomofo", PT_SC, ucp_Bopomofo },
- { "Braille", PT_SC, ucp_Braille },
- { "Buginese", PT_SC, ucp_Buginese },
- { "Buhid", PT_SC, ucp_Buhid },
- { "C", PT_GC, ucp_C },
- { "Canadian_Aboriginal", PT_SC, ucp_Canadian_Aboriginal },
- { "Cc", PT_PC, ucp_Cc },
- { "Cf", PT_PC, ucp_Cf },
- { "Cherokee", PT_SC, ucp_Cherokee },
- { "Cn", PT_PC, ucp_Cn },
- { "Co", PT_PC, ucp_Co },
- { "Common", PT_SC, ucp_Common },
- { "Coptic", PT_SC, ucp_Coptic },
- { "Cs", PT_PC, ucp_Cs },
- { "Cuneiform", PT_SC, ucp_Cuneiform },
- { "Cypriot", PT_SC, ucp_Cypriot },
- { "Cyrillic", PT_SC, ucp_Cyrillic },
- { "Deseret", PT_SC, ucp_Deseret },
- { "Devanagari", PT_SC, ucp_Devanagari },
- { "Ethiopic", PT_SC, ucp_Ethiopic },
- { "Georgian", PT_SC, ucp_Georgian },
- { "Glagolitic", PT_SC, ucp_Glagolitic },
- { "Gothic", PT_SC, ucp_Gothic },
- { "Greek", PT_SC, ucp_Greek },
- { "Gujarati", PT_SC, ucp_Gujarati },
- { "Gurmukhi", PT_SC, ucp_Gurmukhi },
- { "Han", PT_SC, ucp_Han },
- { "Hangul", PT_SC, ucp_Hangul },
- { "Hanunoo", PT_SC, ucp_Hanunoo },
- { "Hebrew", PT_SC, ucp_Hebrew },
- { "Hiragana", PT_SC, ucp_Hiragana },
- { "Inherited", PT_SC, ucp_Inherited },
- { "Kannada", PT_SC, ucp_Kannada },
- { "Katakana", PT_SC, ucp_Katakana },
- { "Kharoshthi", PT_SC, ucp_Kharoshthi },
- { "Khmer", PT_SC, ucp_Khmer },
- { "L", PT_GC, ucp_L },
- { "L&", PT_LAMP, 0 },
- { "Lao", PT_SC, ucp_Lao },
- { "Latin", PT_SC, ucp_Latin },
- { "Limbu", PT_SC, ucp_Limbu },
- { "Linear_B", PT_SC, ucp_Linear_B },
- { "Ll", PT_PC, ucp_Ll },
- { "Lm", PT_PC, ucp_Lm },
- { "Lo", PT_PC, ucp_Lo },
- { "Lt", PT_PC, ucp_Lt },
- { "Lu", PT_PC, ucp_Lu },
- { "M", PT_GC, ucp_M },
- { "Malayalam", PT_SC, ucp_Malayalam },
- { "Mc", PT_PC, ucp_Mc },
- { "Me", PT_PC, ucp_Me },
- { "Mn", PT_PC, ucp_Mn },
- { "Mongolian", PT_SC, ucp_Mongolian },
- { "Myanmar", PT_SC, ucp_Myanmar },
- { "N", PT_GC, ucp_N },
- { "Nd", PT_PC, ucp_Nd },
- { "New_Tai_Lue", PT_SC, ucp_New_Tai_Lue },
- { "Nko", PT_SC, ucp_Nko },
- { "Nl", PT_PC, ucp_Nl },
- { "No", PT_PC, ucp_No },
- { "Ogham", PT_SC, ucp_Ogham },
- { "Old_Italic", PT_SC, ucp_Old_Italic },
- { "Old_Persian", PT_SC, ucp_Old_Persian },
- { "Oriya", PT_SC, ucp_Oriya },
- { "Osmanya", PT_SC, ucp_Osmanya },
- { "P", PT_GC, ucp_P },
- { "Pc", PT_PC, ucp_Pc },
- { "Pd", PT_PC, ucp_Pd },
- { "Pe", PT_PC, ucp_Pe },
- { "Pf", PT_PC, ucp_Pf },
- { "Phags_Pa", PT_SC, ucp_Phags_Pa },
- { "Phoenician", PT_SC, ucp_Phoenician },
- { "Pi", PT_PC, ucp_Pi },
- { "Po", PT_PC, ucp_Po },
- { "Ps", PT_PC, ucp_Ps },
- { "Runic", PT_SC, ucp_Runic },
- { "S", PT_GC, ucp_S },
- { "Sc", PT_PC, ucp_Sc },
- { "Shavian", PT_SC, ucp_Shavian },
- { "Sinhala", PT_SC, ucp_Sinhala },
- { "Sk", PT_PC, ucp_Sk },
- { "Sm", PT_PC, ucp_Sm },
- { "So", PT_PC, ucp_So },
- { "Syloti_Nagri", PT_SC, ucp_Syloti_Nagri },
- { "Syriac", PT_SC, ucp_Syriac },
- { "Tagalog", PT_SC, ucp_Tagalog },
- { "Tagbanwa", PT_SC, ucp_Tagbanwa },
- { "Tai_Le", PT_SC, ucp_Tai_Le },
- { "Tamil", PT_SC, ucp_Tamil },
- { "Telugu", PT_SC, ucp_Telugu },
- { "Thaana", PT_SC, ucp_Thaana },
- { "Thai", PT_SC, ucp_Thai },
- { "Tibetan", PT_SC, ucp_Tibetan },
- { "Tifinagh", PT_SC, ucp_Tifinagh },
- { "Ugaritic", PT_SC, ucp_Ugaritic },
- { "Yi", PT_SC, ucp_Yi },
- { "Z", PT_GC, ucp_Z },
- { "Zl", PT_PC, ucp_Zl },
- { "Zp", PT_PC, ucp_Zp },
- { "Zs", PT_PC, ucp_Zs }
+ { 0, PT_ANY, 0 },
+ { 4, PT_SC, ucp_Arabic },
+ { 11, PT_SC, ucp_Armenian },
+ { 20, PT_SC, ucp_Balinese },
+ { 29, PT_SC, ucp_Bengali },
+ { 37, PT_SC, ucp_Bopomofo },
+ { 46, PT_SC, ucp_Braille },
+ { 54, PT_SC, ucp_Buginese },
+ { 63, PT_SC, ucp_Buhid },
+ { 69, PT_GC, ucp_C },
+ { 71, PT_SC, ucp_Canadian_Aboriginal },
+ { 91, PT_PC, ucp_Cc },
+ { 94, PT_PC, ucp_Cf },
+ { 97, PT_SC, ucp_Cherokee },
+ { 106, PT_PC, ucp_Cn },
+ { 109, PT_PC, ucp_Co },
+ { 112, PT_SC, ucp_Common },
+ { 119, PT_SC, ucp_Coptic },
+ { 126, PT_PC, ucp_Cs },
+ { 129, PT_SC, ucp_Cuneiform },
+ { 139, PT_SC, ucp_Cypriot },
+ { 147, PT_SC, ucp_Cyrillic },
+ { 156, PT_SC, ucp_Deseret },
+ { 164, PT_SC, ucp_Devanagari },
+ { 175, PT_SC, ucp_Ethiopic },
+ { 184, PT_SC, ucp_Georgian },
+ { 193, PT_SC, ucp_Glagolitic },
+ { 204, PT_SC, ucp_Gothic },
+ { 211, PT_SC, ucp_Greek },
+ { 217, PT_SC, ucp_Gujarati },
+ { 226, PT_SC, ucp_Gurmukhi },
+ { 235, PT_SC, ucp_Han },
+ { 239, PT_SC, ucp_Hangul },
+ { 246, PT_SC, ucp_Hanunoo },
+ { 254, PT_SC, ucp_Hebrew },
+ { 261, PT_SC, ucp_Hiragana },
+ { 270, PT_SC, ucp_Inherited },
+ { 280, PT_SC, ucp_Kannada },
+ { 288, PT_SC, ucp_Katakana },
+ { 297, PT_SC, ucp_Kharoshthi },
+ { 308, PT_SC, ucp_Khmer },
+ { 314, PT_GC, ucp_L },
+ { 316, PT_LAMP, 0 },
+ { 319, PT_SC, ucp_Lao },
+ { 323, PT_SC, ucp_Latin },
+ { 329, PT_SC, ucp_Limbu },
+ { 335, PT_SC, ucp_Linear_B },
+ { 344, PT_PC, ucp_Ll },
+ { 347, PT_PC, ucp_Lm },
+ { 350, PT_PC, ucp_Lo },
+ { 353, PT_PC, ucp_Lt },
+ { 356, PT_PC, ucp_Lu },
+ { 359, PT_GC, ucp_M },
+ { 361, PT_SC, ucp_Malayalam },
+ { 371, PT_PC, ucp_Mc },
+ { 374, PT_PC, ucp_Me },
+ { 377, PT_PC, ucp_Mn },
+ { 380, PT_SC, ucp_Mongolian },
+ { 390, PT_SC, ucp_Myanmar },
+ { 398, PT_GC, ucp_N },
+ { 400, PT_PC, ucp_Nd },
+ { 403, PT_SC, ucp_New_Tai_Lue },
+ { 415, PT_SC, ucp_Nko },
+ { 419, PT_PC, ucp_Nl },
+ { 422, PT_PC, ucp_No },
+ { 425, PT_SC, ucp_Ogham },
+ { 431, PT_SC, ucp_Old_Italic },
+ { 442, PT_SC, ucp_Old_Persian },
+ { 454, PT_SC, ucp_Oriya },
+ { 460, PT_SC, ucp_Osmanya },
+ { 468, PT_GC, ucp_P },
+ { 470, PT_PC, ucp_Pc },
+ { 473, PT_PC, ucp_Pd },
+ { 476, PT_PC, ucp_Pe },
+ { 479, PT_PC, ucp_Pf },
+ { 482, PT_SC, ucp_Phags_Pa },
+ { 491, PT_SC, ucp_Phoenician },
+ { 502, PT_PC, ucp_Pi },
+ { 505, PT_PC, ucp_Po },
+ { 508, PT_PC, ucp_Ps },
+ { 511, PT_SC, ucp_Runic },
+ { 517, PT_GC, ucp_S },
+ { 519, PT_PC, ucp_Sc },
+ { 522, PT_SC, ucp_Shavian },
+ { 530, PT_SC, ucp_Sinhala },
+ { 538, PT_PC, ucp_Sk },
+ { 541, PT_PC, ucp_Sm },
+ { 544, PT_PC, ucp_So },
+ { 547, PT_SC, ucp_Syloti_Nagri },
+ { 560, PT_SC, ucp_Syriac },
+ { 567, PT_SC, ucp_Tagalog },
+ { 575, PT_SC, ucp_Tagbanwa },
+ { 584, PT_SC, ucp_Tai_Le },
+ { 591, PT_SC, ucp_Tamil },
+ { 597, PT_SC, ucp_Telugu },
+ { 604, PT_SC, ucp_Thaana },
+ { 611, PT_SC, ucp_Thai },
+ { 616, PT_SC, ucp_Tibetan },
+ { 624, PT_SC, ucp_Tifinagh },
+ { 633, PT_SC, ucp_Ugaritic },
+ { 642, PT_SC, ucp_Yi },
+ { 645, PT_GC, ucp_Z },
+ { 647, PT_PC, ucp_Zl },
+ { 650, PT_PC, ucp_Zp },
+ { 653, PT_PC, ucp_Zs }
};
const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
diff --git a/ext/pcre/pcrelib/pcre_try_flipped.c b/ext/pcre/pcrelib/pcre_try_flipped.c
index cd7d21ecc..5e67943cc 100644
--- a/ext/pcre/pcrelib/pcre_try_flipped.c
+++ b/ext/pcre/pcrelib/pcre_try_flipped.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@ 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 "config.h"
#include "pcre_internal.h"
@@ -106,6 +106,7 @@ if (byteflip(re->magic_number, sizeof(re->magic_number)) != MAGIC_NUMBER)
*internal_re = *re; /* To copy other fields */
internal_re->size = byteflip(re->size, sizeof(re->size));
internal_re->options = byteflip(re->options, sizeof(re->options));
+internal_re->flags = (pcre_uint16)byteflip(re->flags, sizeof(re->flags));
internal_re->top_bracket =
(pcre_uint16)byteflip(re->top_bracket, sizeof(re->top_bracket));
internal_re->top_backref =
diff --git a/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c b/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c
index 95d42cf7c..668ae154d 100644
--- a/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c
+++ b/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* This module contains code for searching the table of Unicode character
properties. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_valid_utf8.c b/ext/pcre/pcrelib/pcre_valid_utf8.c
index 223e74085..6b341c195 100644
--- a/ext/pcre/pcrelib/pcre_valid_utf8.c
+++ b/ext/pcre/pcrelib/pcre_valid_utf8.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
strings. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
@@ -60,7 +60,7 @@ 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
+obsoletes 2279), additional restrictions were applied. 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.
diff --git a/ext/pcre/pcrelib/pcre_version.c b/ext/pcre/pcrelib/pcre_version.c
index 865453d9b..36ee93e71 100644
--- a/ext/pcre/pcrelib/pcre_version.c
+++ b/ext/pcre/pcrelib/pcre_version.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
string that identifies the PCRE version that is in use. */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_xclass.c b/ext/pcre/pcrelib/pcre_xclass.c
index db5331b63..d22d9e648 100644
--- a/ext/pcre/pcrelib/pcre_xclass.c
+++ b/ext/pcre/pcrelib/pcre_xclass.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@ class (one that contains characters whose values are > 255). It is used by both
pcre_exec() and pcre_def_exec(). */
-#include <config.h>
+#include "config.h"
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcredemo.c b/ext/pcre/pcrelib/pcredemo.c
index 4068e3e04..364756876 100644
--- a/ext/pcre/pcrelib/pcredemo.c
+++ b/ext/pcre/pcrelib/pcredemo.c
@@ -4,9 +4,11 @@
/* This is a demonstration program to illustrate the most straightforward ways
of calling the PCRE regular expression library from a C program. See the
-pcresample documentation for a short discussion.
+pcresample documentation for a short discussion ("man pcresample" if you have
+the PCRE man pages installed).
+
+In Unix-like environments, compile this program thuswise:
-Compile thuswise:
gcc -Wall pcredemo.c -I/usr/local/include -L/usr/local/lib \
-R/usr/local/lib -lpcre
@@ -14,8 +16,15 @@ Replace "/usr/local/include" and "/usr/local/lib" with wherever the include and
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.
-*/
+Building under Windows:
+
+If you want to statically link this program against a non-dll .a file, you must
+define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc() and
+pcre_free() exported functions will be declared __declspec(dllimport), with
+unwanted results. So in this environment, uncomment the following line. */
+
+/* #define PCRE_STATIC */
#include <stdio.h>
#include <string.h>
@@ -129,8 +138,8 @@ printf("\nMatch succeeded at offset %d\n", ovector[0]);
/*************************************************************************
* We have found the first match within the subject string. If the output *
-* vector wasn't big enough, set its size to the maximum. Then output any *
-* substrings that were captured. *
+* vector wasn't big enough, say so. Then output any substrings that were *
+* captured. *
*************************************************************************/
/* The output vector wasn't big enough */
@@ -155,7 +164,7 @@ for (i = 0; i < rc; i++)
/**************************************************************************
* That concludes the basic part of this demonstration program. We have *
* compiled a pattern, and performed a single match. The code that follows *
-* first shows how to access named substrings, and then how to code for *
+* shows first how to access named substrings, and then how to code for *
* repeated matches on the same subject. *
**************************************************************************/
diff --git a/ext/pcre/pcrelib/pcregrep.c b/ext/pcre/pcrelib/pcregrep.c
index 29338d159..f192f0c0c 100644
--- a/ext/pcre/pcrelib/pcregrep.c
+++ b/ext/pcre/pcrelib/pcregrep.c
@@ -6,7 +6,7 @@
its pattern matching. On a Unix or Win32 system it can recurse into
directories.
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
-#include <config.h>
+#include "config.h"
#include <ctype.h>
#include <locale.h>
@@ -53,7 +53,15 @@ POSSIBILITY OF SUCH DAMAGE.
#include <unistd.h>
#endif
-#include <pcre.h>
+#ifdef SUPPORT_LIBZ
+#include <zlib.h>
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+#include <bzlib.h>
+#endif
+
+#include "pcre.h"
#define FALSE 0
#define TRUE 1
@@ -74,6 +82,10 @@ all values greater than FN_DEFAULT. */
enum { FN_NONE, FN_DEFAULT, FN_ONLY, FN_NOMATCH_ONLY, FN_FORCE };
+/* File reading styles */
+
+enum { FR_PLAIN, FR_LIBZ, FR_LIBBZ2 };
+
/* Actions for the -d and -D options */
enum { dee_READ, dee_SKIP, dee_RECURSE };
@@ -140,8 +152,10 @@ static int process_options = 0;
static BOOL count_only = FALSE;
static BOOL do_colour = FALSE;
+static BOOL file_offsets = FALSE;
static BOOL hyphenpending = FALSE;
static BOOL invert = FALSE;
+static BOOL line_offsets = FALSE;
static BOOL multiline = FALSE;
static BOOL number = FALSE;
static BOOL only_matching = FALSE;
@@ -172,6 +186,8 @@ used to identify them. */
#define N_LABEL (-5)
#define N_LOCALE (-6)
#define N_NULL (-7)
+#define N_LOFFSETS (-8)
+#define N_FOFFSETS (-9)
static option_item optionlist[] = {
{ OP_NODATA, N_NULL, NULL, "", " terminate options" },
@@ -187,15 +203,17 @@ static option_item optionlist[] = {
{ OP_PATLIST, 'e', NULL, "regex(p)", "specify pattern (may be used more than once)" },
{ OP_NODATA, 'F', NULL, "fixed_strings", "patterns are sets of newline-separated strings" },
{ OP_STRING, 'f', &pattern_filename, "file=path", "read patterns from file" },
+ { OP_NODATA, N_FOFFSETS, NULL, "file-offsets", "output file offsets, not text" },
{ OP_NODATA, 'H', NULL, "with-filename", "force the prefixing filename on output" },
{ OP_NODATA, 'h', NULL, "no-filename", "suppress the prefixing filename on output" },
{ OP_NODATA, 'i', NULL, "ignore-case", "ignore case distinctions" },
{ OP_NODATA, 'l', NULL, "files-with-matches", "print only FILE names containing matches" },
{ OP_NODATA, 'L', NULL, "files-without-match","print only FILE names not containing matches" },
{ OP_STRING, N_LABEL, &stdin_name, "label=name", "set name for standard input" },
+ { OP_NODATA, N_LOFFSETS, NULL, "line-offsets", "output line numbers and offsets, not text" },
{ OP_STRING, N_LOCALE, &locale, "locale=locale", "use the named locale" },
{ OP_NODATA, 'M', NULL, "multiline", "run in multiline mode" },
- { OP_STRING, 'N', &newline, "newline=type", "specify newline type (CR, LF, CRLF, ANYCRLF or ANY)" },
+ { OP_STRING, 'N', &newline, "newline=type", "set newline type (CR, LF, CRLF, ANYCRLF or ANY)" },
{ OP_NODATA, 'n', NULL, "line-number", "print line number with output lines" },
{ OP_NODATA, 'o', NULL, "only-matching", "show only the part of the line that matched" },
{ OP_NODATA, 'q', NULL, "quiet", "suppress output, just set return code" },
@@ -314,8 +332,9 @@ return isatty(fileno(stdout));
/* I (Philip Hazel) have no means of testing this code. It was contributed by
Lionel Fourquaux. David Burgess added a patch to define INVALID_FILE_ATTRIBUTES
-when it did not exist. */
-
+when it did not exist. David Byron added a patch that moved the #include of
+<windows.h> to before the INVALID_FILE_ATTRIBUTES definition rather than after.
+*/
#elif HAVE_WINDOWS_H
@@ -325,12 +344,13 @@ when it did not exist. */
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
+
+#include <windows.h>
+
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
#endif
-#include <windows.h>
-
typedef struct directory_type
{
HANDLE handle;
@@ -415,7 +435,7 @@ regular if they are not directories. */
int isregfile(char *filename)
{
-return !isdirectory(filename)
+return !isdirectory(filename);
}
@@ -426,7 +446,7 @@ return !isdirectory(filename)
static BOOL
is_stdout_tty(void)
{
-FALSE;
+return FALSE;
}
@@ -802,22 +822,27 @@ be in the middle third most of the time, so the bottom third is available for
"before" context printing.
Arguments:
- in the fopened FILE stream
+ handle the fopened FILE stream for a normal file
+ the gzFile pointer when reading is via libz
+ the BZFILE pointer when reading is via libbz2
+ frtype FR_PLAIN, FR_LIBZ, or FR_LIBBZ2
printname the file name if it is to be printed for each match
or NULL if the file name is not to be printed
it cannot be NULL if filenames[_nomatch]_only is set
Returns: 0 if there was at least one match
1 otherwise (no matches)
+ 2 if there is a read error on a .bz2 file
*/
static int
-pcregrep(FILE *in, char *printname)
+pcregrep(void *handle, int frtype, char *printname)
{
int rc = 1;
int linenumber = 1;
int lastmatchnumber = 0;
int count = 0;
+int filepos = 0;
int offsets[99];
char *lastmatchrestart = NULL;
char buffer[3*MBUFTHIRD];
@@ -825,11 +850,46 @@ char *ptr = buffer;
char *endptr;
size_t bufflength;
BOOL endhyphenpending = FALSE;
+FILE *in = NULL; /* Ensure initialized */
+
+#ifdef SUPPORT_LIBZ
+gzFile ingz = NULL;
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+BZFILE *inbz2 = NULL;
+#endif
-/* Do the first read into the start of the buffer and set up the pointer to
-end of what we have. */
-bufflength = fread(buffer, 1, 3*MBUFTHIRD, in);
+/* Do the first read into the start of the buffer and set up the pointer to end
+of what we have. In the case of libz, a non-zipped .gz file will be read as a
+plain file. However, if a .bz2 file isn't actually bzipped, the first read will
+fail. */
+
+#ifdef SUPPORT_LIBZ
+if (frtype == FR_LIBZ)
+ {
+ ingz = (gzFile)handle;
+ bufflength = gzread (ingz, buffer, 3*MBUFTHIRD);
+ }
+else
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+if (frtype == FR_LIBBZ2)
+ {
+ inbz2 = (BZFILE *)handle;
+ bufflength = BZ2_bzread(inbz2, buffer, 3*MBUFTHIRD);
+ if ((int)bufflength < 0) return 2; /* Gotcha: bufflength is size_t; */
+ } /* without the cast it is unsigned. */
+else
+#endif
+
+ {
+ in = (FILE *)handle;
+ bufflength = fread(buffer, 1, 3*MBUFTHIRD, in);
+ }
+
endptr = buffer + bufflength;
/* Loop while the current pointer is not at the end of the file. For large
@@ -842,6 +902,7 @@ while (ptr < endptr)
int i, endlinelength;
int mrc = 0;
BOOL match = FALSE;
+ char *matchptr = ptr;
char *t = ptr;
size_t length, linelength;
@@ -904,13 +965,17 @@ while (ptr < endptr)
}
#endif
+ /* We come back here after a match when the -o option (only_matching) is set,
+ in order to find any further matches in the same line. */
+
+ ONLY_MATCHING_RESTART:
/* Run through all the patterns until one matches. Note that we don't include
the final newline in the subject string. */
for (i = 0; i < pattern_count; i++)
{
- mrc = pcre_exec(pattern_list[i], hints_list[i], ptr, length, 0, 0,
+ mrc = pcre_exec(pattern_list[i], hints_list[i], matchptr, length, 0, 0,
offsets, 99);
if (mrc >= 0) { match = TRUE; break; }
if (mrc != PCRE_ERROR_NOMATCH)
@@ -918,7 +983,7 @@ while (ptr < endptr)
fprintf(stderr, "pcregrep: pcre_exec() error %d while matching ", mrc);
if (pattern_count > 1) fprintf(stderr, "pattern number %d to ", i+1);
fprintf(stderr, "this line:\n");
- fwrite(ptr, 1, linelength, stderr); /* In case binary zero included */
+ fwrite(matchptr, 1, linelength, stderr); /* In case binary zero included */
fprintf(stderr, "\n");
if (error_count == 0 &&
(mrc == PCRE_ERROR_MATCHLIMIT || mrc == PCRE_ERROR_RECURSIONLIMIT))
@@ -965,14 +1030,33 @@ while (ptr < endptr)
else if (quiet) return 0;
/* The --only-matching option prints just the substring that matched, and
- does not pring any context. */
+ the --file-offsets and --line-offsets options output offsets for the
+ matching substring (they both force --only-matching). None of these options
+ prints any context. Afterwards, adjust the start and length, and then jump
+ back to look for further matches in the same line. If we are in invert
+ mode, however, nothing is printed - this could be still useful because the
+ return code is set. */
else if (only_matching)
{
- if (printname != NULL) fprintf(stdout, "%s:", printname);
- if (number) fprintf(stdout, "%d:", linenumber);
- fwrite(ptr + offsets[0], 1, offsets[1] - offsets[0], stdout);
- fprintf(stdout, "\n");
+ if (!invert)
+ {
+ if (printname != NULL) fprintf(stdout, "%s:", printname);
+ if (number) fprintf(stdout, "%d:", linenumber);
+ if (line_offsets)
+ fprintf(stdout, "%d,%d", matchptr + offsets[0] - ptr,
+ offsets[1] - offsets[0]);
+ else if (file_offsets)
+ fprintf(stdout, "%d,%d", filepos + matchptr + offsets[0] - ptr,
+ offsets[1] - offsets[0]);
+ else
+ fwrite(matchptr + offsets[0], 1, offsets[1] - offsets[0], stdout);
+ fprintf(stdout, "\n");
+ matchptr += offsets[1];
+ length -= offsets[1];
+ match = FALSE;
+ goto ONLY_MATCHING_RESTART;
+ }
}
/* This is the default case when none of the above options is set. We print
@@ -1111,7 +1195,8 @@ while (ptr < endptr)
fprintf(stdout, "%c[%sm", 0x1b, colour_string);
fwrite(ptr + offsets[0], 1, offsets[1] - offsets[0], stdout);
fprintf(stdout, "%c[00m", 0x1b);
- fwrite(ptr + offsets[1], 1, linelength - offsets[1], stdout);
+ fwrite(ptr + offsets[1], 1, (linelength + endlinelength) - offsets[1],
+ stdout);
}
else fwrite(ptr, 1, linelength + endlinelength, stdout);
}
@@ -1145,9 +1230,11 @@ while (ptr < endptr)
linelength = endmatch - ptr - ellength;
}
- /* Advance to after the newline and increment the line number. */
+ /* Advance to after the newline and increment the line number. The file
+ offset to the current line is maintained in filepos. */
ptr += linelength + endlinelength;
+ filepos += linelength + endlinelength;
linenumber++;
/* If we haven't yet reached the end of the file (the buffer is full), and
@@ -1169,7 +1256,23 @@ while (ptr < endptr)
memmove(buffer, buffer + MBUFTHIRD, 2*MBUFTHIRD);
ptr -= MBUFTHIRD;
+
+#ifdef SUPPORT_LIBZ
+ if (frtype == FR_LIBZ)
+ bufflength = 2*MBUFTHIRD +
+ gzread (ingz, buffer + 2*MBUFTHIRD, MBUFTHIRD);
+ else
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+ if (frtype == FR_LIBBZ2)
+ bufflength = 2*MBUFTHIRD +
+ BZ2_bzread(inbz2, buffer + 2*MBUFTHIRD, MBUFTHIRD);
+ else
+#endif
+
bufflength = 2*MBUFTHIRD + fread(buffer + 2*MBUFTHIRD, 1, MBUFTHIRD, in);
+
endptr = buffer + bufflength;
/* Adjust any last match point */
@@ -1233,18 +1336,28 @@ grep_or_recurse(char *pathname, BOOL dir_recurse, BOOL only_one_at_top)
{
int rc = 1;
int sep;
-FILE *in;
+int frtype;
+int pathlen;
+void *handle;
+FILE *in = NULL; /* Ensure initialized */
+
+#ifdef SUPPORT_LIBZ
+gzFile ingz = NULL;
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+BZFILE *inbz2 = NULL;
+#endif
/* If the file name is "-" we scan stdin */
if (strcmp(pathname, "-") == 0)
{
- return pcregrep(stdin,
+ return pcregrep(stdin, FR_PLAIN,
(filenames > FN_DEFAULT || (filenames == FN_DEFAULT && !only_one_at_top))?
stdin_name : NULL);
}
-
/* If the file is a directory, skip if skipping or if we are recursing, scan
each file within it, subject to any include or exclude patterns that were set.
The scanning code is localized so it can be made system-specific. */
@@ -1301,8 +1414,54 @@ skipping was not requested. The scan proceeds. If this is the first and only
argument at top level, we don't show the file name, unless we are only showing
the file name, or the filename was forced (-H). */
-in = fopen(pathname, "r");
-if (in == NULL)
+pathlen = strlen(pathname);
+
+/* Open using zlib if it is supported and the file name ends with .gz. */
+
+#ifdef SUPPORT_LIBZ
+if (pathlen > 3 && strcmp(pathname + pathlen - 3, ".gz") == 0)
+ {
+ ingz = gzopen(pathname, "rb");
+ if (ingz == NULL)
+ {
+ if (!silent)
+ fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pathname,
+ strerror(errno));
+ return 2;
+ }
+ handle = (void *)ingz;
+ frtype = FR_LIBZ;
+ }
+else
+#endif
+
+/* Otherwise open with bz2lib if it is supported and the name ends with .bz2. */
+
+#ifdef SUPPORT_LIBBZ2
+if (pathlen > 4 && strcmp(pathname + pathlen - 4, ".bz2") == 0)
+ {
+ inbz2 = BZ2_bzopen(pathname, "rb");
+ handle = (void *)inbz2;
+ frtype = FR_LIBBZ2;
+ }
+else
+#endif
+
+/* Otherwise use plain fopen(). The label is so that we can come back here if
+an attempt to read a .bz2 file indicates that it really is a plain file. */
+
+#ifdef SUPPORT_LIBBZ2
+PLAIN_FILE:
+#endif
+ {
+ in = fopen(pathname, "r");
+ handle = (void *)in;
+ frtype = FR_PLAIN;
+ }
+
+/* All the opening methods return errno when they fail. */
+
+if (handle == NULL)
{
if (!silent)
fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pathname,
@@ -1310,10 +1469,50 @@ if (in == NULL)
return 2;
}
-rc = pcregrep(in, (filenames > FN_DEFAULT ||
+/* Now grep the file */
+
+rc = pcregrep(handle, frtype, (filenames > FN_DEFAULT ||
(filenames == FN_DEFAULT && !only_one_at_top))? pathname : NULL);
+/* Close in an appropriate manner. */
+
+#ifdef SUPPORT_LIBZ
+if (frtype == FR_LIBZ)
+ gzclose(ingz);
+else
+#endif
+
+/* If it is a .bz2 file and the result is 2, it means that the first attempt to
+read failed. If the error indicates that the file isn't in fact bzipped, try
+again as a normal file. */
+
+#ifdef SUPPORT_LIBBZ2
+if (frtype == FR_LIBBZ2)
+ {
+ if (rc == 2)
+ {
+ int errnum;
+ const char *err = BZ2_bzerror(inbz2, &errnum);
+ if (errnum == BZ_DATA_ERROR_MAGIC)
+ {
+ BZ2_bzclose(inbz2);
+ goto PLAIN_FILE;
+ }
+ else if (!silent)
+ fprintf(stderr, "pcregrep: Failed to read %s using bzlib: %s\n",
+ pathname, err);
+ }
+ BZ2_bzclose(inbz2);
+ }
+else
+#endif
+
+/* Normal file close */
+
fclose(in);
+
+/* Pass back the yield from pcregrep(). */
+
return rc;
}
@@ -1334,7 +1533,8 @@ for (op = optionlist; op->one_char != 0; op++)
if (op->one_char > 0) fprintf(stderr, "%c", op->one_char);
}
fprintf(stderr, "] [long options] [pattern] [files]\n");
-fprintf(stderr, "Type `pcregrep --help' for more information.\n");
+fprintf(stderr, "Type `pcregrep --help' for more information and the long "
+ "options.\n");
return rc;
}
@@ -1353,9 +1553,23 @@ option_item *op;
printf("Usage: pcregrep [OPTION]... [PATTERN] [FILE1 FILE2 ...]\n");
printf("Search for PATTERN in each FILE or standard input.\n");
printf("PATTERN must be present if neither -e nor -f is used.\n");
-printf("\"-\" can be used as a file name to mean STDIN.\n\n");
-printf("Example: pcregrep -i 'hello.*world' menu.h main.c\n\n");
+printf("\"-\" can be used as a file name to mean STDIN.\n");
+
+#ifdef SUPPORT_LIBZ
+printf("Files whose names end in .gz are read using zlib.\n");
+#endif
+
+#ifdef SUPPORT_LIBBZ2
+printf("Files whose names end in .bz2 are read using bzlib2.\n");
+#endif
+#if defined SUPPORT_LIBZ || defined SUPPORT_LIBBZ2
+printf("Other files and the standard input are read as plain files.\n\n");
+#else
+printf("All files are read as plain files, without any interpretation.\n\n");
+#endif
+
+printf("Example: pcregrep -i 'hello.*world' menu.h main.c\n\n");
printf("Options:\n");
for (op = optionlist; op->one_char != 0; op++)
@@ -1363,8 +1577,7 @@ for (op = optionlist; op->one_char != 0; op++)
int n;
char s[4];
if (op->one_char > 0) sprintf(s, "-%c,", op->one_char); else strcpy(s, " ");
- printf(" %s --%s%n", s, op->long_name, &n);
- n = 30 - n;
+ n = 30 - printf(" %s --%s", s, op->long_name);
if (n < 1) n = 1;
printf("%.*s%s\n", n, " ", op->help_text);
}
@@ -1389,7 +1602,9 @@ handle_option(int letter, int options)
{
switch(letter)
{
+ case N_FOFFSETS: file_offsets = TRUE; break;
case N_HELP: help(); exit(0);
+ case N_LOFFSETS: line_offsets = number = TRUE; break;
case 'c': count_only = TRUE; break;
case 'F': process_options |= PO_FIXED_STRINGS; break;
case 'H': filenames = FN_FORCE; break;
@@ -1826,6 +2041,19 @@ if (both_context > 0)
if (before_context == 0) before_context = both_context;
}
+/* Only one of --only-matching, --file-offsets, or --line-offsets is permitted.
+However, the latter two set the only_matching flag. */
+
+if ((only_matching && (file_offsets || line_offsets)) ||
+ (file_offsets && line_offsets))
+ {
+ fprintf(stderr, "pcregrep: Cannot mix --only-matching, --file-offsets "
+ "and/or --line-offsets\n");
+ exit(usage(2));
+ }
+
+if (file_offsets || line_offsets) only_matching = TRUE;
+
/* If a locale has not been provided as an option, see if the LC_CTYPE or
LC_ALL environment variable is set, and if so, use it. */
@@ -2063,7 +2291,7 @@ if (include_pattern != NULL)
if (i >= argc)
{
- rc = pcregrep(stdin, (filenames > FN_DEFAULT)? stdin_name : NULL);
+ rc = pcregrep(stdin, FR_PLAIN, (filenames > FN_DEFAULT)? stdin_name : NULL);
goto EXIT;
}
diff --git a/ext/pcre/pcrelib/pcreposix.c b/ext/pcre/pcrelib/pcreposix.c
index 9c0adebb9..4cb5e12a1 100644
--- a/ext/pcre/pcrelib/pcreposix.c
+++ b/ext/pcre/pcrelib/pcreposix.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
functions. */
-#include <config.h>
+#include "config.h"
/* Ensure that the PCREPOSIX_EXP_xxx macros are set appropriately for
@@ -55,12 +55,11 @@ previously been set. */
# define PCREPOSIX_EXP_DEFN __declspec(dllexport)
#endif
-#include <pcre.h>
+#include "pcre.h"
#include "pcre_internal.h"
#include "pcreposix.h"
-
/* Table to translate PCRE compile time error codes into POSIX error codes. */
static const int eint[] = {
@@ -123,7 +122,9 @@ static const int eint[] = {
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 /* number is too big */
+ REG_BADPAT, /* number is too big */
+ REG_BADPAT, /* subpattern name expected */
+ REG_BADPAT /* digit expected after (?+ */
};
/* Table of texts corresponding to POSIX error codes */
diff --git a/ext/pcre/pcrelib/pcreposix.h b/ext/pcre/pcrelib/pcreposix.h
index 875e1ff18..109376d90 100644
--- a/ext/pcre/pcrelib/pcreposix.h
+++ b/ext/pcre/pcrelib/pcreposix.h
@@ -9,7 +9,7 @@
Compatible Regular Expression library. It defines the things POSIX says should
be there. I hope.
- Copyright (c) 1997-2007 University of Cambridge
+ Copyright (c) 1997-2008 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
diff --git a/ext/pcre/pcrelib/testdata/grepoutput b/ext/pcre/pcrelib/testdata/grepoutput
index d5506a109..3241984c1 100644
--- a/ext/pcre/pcrelib/testdata/grepoutput
+++ b/ext/pcre/pcrelib/testdata/grepoutput
@@ -358,10 +358,13 @@ after the binary zero
./testdata/grepinput:597:after the binary zero
---------------------------- Test 42 ------------------------------
595:before
+595:zero
596:zero
597:after
+597:zero
---------------------------- Test 43 ------------------------------
595:before
+595:zero
596:zero
597:zero
---------------------------- Test 44 ------------------------------
@@ -385,3 +388,17 @@ PUT NEW DATA ABOVE THIS LINE.
---------------------------- Test 49 ------------------------------
---------------------------- Test 50 ------------------------------
over the lazy dog.
+---------------------------- Test 51 ------------------------------
+fox jumps
+---------------------------- Test 52 ------------------------------
+36972,6
+36990,4
+37024,4
+37066,5
+37083,4
+---------------------------- Test 53 ------------------------------
+595:15,6
+595:33,4
+596:28,4
+597:15,5
+597:32,4
diff --git a/ext/pcre/pcrelib/testdata/testinput1 b/ext/pcre/pcrelib/testdata/testinput1
index 79c98fa7b..91554ffc4 100644
--- a/ext/pcre/pcrelib/testdata/testinput1
+++ b/ext/pcre/pcrelib/testdata/testinput1
@@ -3421,11 +3421,6 @@
/((?m)^b)/
a\nb\nc\n
-/(?(1)a|b)/
-
-/(?(1)b|a)/
- a
-
/(x)?(?(1)a|b)/
*** Failers
a
@@ -4030,4 +4025,15 @@
/( (?(1)0|)* )/x
abcd
+/[[:abcd:xyz]]/
+ a]
+ :]
+
+/[abc[:x\]pqr]/
+ a
+ [
+ :
+ ]
+ p
+
/ End of testinput1 /
diff --git a/ext/pcre/pcrelib/testdata/testinput2 b/ext/pcre/pcrelib/testdata/testinput2
index c9f1018a9..1a13fa8dd 100644
--- a/ext/pcre/pcrelib/testdata/testinput2
+++ b/ext/pcre/pcrelib/testdata/testinput2
@@ -398,8 +398,6 @@
/(?(1?)a|b)/
-/(?(1)a|b|c)/
-
/[a[:xyz:/
/(?<=x+)y/
@@ -568,15 +566,15 @@
/ab\d+/I
-/a(?(1)b)/I
+/a(?(1)b)(.)/I
-/a(?(1)bag|big)/I
+/a(?(1)bag|big)(.)/I
-/a(?(1)bag|big)*/I
+/a(?(1)bag|big)*(.)/I
-/a(?(1)bag|big)+/I
+/a(?(1)bag|big)+(.)/I
-/a(?(1)b..|b..)/I
+/a(?(1)b..|b..)(.)/I
/ab\d{0}e/I
@@ -977,13 +975,13 @@
/()a/I
-/(?(1)ab|ac)/I
+/(?(1)ab|ac)(.)/I
-/(?(1)abz|acz)/I
+/(?(1)abz|acz)(.)/I
-/(?(1)abz)/I
+/(?(1)abz)(.)/I
-/(?(1)abz)123/I
+/(?(1)abz)(1)23/I
/(a)+/I
@@ -1999,7 +1997,7 @@ a random value. /Ix
/a/<any><crlf>
-/^a\Rb/
+/^a\Rb/<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -2009,7 +2007,7 @@ a random value. /Ix
** Failers
a\n\rb
-/^a\R*b/
+/^a\R*b/<bsr_unicode>
ab
a\nb
a\rb
@@ -2020,7 +2018,7 @@ a random value. /Ix
a\n\rb
a\n\r\x85\x0cb
-/^a\R+b/
+/^a\R+b/<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -2032,7 +2030,7 @@ a random value. /Ix
** Failers
ab
-/^a\R{1,3}b/
+/^a\R{1,3}b/<bsr_unicode>
a\nb
a\n\rb
a\n\r\x85b
@@ -2044,7 +2042,7 @@ a random value. /Ix
a\n\n\n\rb
a\r
-/^a[\R]b/
+/^a[\R]b/<bsr_unicode>
aRb
** Failers
a\nb
@@ -2190,8 +2188,8 @@ a random value. /Ix
/((?(-2)a))/BZ
-/^(?(+1)X|Y)/BZ
- Y
+/^(?(+1)X|Y)(.)/BZ
+ Y!
/(foo)\Kbar/
foobar
@@ -2464,4 +2462,131 @@ a random value. /Ix
a\r\nb
a\x85b
+/a\Rb/I<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x85b
+ a\x0bb
+
+/a\Rb/I<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x85b
+ a\x0bb
+ ** Failers
+ a\x85b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
+/a\R?b/I<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x85b
+ a\x0bb
+
+/a\R?b/I<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x85b
+ a\x0bb
+ ** Failers
+ a\x85b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
+/a\R{2,4}b/I<bsr_anycrlf>
+ a\r\n\nb
+ a\n\r\rb
+ a\r\n\r\n\r\n\r\nb
+ ** Failers
+ a\x85\85b
+ a\x0b\0bb
+
+/a\R{2,4}b/I<bsr_unicode>
+ a\r\rb
+ a\n\n\nb
+ a\r\n\n\r\rb
+ a\x85\85b
+ a\x0b\0bb
+ ** Failers
+ a\r\r\r\r\rb
+ a\x85\85b\<bsr_anycrlf>
+ a\x0b\0bb\<bsr_anycrlf>
+
+/(*BSR_ANYCRLF)a\Rb/I
+ a\nb
+ a\rb
+
+/(*BSR_UNICODE)a\Rb/I
+ a\x85b
+
+/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
+ a\nb
+ a\rb
+
+/(*CRLF)(*BSR_UNICODE)a\Rb/I
+ a\x85b
+
+/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
+
+/(?<a>)(?&)/
+
+/(?<abc>)(?&a)/
+
+/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
+
+/(?+-a)/
+
+/(?-+a)/
+
+/(?(-1))/
+
+/(?(+10))/
+
+/(?(10))/
+
+/(?(+2))()()/
+
+/(?(2))()()/
+
+/\k''/
+
+/\k<>/
+
+/\k{}/
+
+/(?P=)/
+
+/(?P>)/
+
+/(?!\w)(?R)/
+
+/(?=\w)(?R)/
+
+/(?<!\w)(?R)/
+
+/(?<=\w)(?R)/
+
+/[[:foo:]]/
+
+/[[:1234:]]/
+
+/[[:f\oo:]]/
+
+/[[: :]]/
+
+/[[:...:]]/
+
+/[[:l\ower:]]/
+
+/[[:abc\:]]/
+
+/[abc[:x\]pqr:]]/
+
+/[[:a\dz:]]/
+
/ End of testinput2 /
diff --git a/ext/pcre/pcrelib/testdata/testinput4 b/ext/pcre/pcrelib/testdata/testinput4
index 630fb1d53..c98c08520 100644
--- a/ext/pcre/pcrelib/testdata/testinput4
+++ b/ext/pcre/pcrelib/testdata/testinput4
@@ -535,4 +535,78 @@
/\W{2}/8g
+\x{a3}==
+/\S/8g
+ \x{442}\x{435}\x{441}\x{442}
+
+/[\S]/8g
+ \x{442}\x{435}\x{441}\x{442}
+
+/\D/8g
+ \x{442}\x{435}\x{441}\x{442}
+
+/[\D]/8g
+ \x{442}\x{435}\x{441}\x{442}
+
+/\W/8g
+ \x{2442}\x{2435}\x{2441}\x{2442}
+
+/[\W]/8g
+ \x{2442}\x{2435}\x{2441}\x{2442}
+
+/[\S\s]*/8
+ abc\n\r\x{442}\x{435}\x{441}\x{442}xyz
+
+/[\x{41f}\S]/8g
+ \x{442}\x{435}\x{441}\x{442}
+
+/.[^\S]./8g
+ abc def\x{442}\x{443}xyz\npqr
+
+/.[^\S\n]./8g
+ abc def\x{442}\x{443}xyz\npqr
+
+/[[:^alnum:]]/8g
+ +\x{2442}
+
+/[[:^alpha:]]/8g
+ +\x{2442}
+
+/[[:^ascii:]]/8g
+ A\x{442}
+
+/[[:^blank:]]/8g
+ A\x{442}
+
+/[[:^cntrl:]]/8g
+ A\x{442}
+
+/[[:^digit:]]/8g
+ A\x{442}
+
+/[[:^graph:]]/8g
+ \x19\x{e01ff}
+
+/[[:^lower:]]/8g
+ A\x{422}
+
+/[[:^print:]]/8g
+ \x{19}\x{e01ff}
+
+/[[:^punct:]]/8g
+ A\x{442}
+
+/[[:^space:]]/8g
+ A\x{442}
+
+/[[:^upper:]]/8g
+ a\x{442}
+
+/[[:^word:]]/8g
+ +\x{2442}
+
+/[[:^xdigit:]]/8g
+ M\x{442}
+
+/[^ABCDEFGHIJKLMNOPQRSTUVWXYZÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖØÙÚÛÜÃÞĀĂĄĆĈĊČĎÄĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿÅŃŅŇŊŌŎÅŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽÆƂƄƆƇƉƊƋƎÆÆƑƓƔƖƗƘƜÆƟƠƢƤƦƧƩƬƮƯƱƲƳƵƷƸƼDŽLJNJÇÇǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶǷǸǺǼǾȀȂȄȆȈȊȌȎÈȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾÉΆΈΉΊΌΎÎΑΒΓΔΕΖΗΘΙΚΛΜÎΞΟΠΡΣΤΥΦΧΨΩΪΫϒϓϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽϾϿЀÐЂЃЄЅІЇЈЉЊЋЌÐÐŽÐÐБВГДЕЖЗИЙКЛМÐОПРСТУФХЦЧШЩЪЫЬЭЮЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎÒҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀÓÓƒÓ…Ó‡Ó‰Ó‹ÓÓӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸԀԂԄԆԈԊԌԎԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀÕÕ‚ÕƒÕ„Õ…Õ†Õ‡ÕˆÕ‰ÕŠÕ‹ÕŒÕÕŽÕÕՑՒՓՔՕՖႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀáƒáƒ‚ჃჄჅḀḂḄḆḈḊḌḎá¸á¸’ḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎá¹á¹’ṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎáºáº’ẔẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎá»á»’ỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸἈἉἊἋἌá¼á¼Žá¼á¼˜á¼™á¼šá¼›á¼œá¼á¼¨á¼©á¼ªá¼«á¼¬á¼­á¼®á¼¯á¼¸á¼¹á¼ºá¼»á¼¼á¼½á¼¾á¼¿á½ˆá½‰á½Šá½‹á½Œá½á½™á½›á½á½Ÿá½¨á½©á½ªá½«á½¬á½­á½®á½¯á¾¸á¾¹á¾ºá¾»á¿ˆá¿‰á¿Šá¿‹á¿˜á¿™á¿šá¿›á¿¨á¿©á¿ªá¿«á¿¬á¿¸á¿¹á¿ºá¿»abcdefghijklmnopqrstuvwxyzªµºßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÄăąćĉċÄÄđēĕėęěÄğġģĥħĩīĭįıijĵķĸĺļľŀłńņňʼnŋÅÅőœŕŗřśÅşšţťŧũūŭůűųŵŷźżžſƀƃƅƈƌƃƕƙƚƛƞơƣƥƨƪƫƭưƴƶƹƺƽƾƿdžljnjǎÇǒǔǖǘǚǜÇǟǡǣǥǧǩǫǭǯǰdzǵǹǻǽǿÈȃȅȇȉȋÈÈȑȓȕȗșțÈȟȡȣȥȧȩȫȭȯȱȳȴȵȶȷȸȹȼȿɀÉɑɒɓɔɕɖɗɘəɚɛɜÉɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀÊʂʃʄʅʆʇʈʉʊʋʌÊÊŽÊÊʑʒʓʔʕʖʗʘʙʚʛʜÊʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯÎάέήίΰαβγδεζηθικλμνξοπÏςστυφχψωϊϋόÏÏŽÏϑϕϖϗϙϛÏϟϡϣϥϧϩϫϭϯϰϱϲϳϵϸϻϼабвгдежзийклмнопрÑтуфхцчшщъыьÑÑŽÑÑёђѓєѕіїјљњћќÑўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿÒÒ‹ÒÒÒ‘Ò“Ò•Ò—Ò™Ò›ÒҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӑӓӕӗәӛÓÓŸÓ¡Ó£Ó¥Ó§Ó©Ó«Ó­Ó¯Ó±Ó³ÓµÓ·Ó¹ÔÔƒÔ…Ô‡Ô‰Ô‹ÔÔÕ¡Õ¢Õ£Õ¤Õ¥Õ¦Õ§Õ¨Õ©ÕªÕ«Õ¬Õ­Õ®Õ¯Õ°Õ±Õ²Õ³Õ´ÕµÕ¶Õ·Õ¸Õ¹ÕºÕ»Õ¼Õ½Õ¾Õ¿Ö€Öւփքօֆևᴀá´á´‚ᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌá´á´Žá´á´á´‘ᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜá´á´žá´Ÿá´ á´¡á´¢á´£á´¤á´¥á´¦á´§á´¨á´©á´ªá´«áµ¢áµ£áµ¤áµ¥áµ¦áµ§áµ¨áµ©áµªáµ«áµ¬áµ­áµ®áµ¯áµ°áµ±áµ²áµ³áµ´áµµáµ¶áµ·áµ¹áµºáµ»áµ¼áµ½áµ¾áµ¿á¶€á¶á¶‚ᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌá¶á¶Žá¶á¶á¶‘ᶒᶓᶔᶕᶖᶗᶘᶙᶚá¸á¸ƒá¸…ḇḉḋá¸á¸á¸‘ḓḕḗḙḛá¸á¸Ÿá¸¡á¸£á¸¥á¸§á¸©á¸«á¸­á¸¯á¸±á¸³á¸µá¸·á¸¹á¸»á¸½á¸¿á¹á¹ƒá¹…ṇṉṋá¹á¹á¹‘ṓṕṗṙṛá¹á¹Ÿá¹¡á¹£á¹¥á¹§á¹©á¹«á¹­á¹¯á¹±á¹³á¹µá¹·á¹¹á¹»á¹½á¹¿áºáºƒáº…ẇẉẋáºáºáº‘ẓẕẖẗẘẙẚẛạảấầẩẫậắằẳẵặẹẻẽếá»á»ƒá»…ệỉịá»á»á»‘ồổỗộớá»á»Ÿá»¡á»£á»¥á»§á»©á»«á»­á»¯á»±á»³á»µá»·á»¹á¼€á¼á¼‚ἃἄἅἆἇá¼á¼‘ἒἓἔἕἠἡἢἣἤἥἦἧἰἱἲἳἴἵἶἷὀá½á½‚ὃὄὅá½á½‘ὒὓὔὕὖὗὠὡὢὣὤὥὦὧὰάὲέὴήὶίὸόὺύὼώᾀá¾á¾‚ᾃᾄᾅᾆᾇá¾á¾‘ᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷιῂῃῄῆῇá¿á¿‘ῒΐῖῗῠῡῢΰῤῥῦῧῲῳῴῶῷâ²â²ƒâ²…ⲇⲉⲋâ²â²â²‘ⲓⲕⲗⲙⲛâ²â²Ÿâ²¡â²£â²¥â²§â²©â²«â²­â²¯â²±â²³â²µâ²·â²¹â²»â²½â²¿â³â³ƒâ³…ⳇⳉⳋâ³â³â³‘ⳓⳕⳗⳙⳛâ³â³Ÿâ³¡â³£â³¤â´€â´â´‚ⴃⴄⴅⴆⴇⴈⴉⴊⴋⴌâ´â´Žâ´â´â´‘ⴒⴓⴔⴕⴖⴗⴘⴙⴚⴛⴜâ´â´žâ´Ÿâ´ â´¡â´¢â´£â´¤â´¥ï¬€ï¬ï¬‚ffifflſtstﬓﬔﬕﬖﬗ\d-_^]/8
+
/ End of testinput4 /
diff --git a/ext/pcre/pcrelib/testdata/testinput5 b/ext/pcre/pcrelib/testdata/testinput5
index aa0123b3e..75a4857b4 100644
--- a/ext/pcre/pcrelib/testdata/testinput5
+++ b/ext/pcre/pcrelib/testdata/testinput5
@@ -312,7 +312,7 @@ can't tell the difference.) --/
/abc.$/mgx8<any>
abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
-/^a\Rb/8
+/^a\Rb/8<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -324,7 +324,7 @@ can't tell the difference.) --/
** Failers
a\n\rb
-/^a\R*b/8
+/^a\R*b/8<bsr_unicode>
ab
a\nb
a\rb
@@ -335,7 +335,7 @@ can't tell the difference.) --/
a\n\rb
a\n\r\x{85}\x0cb
-/^a\R+b/8
+/^a\R+b/8<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -347,7 +347,7 @@ can't tell the difference.) --/
** Failers
ab
-/^a\R{1,3}b/8
+/^a\R{1,3}b/8<bsr_unicode>
a\nb
a\n\rb
a\n\r\x{85}b
@@ -417,4 +417,48 @@ can't tell the difference.) --/
\x{7fffffff}
\x{7fffffff}\?
+/a\Rb/I8<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x{85}b
+ a\x0bb
+
+/a\Rb/I8<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x{85}b
+ a\x0bb
+ ** Failers
+ a\x{85}b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
+/a\R?b/I8<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x{85}b
+ a\x0bb
+
+/a\R?b/I8<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x{85}b
+ a\x0bb
+ ** Failers
+ a\x{85}b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
+/.*a.*=.b.*/8<ANY>
+ QQQ\x{2029}ABCaXYZ=!bPQR
+ ** Failers
+ a\x{2029}b
+ \x61\xe2\x80\xa9\x62
+
+/[[:a\x{100}b:]]/8
+
/ End of testinput5 /
diff --git a/ext/pcre/pcrelib/testdata/testinput6 b/ext/pcre/pcrelib/testdata/testinput6
index 53d2b328f..0204a7aca 100644
--- a/ext/pcre/pcrelib/testdata/testinput6
+++ b/ext/pcre/pcrelib/testdata/testinput6
@@ -832,4 +832,79 @@ was broken in all cases./
/(\p{Yi}{0,3}+\277)*/
+/^[\p{Arabic}]/8
+ \x{60e}
+ \x{656}
+ \x{657}
+ \x{658}
+ \x{659}
+ \x{65a}
+ \x{65b}
+ \x{65c}
+ \x{65d}
+ \x{65e}
+ \x{66a}
+ \x{6e9}
+ \x{6ef}
+ \x{6fa}
+ ** Failers
+ \x{600}
+ \x{650}
+ \x{651}
+ \x{652}
+ \x{653}
+ \x{654}
+ \x{655}
+ \x{65f}
+
+/^\p{Cyrillic}/8
+ \x{1d2b}
+
+/^\p{Common}/8
+ \x{589}
+ \x{60c}
+ \x{61f}
+ \x{964}
+ \x{965}
+ \x{970}
+
+/^\p{Inherited}/8
+ \x{64b}
+ \x{654}
+ \x{655}
+ \x{200c}
+ ** Failers
+ \x{64a}
+ \x{656}
+
+/^\p{Shavian}/8
+ \x{10450}
+ \x{1047f}
+
+/^\p{Deseret}/8
+ \x{10400}
+ \x{1044f}
+
+/^\p{Osmanya}/8
+ \x{10480}
+ \x{1049d}
+ \x{104a0}
+ \x{104a9}
+ ** Failers
+ \x{1049e}
+ \x{1049f}
+ \x{104aa}
+
+/\p{Zl}{2,3}+/8BZ
+ \xe2\x80\xa8\xe2\x80\xa8
+ \x{2028}\x{2028}\x{2028}
+
+/\p{Zl}/8BZ
+
+/\p{Lu}{3}+/8BZ
+
+/\pL{2}+/8BZ
+
+/\p{Cc}{2}+/8BZ
+
/ End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testinput7 b/ext/pcre/pcrelib/testdata/testinput7
index 76524b725..221bc938b 100644
--- a/ext/pcre/pcrelib/testdata/testinput7
+++ b/ext/pcre/pcrelib/testdata/testinput7
@@ -4156,7 +4156,7 @@
/abc.$/mgx<any>
abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7\x{2028} abc8\x{2029} abc9
-/^a\Rb/
+/^a\Rb/<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -4166,7 +4166,7 @@
** Failers
a\n\rb
-/^a\R*b/
+/^a\R*b/<bsr_unicode>
ab
a\nb
a\rb
@@ -4177,7 +4177,7 @@
a\n\rb
a\n\r\x85\x0cb
-/^a\R+b/
+/^a\R+b/<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -4189,7 +4189,7 @@
** Failers
ab
-/^a\R{1,3}b/
+/^a\R{1,3}b/<bsr_unicode>
a\nb
a\n\rb
a\n\r\x85b
@@ -4201,7 +4201,7 @@
a\n\n\n\rb
a\r
-/^a[\R]b/
+/^a[\R]b/<bsr_unicode>
aRb
** Failers
a\nb
@@ -4310,4 +4310,59 @@
/(\r|\n)A/<crlf>
\r\nA
+/a\Rb/I<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x85b
+ a\x0bb
+
+/a\Rb/I<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x85b
+ a\x0bb
+ ** Failers
+ a\x85b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
+/a\R?b/I<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x85b
+ a\x0bb
+
+/a\R?b/I<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x85b
+ a\x0bb
+ ** Failers
+ a\x85b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
+/a\R{2,4}b/I<bsr_anycrlf>
+ a\r\n\nb
+ a\n\r\rb
+ a\r\n\r\n\r\n\r\nb
+ ** Failers
+ a\x85\85b
+ a\x0b\0bb
+
+/a\R{2,4}b/I<bsr_unicode>
+ a\r\rb
+ a\n\n\nb
+ a\r\n\n\r\rb
+ a\x85\85b
+ a\x0b\0bb
+ ** Failers
+ a\r\r\r\r\rb
+ a\x85\85b\<bsr_anycrlf>
+ a\x0b\0bb\<bsr_anycrlf>
+
/ End of testinput7 /
diff --git a/ext/pcre/pcrelib/testdata/testinput8 b/ext/pcre/pcrelib/testdata/testinput8
index 61e70e55a..5bcfab5c0 100644
--- a/ext/pcre/pcrelib/testdata/testinput8
+++ b/ext/pcre/pcrelib/testdata/testinput8
@@ -543,7 +543,7 @@
/abc.$/mgx8<any>
abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9
-/^a\Rb/8
+/^a\Rb/8<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -555,7 +555,7 @@
** Failers
a\n\rb
-/^a\R*b/8
+/^a\R*b/8<bsr_unicode>
ab
a\nb
a\rb
@@ -566,7 +566,7 @@
a\n\rb
a\n\r\x{85}\x0cb
-/^a\R+b/8
+/^a\R+b/8<bsr_unicode>
a\nb
a\rb
a\r\nb
@@ -578,7 +578,7 @@
** Failers
ab
-/^a\R{1,3}b/8
+/^a\R{1,3}b/8<bsr_unicode>
a\nb
a\n\rb
a\n\r\x{85}b
@@ -628,4 +628,40 @@
** Failers
\x09\x{200a}\x{a0}\x{2028}\x0b
+/a\Rb/I8<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x{85}b
+ a\x0bb
+
+/a\Rb/I8<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x{85}b
+ a\x0bb
+ ** Failers
+ a\x{85}b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
+/a\R?b/I8<bsr_anycrlf>
+ a\rb
+ a\nb
+ a\r\nb
+ ** Failers
+ a\x{85}b
+ a\x0bb
+
+/a\R?b/I8<bsr_unicode>
+ a\rb
+ a\nb
+ a\r\nb
+ a\x{85}b
+ a\x0bb
+ ** Failers
+ a\x{85}b\<bsr_anycrlf>
+ a\x0bb\<bsr_anycrlf>
+
/ End of testinput 8 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput1 b/ext/pcre/pcrelib/testdata/testoutput1
index 4c0e680d1..9b8b268ed 100644
--- a/ext/pcre/pcrelib/testdata/testoutput1
+++ b/ext/pcre/pcrelib/testdata/testoutput1
@@ -5551,12 +5551,6 @@ No match
0: b
1: b
-/(?(1)a|b)/
-
-/(?(1)b|a)/
- a
- 0: a
-
/(x)?(?(1)a|b)/
*** Failers
No match
@@ -6593,4 +6587,22 @@ No match
0:
1:
+/[[:abcd:xyz]]/
+ a]
+ 0: a]
+ :]
+ 0: :]
+
+/[abc[:x\]pqr]/
+ a
+ 0: a
+ [
+ 0: [
+ :
+ 0: :
+ ]
+ 0: ]
+ p
+ 0: p
+
/ End of testinput1 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput2 b/ext/pcre/pcrelib/testdata/testoutput2
index a1c071d8b..dba227f50 100644
--- a/ext/pcre/pcrelib/testdata/testoutput2
+++ b/ext/pcre/pcrelib/testdata/testoutput2
@@ -109,7 +109,7 @@ Failed: missing ) at offset 4
Failed: missing ) after comment at offset 7
/(?z)abc/
-Failed: unrecognized character after (? at offset 2
+Failed: unrecognized character after (? or (?- at offset 2
/.*b/I
Capturing subpattern count = 0
@@ -166,7 +166,6 @@ 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
@@ -311,7 +310,7 @@ No match
No match
/ab(?z)cd/
-Failed: unrecognized character after (? at offset 4
+Failed: unrecognized character after (? or (?- at offset 4
/^abc|def/I
Capturing subpattern count = 0
@@ -403,7 +402,6 @@ 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
@@ -948,26 +946,23 @@ Failed: missing ) at offset 4
Failed: unrecognized character after (?< at offset 3
/a(?{)b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
/a(?{{})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
/a(?{}})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
/a(?{"{"})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
/a(?{"{"}})b/
-Failed: unrecognized character after (? at offset 3
+Failed: unrecognized character after (? or (?- at offset 3
/(?(1?)a|b)/
Failed: malformed number or name after (?( at offset 4
-/(?(1)a|b|c)/
-Failed: conditional group contains more than two branches at offset 10
-
/[a[:xyz:/
Failed: missing terminating ] for character class at offset 8
@@ -1440,7 +1435,6 @@ Need char = 'a'
/"([^\\"]+|\\.)*"/I
Capturing subpattern count = 1
Partial matching not supported
-Contains explicit CR or LF match
No options
First char = '"'
Need char = '"'
@@ -1602,32 +1596,32 @@ No options
First char = 'a'
Need char = 'b'
-/a(?(1)b)/I
-Capturing subpattern count = 0
+/a(?(1)b)(.)/I
+Capturing subpattern count = 1
No options
First char = 'a'
No need char
-/a(?(1)bag|big)/I
-Capturing subpattern count = 0
+/a(?(1)bag|big)(.)/I
+Capturing subpattern count = 1
No options
First char = 'a'
Need char = 'g'
-/a(?(1)bag|big)*/I
-Capturing subpattern count = 0
+/a(?(1)bag|big)*(.)/I
+Capturing subpattern count = 1
No options
First char = 'a'
No need char
-/a(?(1)bag|big)+/I
-Capturing subpattern count = 0
+/a(?(1)bag|big)+(.)/I
+Capturing subpattern count = 1
No options
First char = 'a'
Need char = 'g'
-/a(?(1)b..|b..)/I
-Capturing subpattern count = 0
+/a(?(1)b..|b..)(.)/I
+Capturing subpattern count = 1
No options
First char = 'a'
Need char = 'b'
@@ -1716,7 +1710,6 @@ Study returned NULL
/Ix
Capturing subpattern count = 0
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1746,7 +1739,6 @@ No match
/\( ( (?>[^()]+) | (?R) )* \) /Ixg
Capturing subpattern count = 1
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1762,7 +1754,6 @@ Need char = ')'
/\( (?: (?>[^()]+) | (?R) ) \) /Ix
Capturing subpattern count = 0
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1782,7 +1773,6 @@ No match
/\( (?: (?>[^()]+) | (?R) )? \) /Ix
Capturing subpattern count = 0
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1794,7 +1784,6 @@ Need char = ')'
/\( ( (?>[^()]+) | (?R) )* \) /Ix
Capturing subpattern count = 1
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1805,7 +1794,6 @@ Need char = ')'
/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
Capturing subpattern count = 2
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1817,7 +1805,6 @@ 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 = ')'
@@ -1835,7 +1822,6 @@ 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 = ')'
@@ -1853,7 +1839,6 @@ Need char = ')'
/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
Capturing subpattern count = 11
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1874,7 +1859,6 @@ Need char = ')'
/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1887,7 +1871,6 @@ Need char = ')'
/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
-Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1919,12 +1902,11 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-/:-@[-`{-\xff]
+ [\x00-/:-@[-`{-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -1946,12 +1928,11 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-@[-`{-\xff]
+ [\x00-@[-`{-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -1973,7 +1954,6 @@ 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
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -1982,7 +1962,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x80-\xff]
+ [\x80-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -2008,12 +1988,11 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-\x08\x0a-\x1f!-\xff]
+ [\x00-\x08\x0a-\x1f!-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -2035,7 +2014,6 @@ Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -2114,7 +2092,6 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -2162,7 +2139,7 @@ No need char
------------------------------------------------------------------
Bra
^
- [ -~\x80-\xff]
+ [ -~\x80-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -2175,12 +2152,11 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-/12:-\xff]
+ [\x00-/12:-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -2189,12 +2165,11 @@ No need char
------------------------------------------------------------------
Bra
^
- [\x00-\x08\x0a-\x1f!-\xff]
+ [\x00-\x08\x0a-\x1f!-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -2758,7 +2733,7 @@ No need char
/[\S]/DZ
------------------------------------------------------------------
Bra
- [\x00-\x08\x0b\x0e-\x1f!-\xff]
+ [\x00-\x08\x0b\x0e-\x1f!-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -3083,7 +3058,6 @@ 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
@@ -3094,7 +3068,6 @@ No need char
/\(([^()]++|\([^()]+\))+\)/I
Capturing subpattern count = 1
Partial matching not supported
-Contains explicit CR or LF match
No options
First char = '('
Need char = ')'
@@ -3295,7 +3268,6 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
No options
No first char
No need char
@@ -3308,7 +3280,6 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
No options
No first char
No need char
@@ -3316,7 +3287,6 @@ 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 = '>'
@@ -3468,26 +3438,26 @@ No options
No first char
Need char = 'a'
-/(?(1)ab|ac)/I
-Capturing subpattern count = 0
+/(?(1)ab|ac)(.)/I
+Capturing subpattern count = 1
No options
First char = 'a'
No need char
-/(?(1)abz|acz)/I
-Capturing subpattern count = 0
+/(?(1)abz|acz)(.)/I
+Capturing subpattern count = 1
No options
First char = 'a'
Need char = 'z'
-/(?(1)abz)/I
-Capturing subpattern count = 0
+/(?(1)abz)(.)/I
+Capturing subpattern count = 1
No options
No first char
No need char
-/(?(1)abz)123/I
-Capturing subpattern count = 0
+/(?(1)abz)(1)23/I
+Capturing subpattern count = 1
No options
No first char
Need char = '3'
@@ -3531,7 +3501,6 @@ 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
@@ -3991,7 +3960,6 @@ 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
@@ -4011,7 +3979,6 @@ No match
/^>abc>([^()]|\((?1)*\))*<xyz<$/I
Capturing subpattern count = 1
-Contains explicit CR or LF match
Options: anchored
No first char
Need char = '<'
@@ -4139,7 +4106,6 @@ 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 = '>'
@@ -5958,7 +5924,6 @@ 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
@@ -5972,7 +5937,6 @@ 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
@@ -5984,7 +5948,6 @@ 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
@@ -5996,7 +5959,6 @@ 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
@@ -6010,7 +5972,6 @@ 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
@@ -6205,6 +6166,7 @@ Named capturing subpatterns:
A 2
A 3
Options: anchored dupnames
+Duplicate name status changes
No first char
No need char
a1b\CA
@@ -7913,7 +7875,7 @@ No match
/a/<any><crlf>
Failed: inconsistent NEWLINE options at offset 0
-/^a\Rb/
+/^a\Rb/<bsr_unicode>
a\nb
0: a\x0ab
a\rb
@@ -7931,7 +7893,7 @@ No match
a\n\rb
No match
-/^a\R*b/
+/^a\R*b/<bsr_unicode>
ab
0: ab
a\nb
@@ -7951,7 +7913,7 @@ No match
a\n\r\x85\x0cb
0: a\x0a\x0d\x85\x0cb
-/^a\R+b/
+/^a\R+b/<bsr_unicode>
a\nb
0: a\x0ab
a\rb
@@ -7973,7 +7935,7 @@ No match
ab
No match
-/^a\R{1,3}b/
+/^a\R{1,3}b/<bsr_unicode>
a\nb
0: a\x0ab
a\n\rb
@@ -7995,7 +7957,7 @@ No match
a\r
No match
-/^a[\R]b/
+/^a[\R]b/<bsr_unicode>
aRb
0: aRb
** Failers
@@ -8343,7 +8305,7 @@ Failed: reference to non-existent subpattern at offset 6
/((?(-2)a))/BZ
Failed: reference to non-existent subpattern at offset 7
-/^(?(+1)X|Y)/BZ
+/^(?(+1)X|Y)(.)/BZ
------------------------------------------------------------------
Bra
^
@@ -8353,11 +8315,15 @@ Failed: reference to non-existent subpattern at offset 7
Alt
Y
Ket
+ CBra 1
+ Any
+ Ket
Ket
End
------------------------------------------------------------------
- Y
- 0: Y
+ Y!
+ 0: Y!
+ 1: !
/(foo)\Kbar/
foobar
@@ -9168,4 +9134,255 @@ No match
a\x85b
No match
+/a\Rb/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ ** Failers
+No match
+ a\x85b
+No match
+ a\x0bb
+No match
+
+/a\Rb/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x85b
+ 0: a\x85b
+ a\x0bb
+ 0: a\x0bb
+ ** Failers
+No match
+ a\x85b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/a\R?b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ ** Failers
+No match
+ a\x85b
+No match
+ a\x0bb
+No match
+
+/a\R?b/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x85b
+ 0: a\x85b
+ a\x0bb
+ 0: a\x0bb
+ ** Failers
+No match
+ a\x85b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/a\R{2,4}b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+ a\r\n\nb
+ 0: a\x0d\x0a\x0ab
+ a\n\r\rb
+ 0: a\x0a\x0d\x0db
+ a\r\n\r\n\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
+ ** Failers
+No match
+ a\x85\85b
+No match
+ a\x0b\0bb
+No match
+
+/a\R{2,4}b/I<bsr_unicode>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+ a\r\rb
+ 0: a\x0d\x0db
+ a\n\n\nb
+ 0: a\x0a\x0a\x0ab
+ a\r\n\n\r\rb
+ 0: a\x0d\x0a\x0a\x0d\x0db
+ a\x85\85b
+No match
+ a\x0b\0bb
+No match
+ ** Failers
+No match
+ a\r\r\r\r\rb
+No match
+ a\x85\85b\<bsr_anycrlf>
+No match
+ a\x0b\0bb\<bsr_anycrlf>
+No match
+
+/(*BSR_ANYCRLF)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+
+/(*BSR_UNICODE)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+ a\x85b
+ 0: a\x85b
+
+/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+Forced newline sequence: CRLF
+First char = 'a'
+Need char = 'b'
+ a\nb
+ 0: a\x0ab
+ a\rb
+ 0: a\x0db
+
+/(*CRLF)(*BSR_UNICODE)a\Rb/I
+Capturing subpattern count = 0
+Options: bsr_unicode
+Forced newline sequence: CRLF
+First char = 'a'
+Need char = 'b'
+ a\x85b
+ 0: a\x85b
+
+/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+Forced newline sequence: CR
+First char = 'a'
+Need char = 'b'
+
+/(?<a>)(?&)/
+Failed: subpattern name expected at offset 9
+
+/(?<abc>)(?&a)/
+Failed: reference to non-existent subpattern at offset 12
+
+/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
+Failed: reference to non-existent subpattern at offset 32
+
+/(?+-a)/
+Failed: digit expected after (?+ at offset 3
+
+/(?-+a)/
+Failed: unrecognized character after (? or (?- at offset 3
+
+/(?(-1))/
+Failed: reference to non-existent subpattern at offset 6
+
+/(?(+10))/
+Failed: reference to non-existent subpattern at offset 7
+
+/(?(10))/
+Failed: reference to non-existent subpattern at offset 6
+
+/(?(+2))()()/
+
+/(?(2))()()/
+
+/\k''/
+Failed: subpattern name expected at offset 3
+
+/\k<>/
+Failed: subpattern name expected at offset 3
+
+/\k{}/
+Failed: subpattern name expected at offset 3
+
+/(?P=)/
+Failed: subpattern name expected at offset 4
+
+/(?P>)/
+Failed: subpattern name expected at offset 4
+
+/(?!\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 9
+
+/(?=\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 9
+
+/(?<!\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 10
+
+/(?<=\w)(?R)/
+Failed: recursive call could loop indefinitely at offset 10
+
+/[[:foo:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:1234:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:f\oo:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[: :]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:...:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:l\ower:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[[:abc\:]]/
+Failed: unknown POSIX class name at offset 3
+
+/[abc[:x\]pqr:]]/
+Failed: unknown POSIX class name at offset 6
+
+/[[:a\dz:]]/
+Failed: unknown POSIX class name at offset 3
+
/ End of testinput2 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput4 b/ext/pcre/pcrelib/testdata/testoutput4
index b49d4f98a..d87ea4bcc 100644
--- a/ext/pcre/pcrelib/testdata/testoutput4
+++ b/ext/pcre/pcrelib/testdata/testoutput4
@@ -938,4 +938,137 @@ No match
0: +\x{a3}
0: ==
+/\S/8g
+ \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/[\S]/8g
+ \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/\D/8g
+ \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/[\D]/8g
+ \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/\W/8g
+ \x{2442}\x{2435}\x{2441}\x{2442}
+ 0: \x{2442}
+ 0: \x{2435}
+ 0: \x{2441}
+ 0: \x{2442}
+
+/[\W]/8g
+ \x{2442}\x{2435}\x{2441}\x{2442}
+ 0: \x{2442}
+ 0: \x{2435}
+ 0: \x{2441}
+ 0: \x{2442}
+
+/[\S\s]*/8
+ abc\n\r\x{442}\x{435}\x{441}\x{442}xyz
+ 0: abc\x{0a}\x{0d}\x{442}\x{435}\x{441}\x{442}xyz
+
+/[\x{41f}\S]/8g
+ \x{442}\x{435}\x{441}\x{442}
+ 0: \x{442}
+ 0: \x{435}
+ 0: \x{441}
+ 0: \x{442}
+
+/.[^\S]./8g
+ abc def\x{442}\x{443}xyz\npqr
+ 0: c d
+ 0: z\x{0a}p
+
+/.[^\S\n]./8g
+ abc def\x{442}\x{443}xyz\npqr
+ 0: c d
+
+/[[:^alnum:]]/8g
+ +\x{2442}
+ 0: +
+ 0: \x{2442}
+
+/[[:^alpha:]]/8g
+ +\x{2442}
+ 0: +
+ 0: \x{2442}
+
+/[[:^ascii:]]/8g
+ A\x{442}
+ 0: \x{442}
+
+/[[:^blank:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^cntrl:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^digit:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^graph:]]/8g
+ \x19\x{e01ff}
+ 0: \x{19}
+ 0: \x{e01ff}
+
+/[[:^lower:]]/8g
+ A\x{422}
+ 0: A
+ 0: \x{422}
+
+/[[:^print:]]/8g
+ \x{19}\x{e01ff}
+ 0: \x{19}
+ 0: \x{e01ff}
+
+/[[:^punct:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^space:]]/8g
+ A\x{442}
+ 0: A
+ 0: \x{442}
+
+/[[:^upper:]]/8g
+ a\x{442}
+ 0: a
+ 0: \x{442}
+
+/[[:^word:]]/8g
+ +\x{2442}
+ 0: +
+ 0: \x{2442}
+
+/[[:^xdigit:]]/8g
+ M\x{442}
+ 0: M
+ 0: \x{442}
+
+/[^ABCDEFGHIJKLMNOPQRSTUVWXYZÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖØÙÚÛÜÃÞĀĂĄĆĈĊČĎÄĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿÅŃŅŇŊŌŎÅŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽÆƂƄƆƇƉƊƋƎÆÆƑƓƔƖƗƘƜÆƟƠƢƤƦƧƩƬƮƯƱƲƳƵƷƸƼDŽLJNJÇÇǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶǷǸǺǼǾȀȂȄȆȈȊȌȎÈȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾÉΆΈΉΊΌΎÎΑΒΓΔΕΖΗΘΙΚΛΜÎΞΟΠΡΣΤΥΦΧΨΩΪΫϒϓϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽϾϿЀÐЂЃЄЅІЇЈЉЊЋЌÐÐŽÐÐБВГДЕЖЗИЙКЛМÐОПРСТУФХЦЧШЩЪЫЬЭЮЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎÒҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀÓÓƒÓ…Ó‡Ó‰Ó‹ÓÓӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸԀԂԄԆԈԊԌԎԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀÕÕ‚ÕƒÕ„Õ…Õ†Õ‡ÕˆÕ‰ÕŠÕ‹ÕŒÕÕŽÕÕՑՒՓՔՕՖႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀáƒáƒ‚ჃჄჅḀḂḄḆḈḊḌḎá¸á¸’ḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎá¹á¹’ṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎáºáº’ẔẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎá»á»’ỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸἈἉἊἋἌá¼á¼Žá¼á¼˜á¼™á¼šá¼›á¼œá¼á¼¨á¼©á¼ªá¼«á¼¬á¼­á¼®á¼¯á¼¸á¼¹á¼ºá¼»á¼¼á¼½á¼¾á¼¿á½ˆá½‰á½Šá½‹á½Œá½á½™á½›á½á½Ÿá½¨á½©á½ªá½«á½¬á½­á½®á½¯á¾¸á¾¹á¾ºá¾»á¿ˆá¿‰á¿Šá¿‹á¿˜á¿™á¿šá¿›á¿¨á¿©á¿ªá¿«á¿¬á¿¸á¿¹á¿ºá¿»abcdefghijklmnopqrstuvwxyzªµºßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÄăąćĉċÄÄđēĕėęěÄğġģĥħĩīĭįıijĵķĸĺļľŀłńņňʼnŋÅÅőœŕŗřśÅşšţťŧũūŭůűųŵŷźżžſƀƃƅƈƌƃƕƙƚƛƞơƣƥƨƪƫƭưƴƶƹƺƽƾƿdžljnjǎÇǒǔǖǘǚǜÇǟǡǣǥǧǩǫǭǯǰdzǵǹǻǽǿÈȃȅȇȉȋÈÈȑȓȕȗșțÈȟȡȣȥȧȩȫȭȯȱȳȴȵȶȷȸȹȼȿɀÉɑɒɓɔɕɖɗɘəɚɛɜÉɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀÊʂʃʄʅʆʇʈʉʊʋʌÊÊŽÊÊʑʒʓʔʕʖʗʘʙʚʛʜÊʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯÎάέήίΰαβγδεζηθικλμνξοπÏςστυφχψωϊϋόÏÏŽÏϑϕϖϗϙϛÏϟϡϣϥϧϩϫϭϯϰϱϲϳϵϸϻϼабвгдежзийклмнопрÑтуфхцчшщъыьÑÑŽÑÑёђѓєѕіїјљњћќÑўџѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿÒÒ‹ÒÒÒ‘Ò“Ò•Ò—Ò™Ò›ÒҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӑӓӕӗәӛÓÓŸÓ¡Ó£Ó¥Ó§Ó©Ó«Ó­Ó¯Ó±Ó³ÓµÓ·Ó¹ÔÔƒÔ…Ô‡Ô‰Ô‹ÔÔÕ¡Õ¢Õ£Õ¤Õ¥Õ¦Õ§Õ¨Õ©ÕªÕ«Õ¬Õ­Õ®Õ¯Õ°Õ±Õ²Õ³Õ´ÕµÕ¶Õ·Õ¸Õ¹ÕºÕ»Õ¼Õ½Õ¾Õ¿Ö€Öւփքօֆևᴀá´á´‚ᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌá´á´Žá´á´á´‘ᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜá´á´žá´Ÿá´ á´¡á´¢á´£á´¤á´¥á´¦á´§á´¨á´©á´ªá´«áµ¢áµ£áµ¤áµ¥áµ¦áµ§áµ¨áµ©áµªáµ«áµ¬áµ­áµ®áµ¯áµ°áµ±áµ²áµ³áµ´áµµáµ¶áµ·áµ¹áµºáµ»áµ¼áµ½áµ¾áµ¿á¶€á¶á¶‚ᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌá¶á¶Žá¶á¶á¶‘ᶒᶓᶔᶕᶖᶗᶘᶙᶚá¸á¸ƒá¸…ḇḉḋá¸á¸á¸‘ḓḕḗḙḛá¸á¸Ÿá¸¡á¸£á¸¥á¸§á¸©á¸«á¸­á¸¯á¸±á¸³á¸µá¸·á¸¹á¸»á¸½á¸¿á¹á¹ƒá¹…ṇṉṋá¹á¹á¹‘ṓṕṗṙṛá¹á¹Ÿá¹¡á¹£á¹¥á¹§á¹©á¹«á¹­á¹¯á¹±á¹³á¹µá¹·á¹¹á¹»á¹½á¹¿áºáºƒáº…ẇẉẋáºáºáº‘ẓẕẖẗẘẙẚẛạảấầẩẫậắằẳẵặẹẻẽếá»á»ƒá»…ệỉịá»á»á»‘ồổỗộớá»á»Ÿá»¡á»£á»¥á»§á»©á»«á»­á»¯á»±á»³á»µá»·á»¹á¼€á¼á¼‚ἃἄἅἆἇá¼á¼‘ἒἓἔἕἠἡἢἣἤἥἦἧἰἱἲἳἴἵἶἷὀá½á½‚ὃὄὅá½á½‘ὒὓὔὕὖὗὠὡὢὣὤὥὦὧὰάὲέὴήὶίὸόὺύὼώᾀá¾á¾‚ᾃᾄᾅᾆᾇá¾á¾‘ᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷιῂῃῄῆῇá¿á¿‘ῒΐῖῗῠῡῢΰῤῥῦῧῲῳῴῶῷâ²â²ƒâ²…ⲇⲉⲋâ²â²â²‘ⲓⲕⲗⲙⲛâ²â²Ÿâ²¡â²£â²¥â²§â²©â²«â²­â²¯â²±â²³â²µâ²·â²¹â²»â²½â²¿â³â³ƒâ³…ⳇⳉⳋâ³â³â³‘ⳓⳕⳗⳙⳛâ³â³Ÿâ³¡â³£â³¤â´€â´â´‚ⴃⴄⴅⴆⴇⴈⴉⴊⴋⴌâ´â´Žâ´â´â´‘ⴒⴓⴔⴕⴖⴗⴘⴙⴚⴛⴜâ´â´žâ´Ÿâ´ â´¡â´¢â´£â´¤â´¥ï¬€ï¬ï¬‚ffifflſtstﬓﬔﬕﬖﬗ\d-_^]/8
+
/ End of testinput4 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput5 b/ext/pcre/pcrelib/testdata/testoutput5
index 2d9ee6949..abbe1c87d 100644
--- a/ext/pcre/pcrelib/testdata/testoutput5
+++ b/ext/pcre/pcrelib/testdata/testoutput5
@@ -364,7 +364,6 @@ No match
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: anchored utf8
No first char
No need char
@@ -387,7 +386,6 @@ No match
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: utf8
No first char
No need char
@@ -655,7 +653,6 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
No options
No first char
No need char
@@ -668,7 +665,6 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: utf8
No first char
No need char
@@ -792,7 +788,6 @@ Need char = 191
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
No options
No first char
No need char
@@ -805,7 +800,6 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Contains explicit CR or LF match
Options: utf8
No first char
No need char
@@ -942,7 +936,6 @@ Need char = 'z'
End
------------------------------------------------------------------
Capturing subpattern count = 1
-Contains explicit CR or LF match
Options: utf8
No first char
Need char = 'z'
@@ -1314,7 +1307,7 @@ Failed: missing terminating ] for character class at offset 15
0: abc8
0: abc9
-/^a\Rb/8
+/^a\Rb/8<bsr_unicode>
a\nb
0: a\x{0a}b
a\rb
@@ -1336,7 +1329,7 @@ No match
a\n\rb
No match
-/^a\R*b/8
+/^a\R*b/8<bsr_unicode>
ab
0: ab
a\nb
@@ -1356,7 +1349,7 @@ No match
a\n\r\x{85}\x0cb
0: a\x{0a}\x{0d}\x{85}\x{0c}b
-/^a\R+b/8
+/^a\R+b/8<bsr_unicode>
a\nb
0: a\x{0a}b
a\rb
@@ -1378,7 +1371,7 @@ No match
ab
No match
-/^a\R{1,3}b/8
+/^a\R{1,3}b/8<bsr_unicode>
a\nb
0: a\x{0a}b
a\n\rb
@@ -1522,4 +1515,97 @@ Error -10
\x{7fffffff}\?
No match
+/a\Rb/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\x{85}b
+No match
+ a\x0bb
+No match
+
+/a\Rb/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x0bb
+ 0: a\x{0b}b
+ ** Failers
+No match
+ a\x{85}b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/a\R?b/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\x{85}b
+No match
+ a\x0bb
+No match
+
+/a\R?b/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x0bb
+ 0: a\x{0b}b
+ ** Failers
+No match
+ a\x{85}b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/.*a.*=.b.*/8<ANY>
+ QQQ\x{2029}ABCaXYZ=!bPQR
+ 0: ABCaXYZ=!bPQR
+ ** Failers
+No match
+ a\x{2029}b
+No match
+ \x61\xe2\x80\xa9\x62
+No match
+
+/[[:a\x{100}b:]]/8
+Failed: unknown POSIX class name at offset 3
+
/ End of testinput5 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput6 b/ext/pcre/pcrelib/testdata/testoutput6
index 0a58b844f..db825b08c 100644
--- a/ext/pcre/pcrelib/testdata/testoutput6
+++ b/ext/pcre/pcrelib/testdata/testoutput6
@@ -1522,4 +1522,161 @@ No match
/(\p{Yi}{0,3}+\277)*/
+/^[\p{Arabic}]/8
+ \x{60e}
+ 0: \x{60e}
+ \x{656}
+ 0: \x{656}
+ \x{657}
+ 0: \x{657}
+ \x{658}
+ 0: \x{658}
+ \x{659}
+ 0: \x{659}
+ \x{65a}
+ 0: \x{65a}
+ \x{65b}
+ 0: \x{65b}
+ \x{65c}
+ 0: \x{65c}
+ \x{65d}
+ 0: \x{65d}
+ \x{65e}
+ 0: \x{65e}
+ \x{66a}
+ 0: \x{66a}
+ \x{6e9}
+ 0: \x{6e9}
+ \x{6ef}
+ 0: \x{6ef}
+ \x{6fa}
+ 0: \x{6fa}
+ ** Failers
+No match
+ \x{600}
+No match
+ \x{650}
+No match
+ \x{651}
+No match
+ \x{652}
+No match
+ \x{653}
+No match
+ \x{654}
+No match
+ \x{655}
+No match
+ \x{65f}
+No match
+
+/^\p{Cyrillic}/8
+ \x{1d2b}
+ 0: \x{1d2b}
+
+/^\p{Common}/8
+ \x{589}
+ 0: \x{589}
+ \x{60c}
+ 0: \x{60c}
+ \x{61f}
+ 0: \x{61f}
+ \x{964}
+ 0: \x{964}
+ \x{965}
+ 0: \x{965}
+ \x{970}
+ 0: \x{970}
+
+/^\p{Inherited}/8
+ \x{64b}
+ 0: \x{64b}
+ \x{654}
+ 0: \x{654}
+ \x{655}
+ 0: \x{655}
+ \x{200c}
+ 0: \x{200c}
+ ** Failers
+No match
+ \x{64a}
+No match
+ \x{656}
+No match
+
+/^\p{Shavian}/8
+ \x{10450}
+ 0: \x{10450}
+ \x{1047f}
+ 0: \x{1047f}
+
+/^\p{Deseret}/8
+ \x{10400}
+ 0: \x{10400}
+ \x{1044f}
+ 0: \x{1044f}
+
+/^\p{Osmanya}/8
+ \x{10480}
+ 0: \x{10480}
+ \x{1049d}
+ 0: \x{1049d}
+ \x{104a0}
+ 0: \x{104a0}
+ \x{104a9}
+ 0: \x{104a9}
+ ** Failers
+No match
+ \x{1049e}
+No match
+ \x{1049f}
+No match
+ \x{104aa}
+No match
+
+/\p{Zl}{2,3}+/8BZ
+------------------------------------------------------------------
+ Bra
+ prop Zl {2}
+ prop Zl ?+
+ Ket
+ End
+------------------------------------------------------------------
+ \xe2\x80\xa8\xe2\x80\xa8
+ 0: \x{2028}\x{2028}
+ \x{2028}\x{2028}\x{2028}
+ 0: \x{2028}\x{2028}\x{2028}
+
+/\p{Zl}/8BZ
+------------------------------------------------------------------
+ Bra
+ prop Zl
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Lu}{3}+/8BZ
+------------------------------------------------------------------
+ Bra
+ prop Lu {3}
+ Ket
+ End
+------------------------------------------------------------------
+
+/\pL{2}+/8BZ
+------------------------------------------------------------------
+ Bra
+ prop L {2}
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Cc}{2}+/8BZ
+------------------------------------------------------------------
+ Bra
+ prop Cc {2}
+ Ket
+ End
+------------------------------------------------------------------
+
/ End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput7 b/ext/pcre/pcrelib/testdata/testoutput7
index 39c50750e..d8e3833f3 100644
--- a/ext/pcre/pcrelib/testdata/testoutput7
+++ b/ext/pcre/pcrelib/testdata/testoutput7
@@ -6824,7 +6824,7 @@ No match
0: abc6
0: abc9
-/^a\Rb/
+/^a\Rb/<bsr_unicode>
a\nb
0: a\x0ab
a\rb
@@ -6842,7 +6842,7 @@ No match
a\n\rb
No match
-/^a\R*b/
+/^a\R*b/<bsr_unicode>
ab
0: ab
a\nb
@@ -6862,7 +6862,7 @@ No match
a\n\r\x85\x0cb
0: a\x0a\x0d\x85\x0cb
-/^a\R+b/
+/^a\R+b/<bsr_unicode>
a\nb
0: a\x0ab
a\rb
@@ -6884,7 +6884,7 @@ No match
ab
No match
-/^a\R{1,3}b/
+/^a\R{1,3}b/<bsr_unicode>
a\nb
0: a\x0ab
a\n\rb
@@ -6906,7 +6906,7 @@ No match
a\r
No match
-/^a[\R]b/
+/^a[\R]b/<bsr_unicode>
aRb
0: aRb
** Failers
@@ -7088,4 +7088,128 @@ No match
\r\nA
0: \x0aA
+/a\Rb/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ ** Failers
+No match
+ a\x85b
+No match
+ a\x0bb
+No match
+
+/a\Rb/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x85b
+ 0: a\x85b
+ a\x0bb
+ 0: a\x0bb
+ ** Failers
+No match
+ a\x85b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/a\R?b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ ** Failers
+No match
+ a\x85b
+No match
+ a\x0bb
+No match
+
+/a\R?b/I<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ a\r\nb
+ 0: a\x0d\x0ab
+ a\x85b
+ 0: a\x85b
+ a\x0bb
+ 0: a\x0bb
+ ** Failers
+No match
+ a\x85b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/a\R{2,4}b/I<bsr_anycrlf>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_anycrlf
+First char = 'a'
+Need char = 'b'
+ a\r\n\nb
+ 0: a\x0d\x0a\x0ab
+ a\n\r\rb
+ 0: a\x0a\x0d\x0db
+ a\r\n\r\n\r\n\r\nb
+ 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
+ ** Failers
+No match
+ a\x85\85b
+No match
+ a\x0b\0bb
+No match
+
+/a\R{2,4}b/I<bsr_unicode>
+Capturing subpattern count = 0
+Partial matching not supported
+Options: bsr_unicode
+First char = 'a'
+Need char = 'b'
+ a\r\rb
+ 0: a\x0d\x0db
+ a\n\n\nb
+ 0: a\x0a\x0a\x0ab
+ a\r\n\n\r\rb
+ 0: a\x0d\x0a\x0a\x0d\x0db
+ a\x85\85b
+No match
+ a\x0b\0bb
+No match
+ ** Failers
+No match
+ a\r\r\r\r\rb
+No match
+ a\x85\85b\<bsr_anycrlf>
+No match
+ a\x0b\0bb\<bsr_anycrlf>
+No match
+
/ End of testinput7 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput8 b/ext/pcre/pcrelib/testdata/testoutput8
index db0f4ade3..631e5b82f 100644
--- a/ext/pcre/pcrelib/testdata/testoutput8
+++ b/ext/pcre/pcrelib/testdata/testoutput8
@@ -1052,7 +1052,7 @@ No match
0: abc8
0: abc9
-/^a\Rb/8
+/^a\Rb/8<bsr_unicode>
a\nb
0: a\x{0a}b
a\rb
@@ -1074,7 +1074,7 @@ No match
a\n\rb
No match
-/^a\R*b/8
+/^a\R*b/8<bsr_unicode>
ab
0: ab
a\nb
@@ -1094,7 +1094,7 @@ No match
a\n\r\x{85}\x0cb
0: a\x{0a}\x{0d}\x{85}\x{0c}b
-/^a\R+b/8
+/^a\R+b/8<bsr_unicode>
a\nb
0: a\x{0a}b
a\rb
@@ -1116,7 +1116,7 @@ No match
ab
No match
-/^a\R{1,3}b/8
+/^a\R{1,3}b/8<bsr_unicode>
a\nb
0: a\x{0a}b
a\n\rb
@@ -1204,4 +1204,84 @@ No match
\x09\x{200a}\x{a0}\x{2028}\x0b
No match
+/a\Rb/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\x{85}b
+No match
+ a\x0bb
+No match
+
+/a\Rb/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x0bb
+ 0: a\x{0b}b
+ ** Failers
+No match
+ a\x{85}b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
+/a\R?b/I8<bsr_anycrlf>
+Capturing subpattern count = 0
+Options: bsr_anycrlf utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ ** Failers
+No match
+ a\x{85}b
+No match
+ a\x0bb
+No match
+
+/a\R?b/I8<bsr_unicode>
+Capturing subpattern count = 0
+Options: bsr_unicode utf8
+First char = 'a'
+Need char = 'b'
+ a\rb
+ 0: a\x{0d}b
+ a\nb
+ 0: a\x{0a}b
+ a\r\nb
+ 0: a\x{0d}\x{0a}b
+ a\x{85}b
+ 0: a\x{85}b
+ a\x0bb
+ 0: a\x{0b}b
+ ** Failers
+No match
+ a\x{85}b\<bsr_anycrlf>
+No match
+ a\x0bb\<bsr_anycrlf>
+No match
+
/ End of testinput 8 /
diff --git a/ext/pcre/pcrelib/ucptable.h b/ext/pcre/pcrelib/ucptable.h
index 07eaced8f..a274d443e 100644
--- a/ext/pcre/pcrelib/ucptable.h
+++ b/ext/pcre/pcrelib/ucptable.h
@@ -539,7 +539,8 @@ static const cnode ucp_table[] = {
{ 0x21000293, 0x14000000 },
{ 0x21000294, 0x1c000000 },
{ 0x21800295, 0x1400001a },
- { 0x218002b0, 0x18000011 },
+ { 0x218002b0, 0x18000008 },
+ { 0x098002b9, 0x18000008 },
{ 0x098002c2, 0x60000003 },
{ 0x098002c6, 0x1800000b },
{ 0x098002d2, 0x6000000d },
@@ -1039,15 +1040,18 @@ static const cnode ucp_table[] = {
{ 0x198005f3, 0x54000001 },
{ 0x09800600, 0x04000003 },
{ 0x0000060b, 0x5c000000 },
- { 0x0980060c, 0x54000001 },
+ { 0x0900060c, 0x54000000 },
+ { 0x0000060d, 0x54000000 },
{ 0x0080060e, 0x68000001 },
{ 0x00800610, 0x30000005 },
{ 0x0900061b, 0x54000000 },
- { 0x0080061e, 0x54000001 },
+ { 0x0000061e, 0x54000000 },
+ { 0x0900061f, 0x54000000 },
{ 0x00800621, 0x1c000019 },
{ 0x09000640, 0x18000000 },
{ 0x00800641, 0x1c000009 },
- { 0x1b80064b, 0x30000013 },
+ { 0x1b80064b, 0x3000000a },
+ { 0x00800656, 0x30000008 },
{ 0x09800660, 0x34000009 },
{ 0x0080066a, 0x54000003 },
{ 0x0080066e, 0x1c000001 },
@@ -1074,7 +1078,8 @@ static const cnode ucp_table[] = {
{ 0x31000711, 0x30000000 },
{ 0x31800712, 0x1c00001d },
{ 0x31800730, 0x3000001a },
- { 0x3180074d, 0x1c000020 },
+ { 0x3180074d, 0x1c000002 },
+ { 0x00800750, 0x1c00001d },
{ 0x37800780, 0x1c000025 },
{ 0x378007a6, 0x3000000a },
{ 0x370007b1, 0x1c000000 },
@@ -1460,7 +1465,10 @@ static const cnode ucp_table[] = {
{ 0x1f0017dd, 0x30000000 },
{ 0x1f8017e0, 0x34000009 },
{ 0x1f8017f0, 0x3c000009 },
- { 0x25801800, 0x54000005 },
+ { 0x25801800, 0x54000001 },
+ { 0x09801802, 0x54000001 },
+ { 0x25001804, 0x54000000 },
+ { 0x09001805, 0x54000000 },
{ 0x25001806, 0x44000000 },
{ 0x25801807, 0x54000003 },
{ 0x2580180b, 0x30000002 },
@@ -1513,14 +1521,20 @@ static const cnode ucp_table[] = {
{ 0x3d801b61, 0x68000009 },
{ 0x3d801b6b, 0x30000008 },
{ 0x3d801b74, 0x68000008 },
- { 0x21801d00, 0x1400002b },
- { 0x21801d2c, 0x18000035 },
- { 0x21801d62, 0x14000015 },
+ { 0x21801d00, 0x14000025 },
+ { 0x13801d26, 0x14000004 },
+ { 0x0c001d2b, 0x14000000 },
+ { 0x21801d2c, 0x18000030 },
+ { 0x13801d5d, 0x18000004 },
+ { 0x21801d62, 0x14000003 },
+ { 0x13801d66, 0x14000004 },
+ { 0x21801d6b, 0x1400000c },
{ 0x0c001d78, 0x18000000 },
{ 0x21801d79, 0x14000003 },
{ 0x21001d7d, 0x14000ee6 },
{ 0x21801d7e, 0x1400001c },
- { 0x21801d9b, 0x18000024 },
+ { 0x21801d9b, 0x18000023 },
+ { 0x13001dbf, 0x18000000 },
{ 0x1b801dc0, 0x3000000a },
{ 0x1b801dfe, 0x30000001 },
{ 0x21001e00, 0x24000001 },
@@ -1982,7 +1996,9 @@ static const cnode ucp_table[] = {
{ 0x13001ffc, 0x2000fff7 },
{ 0x13801ffd, 0x60000001 },
{ 0x09802000, 0x7400000a },
- { 0x0980200b, 0x04000004 },
+ { 0x0900200b, 0x04000000 },
+ { 0x1b80200c, 0x04000001 },
+ { 0x0980200e, 0x04000001 },
{ 0x09802010, 0x44000005 },
{ 0x09802016, 0x54000001 },
{ 0x09002018, 0x50000000 },
@@ -2615,7 +2631,8 @@ static const cnode ucp_table[] = {
{ 0x090030a0, 0x44000000 },
{ 0x1d8030a1, 0x1c000059 },
{ 0x090030fb, 0x54000000 },
- { 0x098030fc, 0x18000002 },
+ { 0x090030fc, 0x18000000 },
+ { 0x1d8030fd, 0x18000001 },
{ 0x1d0030ff, 0x1c000000 },
{ 0x03803105, 0x1c000027 },
{ 0x17803131, 0x1c00005d },
@@ -2630,7 +2647,8 @@ static const cnode ucp_table[] = {
{ 0x0980322a, 0x68000019 },
{ 0x09003250, 0x68000000 },
{ 0x09803251, 0x3c00000e },
- { 0x17803260, 0x6800001f },
+ { 0x17803260, 0x6800001d },
+ { 0x0980327e, 0x68000001 },
{ 0x09803280, 0x3c000009 },
{ 0x0980328a, 0x68000026 },
{ 0x098032b1, 0x3c00000e },
@@ -2678,7 +2696,8 @@ static const cnode ucp_table[] = {
{ 0x1900fb3e, 0x1c000000 },
{ 0x1980fb40, 0x1c000001 },
{ 0x1980fb43, 0x1c000001 },
- { 0x1980fb46, 0x1c00006b },
+ { 0x1980fb46, 0x1c000009 },
+ { 0x0080fb50, 0x1c000061 },
{ 0x0080fbd3, 0x1c00016a },
{ 0x0900fd3e, 0x58000000 },
{ 0x0900fd3f, 0x48000000 },
@@ -2944,7 +2963,8 @@ static const cnode ucp_table[] = {
{ 0x0d01044d, 0x1400ffd8 },
{ 0x0d01044e, 0x1400ffd8 },
{ 0x0d01044f, 0x1400ffd8 },
- { 0x2e810450, 0x1c00004d },
+ { 0x2e810450, 0x1c00002f },
+ { 0x2c810480, 0x1c00001d },
{ 0x2c8104a0, 0x34000009 },
{ 0x0b810800, 0x1c000005 },
{ 0x0b010808, 0x1c000000 },
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 2cf8ed3a1..e728c7354 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcre.c,v 1.168.2.9.2.21 2007/09/20 08:10:44 tony2001 Exp $ */
+/* $Id: php_pcre.c,v 1.168.2.9.2.25 2008/02/20 22:08:18 felipe Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -48,7 +48,7 @@ enum {
PHP_PCRE_INTERNAL_ERROR,
PHP_PCRE_BACKTRACK_LIMIT_ERROR,
PHP_PCRE_RECURSION_LIMIT_ERROR,
- PHP_PCRE_BAD_UTF8_ERROR,
+ PHP_PCRE_BAD_UTF8_ERROR
};
@@ -1535,7 +1535,9 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
}
- if (!no_empty || start_offset != subject_len)
+ start_offset = last_match - subject; /* the offset might have been incremented, but without further successful matches */
+
+ if (!no_empty || start_offset < subject_len)
{
if (offset_capture) {
/* Add the last (match, offset) pair to the return value */
@@ -1742,7 +1744,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
zend_hash_move_forward(Z_ARRVAL_P(input));
}
-
+ zend_hash_internal_pointer_reset(Z_ARRVAL_P(input));
/* Clean up */
efree(offsets);
}
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index 394311afd..9fe3f541d 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcre.h,v 1.41.2.1.2.5 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pcre.h,v 1.41.2.1.2.6 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PCRE_H
#define PHP_PCRE_H
diff --git a/ext/pcre/tests/bug42945.phpt b/ext/pcre/tests/bug42945.phpt
new file mode 100644
index 000000000..c6d2b8249
--- /dev/null
+++ b/ext/pcre/tests/bug42945.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Bug #42945 (preg_split() swallows part of the string)
+--FILE--
+<?php
+
+var_dump(preg_match_all('/\b/', "a'", $m, PREG_OFFSET_CAPTURE));
+var_dump($m);
+
+var_dump(preg_split('/\b/', "a'"));
+var_dump(preg_split('/\b/', "a'", -1, PREG_SPLIT_OFFSET_CAPTURE));
+var_dump(preg_split('/\b/', "a'", -1, PREG_SPLIT_NO_EMPTY));
+var_dump(preg_split('/\b/', "a'", -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_OFFSET_CAPTURE));
+
+?>
+--EXPECT--
+int(2)
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ int(0)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ int(1)
+ }
+ }
+}
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "'"
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ int(0)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ int(0)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "'"
+ [1]=>
+ int(1)
+ }
+}
+array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "'"
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ int(0)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "'"
+ [1]=>
+ int(1)
+ }
+}
diff --git a/ext/pcre/tests/bug44191.phpt b/ext/pcre/tests/bug44191.phpt
new file mode 100644
index 000000000..52b449091
--- /dev/null
+++ b/ext/pcre/tests/bug44191.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #44191 (preg_grep messes up array index)
+--FILE--
+<?php
+
+$array = range(1, 10);
+
+preg_grep('/asdf/', $array);
+
+while (list($x) = each($array)) {
+ print $x;
+}
+
+?>
+--EXPECT--
+0123456789
diff --git a/ext/pcre/tests/preg_grep_basic.phpt b/ext/pcre/tests/preg_grep_basic.phpt
new file mode 100644
index 000000000..fe9d7ceaa
--- /dev/null
+++ b/ext/pcre/tests/preg_grep_basic.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test preg_grep() function : basic functionality
+--FILE--
+<?php
+/*
+* proto array preg_grep(string regex, array input [, int flags])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+$array = array('HTTP://WWW.EXAMPLE.COM', '/index.html', '/info/stat/', 'http://test.uk.com/index/html', '/display/dept.php');
+var_dump($array);
+var_dump(preg_grep('@^HTTP(.*?)\w{2,}$@i', $array)); //finds a string starting with http (regardless of case) (matches two)
+var_dump(preg_grep('@(/\w+\.*/*)+@', $array)); //finds / followed by one or more of a-z, A-Z and 0-9, followed by zero or more . followed by zero or more / all more than once. (matches all)
+var_dump(preg_grep('@^http://[^w]{3}.*$@i', $array)); //finds http:// (at the beginning of a string) not followed by 3 characters that aren't w's then anything to the end of the sttring (matches one)
+var_dump(preg_grep('@.*?\.co\.uk$@i', $array)); //finds any address ending in .co.uk (matches none)
+var_dump(preg_grep('@^HTTP(.*?)\w{2,}$@i', $array, PREG_GREP_INVERT)); //same as first example but the array created contains everything that is NOT matched but the regex (matches three)
+
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ string(22) "HTTP://WWW.EXAMPLE.COM"
+ [1]=>
+ string(11) "/index.html"
+ [2]=>
+ string(11) "/info/stat/"
+ [3]=>
+ string(29) "http://test.uk.com/index/html"
+ [4]=>
+ string(17) "/display/dept.php"
+}
+array(2) {
+ [0]=>
+ string(22) "HTTP://WWW.EXAMPLE.COM"
+ [3]=>
+ string(29) "http://test.uk.com/index/html"
+}
+array(5) {
+ [0]=>
+ string(22) "HTTP://WWW.EXAMPLE.COM"
+ [1]=>
+ string(11) "/index.html"
+ [2]=>
+ string(11) "/info/stat/"
+ [3]=>
+ string(29) "http://test.uk.com/index/html"
+ [4]=>
+ string(17) "/display/dept.php"
+}
+array(1) {
+ [3]=>
+ string(29) "http://test.uk.com/index/html"
+}
+array(0) {
+}
+array(3) {
+ [1]=>
+ string(11) "/index.html"
+ [2]=>
+ string(11) "/info/stat/"
+ [4]=>
+ string(17) "/display/dept.php"
+}
diff --git a/ext/pcre/tests/preg_grep_error.phpt b/ext/pcre/tests/preg_grep_error.phpt
new file mode 100644
index 000000000..f2afdb9d2
--- /dev/null
+++ b/ext/pcre/tests/preg_grep_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test preg_grep() function : error conditions - wrong numbers of parameters
+--FILE--
+<?php
+/*
+* proto array preg_grep(string regex, array input [, int flags])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+echo "*** Testing preg_grep() : error conditions ***\n";
+// Zero arguments
+echo "\n-- Testing preg_grep() function with Zero arguments --\n";
+var_dump(preg_grep());
+//Test preg_grep with one more than the expected number of arguments
+echo "\n-- Testing preg_grep() function with more than expected no. of arguments --\n";
+$regex = '/\d/';
+$input = array(1, 2);
+$flags = 0;
+$extra_arg = 10;
+var_dump(preg_grep($regex, $input, $flags, $extra_arg));
+// Testing preg_grep withone less than the expected number of arguments
+echo "\n-- Testing preg_grep() function with less than expected no. of arguments --\n";
+$regex = 'string_val';
+var_dump(preg_grep($regex));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing preg_grep() : error conditions ***
+
+-- Testing preg_grep() function with Zero arguments --
+
+Warning: preg_grep() expects at least 2 parameters, 0 given in %spreg_grep_error.php on line %d
+NULL
+
+-- Testing preg_grep() function with more than expected no. of arguments --
+
+Warning: preg_grep() expects at most 3 parameters, 4 given in %spreg_grep_error.php on line %d
+NULL
+
+-- Testing preg_grep() function with less than expected no. of arguments --
+
+Warning: preg_grep() expects at least 2 parameters, 1 given in %spreg_grep_error.php on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt
new file mode 100644
index 000000000..29dfc5af1
--- /dev/null
+++ b/ext/pcre/tests/preg_grep_error1.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test preg_grep() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/*
+* proto array preg_grep(string regex, array input [, int flags])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_grep reacts to being passed bad regexes
+*/
+echo "*** Testing preg_grep() : error conditions ***\n";
+$values = array('abcdef', //Regex without delimeter
+'/[a-zA-Z]', //Regex without closing delimeter
+'[a-zA-Z]/', //Regex without opening delimeter
+'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
+'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
+);
+$array = array(123, 'abc', 'test');
+foreach($values as $value) {
+ print "\nArg value is $value\n";
+ var_dump(preg_grep($value, $array));
+}
+$value = new stdclass(); //Object
+var_dump(preg_grep($value, $array));
+echo "Done"
+?>
+--EXPECTF--
+
+*** Testing preg_grep() : error conditions ***
+
+Arg value is abcdef
+
+Warning: preg_grep(): Delimiter must not be alphanumeric or backslash in %spreg_grep_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]
+
+Warning: preg_grep(): No ending delimiter '/' found in %spreg_grep_error1.php on line %d
+bool(false)
+
+Arg value is [a-zA-Z]/
+
+Warning: preg_grep(): Unknown modifier '/' in %spreg_grep_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]/F
+
+Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d
+bool(false)
+
+Arg value is Array
+
+Warning: preg_grep() expects parameter 1 to be string, array given in %spreg_grep_error1.php on line %d
+NULL
+
+Arg value is /[a-zA-Z]/
+array(2) {
+ [1]=>
+ string(3) "abc"
+ [2]=>
+ string(4) "test"
+}
+
+Warning: preg_grep() expects parameter 1 to be string, object given in %spreg_grep_error1.php on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/pcre/tests/preg_grep_error2.phpt b/ext/pcre/tests/preg_grep_error2.phpt
new file mode 100644
index 000000000..aa4dae98a
--- /dev/null
+++ b/ext/pcre/tests/preg_grep_error2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test preg_grep() function : error conditions - wrong arg types
+--FILE--
+<?php
+/*
+* proto array preg_grep(string regex, array input [, int flags])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_grep reacts to being passed the wrong type of input argument
+*/
+echo "*** Testing preg_grep() : error conditions ***\n";
+$regex = '/[a-zA-Z]/';
+$input = array('this is a string', array('this is', 'a subarray'),);
+foreach($input as $value) {
+ print "\nArg value is: $value\n";
+ var_dump(preg_grep($regex, $value));
+}
+$value = new stdclass(); //Object
+var_dump(preg_grep($regex, $value));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing preg_grep() : error conditions ***
+
+Arg value is: this is a string
+
+Warning: preg_grep() expects parameter 2 to be array, string given in %spreg_grep_error2.php on line %d
+NULL
+
+Arg value is: Array
+array(2) {
+ [0]=>
+ string(7) "this is"
+ [1]=>
+ string(10) "a subarray"
+}
+
+Warning: preg_grep() expects parameter 2 to be array, object given in %spreg_grep_error2.php on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/pcre/tests/preg_match_all_basic.phpt b/ext/pcre/tests/preg_match_all_basic.phpt
new file mode 100644
index 000000000..06dec1cb4
--- /dev/null
+++ b/ext/pcre/tests/preg_match_all_basic.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test preg_match_all() function : basic functionality
+--FILE--
+<?php
+/*
+* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+$string = 'Hello, world! This is a test. This is another test. \[4]. 34534 string.';
+var_dump(preg_match_all('/[0-35-9]/', $string, $match1, PREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER, -10)); //finds any digit that's not 4 10 digits from the end(1 match)
+var_dump($match1);
+var_dump(preg_match_all('/[tT]his is a(.*?)\./', $string, $match2, PREG_SET_ORDER)); //finds "This is a test." and "This is another test." (non-greedy) (2 matches)
+var_dump($match2);
+var_dump(preg_match_all('@\. \\\(.*).@', $string, $match3, PREG_PATTERN_ORDER)); //finds ".\ [...]" and everything else to the end of the string. (greedy) (1 match)
+var_dump($match3);
+var_dump(preg_match_all('/\d{2}$/', $string, $match4)); //tries to find 2 digits at the end of a string (0 matches)
+var_dump($match4);
+var_dump(preg_match_all('/(This is a ){2}(.*)\stest/', $string, $match5)); //tries to find "This is aThis is a [...] test" (0 matches)
+var_dump($match5);
+?>
+--EXPECTF--
+int(1)
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ int(61)
+ }
+ }
+}
+int(2)
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(15) "This is a test."
+ [1]=>
+ string(5) " test"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(21) "This is another test."
+ [1]=>
+ string(11) "nother test"
+ }
+}
+int(1)
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(21) ". \[4]. 34534 string."
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(17) "[4]. 34534 string"
+ }
+}
+int(0)
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+int(0)
+array(3) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ array(0) {
+ }
+}
diff --git a/ext/pcre/tests/preg_match_all_error.phpt b/ext/pcre/tests/preg_match_all_error.phpt
new file mode 100644
index 000000000..2371ccfef
--- /dev/null
+++ b/ext/pcre/tests/preg_match_all_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test preg_match_all() function : error conditions - incorrect number of parameters
+--FILE--
+<?php
+/*
+* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+echo "*** Testing preg_match_all() : error conditions ***\n";
+// Zero arguments
+echo "\n-- Testing preg_match_all() function with Zero arguments --\n";
+var_dump(preg_match_all());
+//Test preg_match_all with one more than the expected number of arguments
+echo "\n-- Testing preg_match_all() function with more than expected no. of arguments --\n";
+$pattern = '/\w/';
+$subject = 'string_val';
+$flags = PREG_OFFSET_CAPTURE;
+$offset = 10;
+$extra_arg = 10;
+var_dump(preg_match_all($pattern, $subject, $matches, $flags, $offset, $extra_arg));
+// Testing preg_match_all withone less than the expected number of arguments
+echo "\n-- Testing preg_match_all() function with less than expected no. of arguments --\n";
+$pattern = '/\w/';
+$subject = 'string_val';
+var_dump(preg_match_all($pattern, $subject));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing preg_match_all() : error conditions ***
+
+-- Testing preg_match_all() function with Zero arguments --
+
+Warning: preg_match_all() expects at least 3 parameters, 0 given in %spreg_match_all_error.php on line %d
+bool(false)
+
+-- Testing preg_match_all() function with more than expected no. of arguments --
+
+Warning: preg_match_all() expects at most 5 parameters, 6 given in %spreg_match_all_error.php on line %d
+bool(false)
+
+-- Testing preg_match_all() function with less than expected no. of arguments --
+
+Warning: preg_match_all() expects at least 3 parameters, 2 given in %spreg_match_all_error.php on line %d
+bool(false)
+Done
diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt
new file mode 100644
index 000000000..a3cb68404
--- /dev/null
+++ b/ext/pcre/tests/preg_match_all_error1.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test preg_match_all() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/*
+* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_match_all reacts to being passed the wrong type of regex argument
+*/
+echo "*** Testing preg_match_all() : error conditions ***\n";
+$regex_array = array('abcdef', //Regex without delimeter
+'/[a-zA-Z]', //Regex without closing delimeter
+'[a-zA-Z]/', //Regex without opening delimeter
+'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
+'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
+);
+$subject = 'test';
+foreach($regex_array as $regex_value) {
+ print "\nArg value is $regex_value\n";
+ var_dump(preg_match_all($regex_value, $subject, $matches1));
+ var_dump($matches1);
+}
+$regex_value = new stdclass(); //Object
+var_dump(preg_match_all($regex_value, $subject, $matches));
+var_dump($matches);
+?>
+--EXPECTF--
+*** Testing preg_match_all() : error conditions ***
+
+Arg value is abcdef
+
+Warning: preg_match_all(): Delimiter must not be alphanumeric or backslash in %spreg_match_all_error1.php on line %d
+bool(false)
+NULL
+
+Arg value is /[a-zA-Z]
+
+Warning: preg_match_all(): No ending delimiter '/' found in %spreg_match_all_error1.php on line %d
+bool(false)
+NULL
+
+Arg value is [a-zA-Z]/
+
+Warning: preg_match_all(): Unknown modifier '/' in %spreg_match_all_error1.php on line %d
+bool(false)
+NULL
+
+Arg value is /[a-zA-Z]/F
+
+Warning: preg_match_all(): Unknown modifier 'F' in %spreg_match_all_error1.php on line %d
+bool(false)
+NULL
+
+Arg value is Array
+
+Warning: preg_match_all() expects parameter 1 to be string, array given in %spreg_match_all_error1.php on line %d
+bool(false)
+NULL
+
+Arg value is /[a-zA-Z]/
+int(4)
+array(1) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "t"
+ [1]=>
+ string(1) "e"
+ [2]=>
+ string(1) "s"
+ [3]=>
+ string(1) "t"
+ }
+}
+
+Warning: preg_match_all() expects parameter 1 to be string, object given in %spreg_match_all_error1.php on line %d
+bool(false)
+NULL
diff --git a/ext/pcre/tests/preg_match_all_error2.phpt b/ext/pcre/tests/preg_match_all_error2.phpt
new file mode 100644
index 000000000..1c55cce64
--- /dev/null
+++ b/ext/pcre/tests/preg_match_all_error2.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test preg_match_all() function : error conditions - wrong arg types
+--FILE--
+<?php
+/*
+* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_match_all reacts to being passed the wrong type of input argument
+*/
+echo "*** Testing preg_match_all() : error conditions ***\n";
+$regex = '/[a-zA-Z]/';
+$value = new stdclass(); //Object
+var_dump(preg_match_all($regex, $value, $matches));
+var_dump($matches);
+$input = array(array('this is', 'a subarray'), 'test',);
+foreach($input as $value) {
+ print "\nArg value is: $value\n";
+ var_dump(preg_match_all($regex, $value, $matches));
+ var_dump($matches);
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing preg_match_all() : error conditions ***
+
+Warning: preg_match_all() expects parameter 2 to be string, object given in %spreg_match_all_error2.php on line %d
+bool(false)
+NULL
+
+Arg value is: Array
+
+Warning: preg_match_all() expects parameter 2 to be string, array given in %spreg_match_all_error2.php on line %d
+bool(false)
+NULL
+
+Arg value is: test
+int(4)
+array(1) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "t"
+ [1]=>
+ string(1) "e"
+ [2]=>
+ string(1) "s"
+ [3]=>
+ string(1) "t"
+ }
+}
+Done
diff --git a/ext/pcre/tests/preg_match_all_error3.phpt b/ext/pcre/tests/preg_match_all_error3.phpt
new file mode 100644
index 000000000..b8b2ea211
--- /dev/null
+++ b/ext/pcre/tests/preg_match_all_error3.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test preg_match_all() function : error conditions
+--FILE--
+<?php
+/*
+* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+/*
+* Testing how preg_match_all reacts to being passed the wrong type of subpatterns array argument
+*/
+echo "*** Testing preg_match_all() : error conditions ***\n";
+$regex = '/[a-z]/';
+$subject = 'string';
+var_dump(preg_match_all($regex, $subject, test));
+echo "Done";
+?>
+--EXPECTF--
+
+Fatal error: Only variables can be passed by reference in %spreg_match_all_error3.php on line %d
diff --git a/ext/pcre/tests/preg_match_basic.phpt b/ext/pcre/tests/preg_match_basic.phpt
new file mode 100644
index 000000000..ddf54a0aa
--- /dev/null
+++ b/ext/pcre/tests/preg_match_basic.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test preg_match() function : basic functionality
+--FILE--
+<?php
+/*
+ * proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
+ * Function is implemented in ext/pcre/php_pcre.c
+*/
+$string = 'Hello, world. [*], this is \ a string';
+var_dump(preg_match('/^[hH]ello,\s/', $string, $match1)); //finds "Hello, "
+var_dump($match1);
+var_dump(preg_match('/l^o,\s\w{5}/', $string, $match2, PREG_OFFSET_CAPTURE)); // tries to find "lo, world" at start of string
+var_dump($match2);
+var_dump(preg_match('/\[\*\],\s(.*)/', $string, $match3)); //finds "[*], this is \ a string";
+var_dump($match3);
+var_dump(preg_match('@\w{4}\s\w{2}\s\\\(?:\s.*)@', $string, $match4, PREG_OFFSET_CAPTURE, 14)); //finds "this is \ a string" (with non-capturing parentheses)
+var_dump($match4);
+var_dump(preg_match('/hello world/', $string, $match5)); //tries to find "hello world" (should be Hello, world)
+var_dump($match5);
+?>
+
+--EXPECTF--
+
+int(1)
+array(1) {
+ [0]=>
+ string(7) "Hello, "
+}
+int(0)
+array(0) {
+}
+int(1)
+array(2) {
+ [0]=>
+ string(23) "[*], this is \ a string"
+ [1]=>
+ string(18) "this is \ a string"
+}
+int(1)
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(18) "this is \ a string"
+ [1]=>
+ int(19)
+ }
+}
+int(0)
+array(0) {
+}
+
diff --git a/ext/pcre/tests/preg_match_error.phpt b/ext/pcre/tests/preg_match_error.phpt
new file mode 100644
index 000000000..ca1f128ad
--- /dev/null
+++ b/ext/pcre/tests/preg_match_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test preg_match() function : error conditions - wrong numbers of parameters
+--FILE--
+<?php
+/*
+ * proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
+ * Function is implemented in ext/pcre/php_pcre.c
+*/
+echo "*** Testing preg_match() : error conditions ***\n";
+// Zero arguments
+echo "\n-- Testing preg_match() function with Zero arguments --\n";
+var_dump(preg_match());
+//Test preg_match with one more than the expected number of arguments
+echo "\n-- Testing preg_match() function with more than expected no. of arguments --\n";
+$pattern = '/\w/';
+$subject = 'string_val';
+$flags = PREG_OFFSET_CAPTURE;
+$offset = 10;
+$extra_arg = 10;
+var_dump(preg_match($pattern, $subject, $matches, $flags, $offset, $extra_arg));
+// Testing preg_match withone less than the expected number of arguments
+echo "\n-- Testing preg_match() function with less than expected no. of arguments --\n";
+$pattern = '/\w/';
+var_dump(preg_match($pattern));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing preg_match() : error conditions ***
+
+-- Testing preg_match() function with Zero arguments --
+
+Warning: preg_match() expects at least 2 parameters, 0 given in %spreg_match_error.php on line %d
+bool(false)
+
+-- Testing preg_match() function with more than expected no. of arguments --
+
+Warning: preg_match() expects at most 5 parameters, 6 given in %spreg_match_error.php on line %d
+bool(false)
+
+-- Testing preg_match() function with less than expected no. of arguments --
+
+Warning: preg_match() expects at least 2 parameters, 1 given in %spreg_match_error.php on line %d
+bool(false)
+Done
diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt
new file mode 100644
index 000000000..763048151
--- /dev/null
+++ b/ext/pcre/tests/preg_match_error1.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test preg_match() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/*
+ * proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
+ * Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_match reacts to being passed the wrong type of regex argument
+*/
+echo "*** Testing preg_match() : error conditions ***\n";
+$regex_array = array('abcdef', //Regex without delimeter
+'/[a-zA-Z]', //Regex without closing delimeter
+'[a-zA-Z]/', //Regex without opening delimeter
+'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
+'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
+);
+$subject = 'this is a test';
+foreach($regex_array as $regex_value) {
+ print "\nArg value is $regex_value\n";
+ var_dump(preg_match($regex_value, $subject));
+}
+$regex_value = new stdclass(); //Object
+var_dump(preg_match($regex_value, $subject));
+?>
+--EXPECTF--
+
+*** Testing preg_match() : error conditions ***
+
+Arg value is abcdef
+
+Warning: preg_match(): Delimiter must not be alphanumeric or backslash in %spreg_match_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]
+
+Warning: preg_match(): No ending delimiter '/' found in %spreg_match_error1.php on line %d
+bool(false)
+
+Arg value is [a-zA-Z]/
+
+Warning: preg_match(): Unknown modifier '/' in %spreg_match_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]/F
+
+Warning: preg_match(): Unknown modifier 'F' in %spreg_match_error1.php on line %d
+bool(false)
+
+Arg value is Array
+
+Warning: preg_match() expects parameter 1 to be string, array given in %spreg_match_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]/
+int(1)
+
+Warning: preg_match() expects parameter 1 to be string, object given in %spreg_match_error1.php on line %d
+bool(false)
diff --git a/ext/pcre/tests/preg_match_error2.phpt b/ext/pcre/tests/preg_match_error2.phpt
new file mode 100644
index 000000000..f30fb4803
--- /dev/null
+++ b/ext/pcre/tests/preg_match_error2.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test preg_match() function : error conditions - wrong arg types
+--FILE--
+<?php
+/*
+ * proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
+ * Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_match reacts to being passed the wrong type of subject argument
+*/
+echo "*** Testing preg_match() : error conditions ***\n";
+$regex = '/[a-zA-Z]/';
+$input = array('this is a string', array('this is', 'a subarray'),);
+foreach($input as $value) {
+ print "\nArg value is: $value\n";
+ var_dump(preg_match($regex, $value));
+}
+$value = new stdclass(); //Object
+var_dump(preg_match($regex, $value));
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing preg_match() : error conditions ***
+
+Arg value is: this is a string
+int(1)
+
+Arg value is: Array
+
+Warning: preg_match() expects parameter 2 to be string, array given in %spreg_match_error2.php on line %d
+bool(false)
+
+Warning: preg_match() expects parameter 2 to be string, object given in %spreg_match_error2.php on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/pcre/tests/preg_quote_basic.phpt b/ext/pcre/tests/preg_quote_basic.phpt
new file mode 100644
index 000000000..d4bbe9661
--- /dev/null
+++ b/ext/pcre/tests/preg_quote_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test preg_quote() function : basic functionality
+--FILE--
+<?php
+/*
+* proto string preg_quote(string str [, string delim_char])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+$string_before = '/this *-has \ metacharacters^ in $';
+print "\$string_before looks like: $string_before\n"; //$string_before is printed as is written
+$string_after = preg_quote($string_before, '/');
+print "\$string_after looks like: $string_after, with metacharacters and / (set as delimiter) escaped\n"; //$string_after is printed with metacharacters escaped.
+$string1 = 'testing - /this *-has \ metacharacters^ in $ should work';
+var_dump(preg_match('/^[tT]\w{6} - ' . preg_quote($string_before, '/') . ' [a-z]*\s*work$/', $string1, $matches1));
+var_dump($matches1);
+?>
+--EXPECT--
+
+$string_before looks like: /this *-has \ metacharacters^ in $
+$string_after looks like: \/this \*-has \\ metacharacters\^ in \$, with metacharacters and / (set as delimiter) escaped
+int(1)
+array(1) {
+ [0]=>
+ string(58) "testing - /this *-has \ metacharacters^ in $ should work"
+} \ No newline at end of file
diff --git a/ext/pcre/tests/preg_quote_error.phpt b/ext/pcre/tests/preg_quote_error.phpt
new file mode 100644
index 000000000..30b832dbf
--- /dev/null
+++ b/ext/pcre/tests/preg_quote_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test preg_quote() function : error conditions - wrong numbers of parameters
+--FILE--
+<?php
+/*
+* proto string preg_quote(string str [, string delim_char])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+echo "*** Testing preg_quote() : error conditions ***\n";
+// Zero arguments
+echo "\n-- Testing preg_quote() function with Zero arguments --\n";
+var_dump(preg_quote());
+//Test preg_quote with one more than the expected number of arguments
+echo "\n-- Testing preg_quote() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$delim_char = '/';
+$extra_arg = 10;
+var_dump(preg_quote($str, $delim_char, $extra_arg));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing preg_quote() : error conditions ***
+
+-- Testing preg_quote() function with Zero arguments --
+
+Warning: preg_quote() expects at least 1 parameter, 0 given in %spreg_quote_error.php on line %d
+NULL
+
+-- Testing preg_quote() function with more than expected no. of arguments --
+
+Warning: preg_quote() expects at most 2 parameters, 3 given in %spreg_quote_error.php on line %d
+NULL
+Done
diff --git a/ext/pcre/tests/preg_quote_error1.phpt b/ext/pcre/tests/preg_quote_error1.phpt
new file mode 100644
index 000000000..a02c83670
--- /dev/null
+++ b/ext/pcre/tests/preg_quote_error1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test preg_quote() function : error conditions - wrong arg types
+--FILE--
+<?php
+/*
+* proto string preg_quote(string str [, string delim_char])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_quote reacts to being passed the wrong type of input argument
+*/
+echo "*** Testing preg_quote() : error conditions ***\n";
+$input = array('this is a string', array('this is', 'a subarray'),);
+foreach($input as $value) {
+ print "\nArg value is: $value\n";
+ var_dump(preg_quote($value));
+}
+$value = new stdclass(); //Object
+var_dump(preg_quote($value));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing preg_quote() : error conditions ***
+
+Arg value is: this is a string
+string(16) "this is a string"
+
+Arg value is: Array
+
+Warning: preg_quote() expects parameter 1 to be string, array given in %spreg_quote_error1.php on line %d
+NULL
+
+Warning: preg_quote() expects parameter 1 to be string, object given in %spreg_quote_error1.php on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/pcre/tests/preg_replace_basic.phpt b/ext/pcre/tests/preg_replace_basic.phpt
new file mode 100644
index 000000000..33fb2d4a8
--- /dev/null
+++ b/ext/pcre/tests/preg_replace_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test preg_replace() function : basic functionality
+--FILE--
+<?php
+/*
+* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+$string = '123456789 - Hello, world - This is a string.';
+var_dump($string);
+var_dump(preg_replace('<- This is a string$>', 'This shouldn\'t work', $string)); //tries to find '- This is a string' at the end of a string but can't so replaces nothing and prints the unchanged $string.
+var_dump(preg_replace('<[0-35-9]>', '4', $string)); //finds any number that's not 4 and replaces it with a 4 ('444444444')
+var_dump(preg_replace('<\b[hH]\w{2,4}>', 'Bonjour', $string)); //finds h or H at the beginning of a word followed by 2-4 characters and replaces it with Bonjour (i.e. Hello -> Bonjour) (was finding the 'his' in This and replacing it)
+var_dump(preg_replace('<(\w)\s*-\s*(\w)>', '\\1. \\2', $string)); //finds dashes with an indefinate amount of whitespace around them and replaces them with a full stop precedeby no spaces and followed by one space
+var_dump(preg_replace('<(^[a-z]\w+)@(\w+)\.(\w+)\.([a-z]{2,}$)>', '\\1 at \\2 dot \\3 dot \\4', 'josmessa@uk.ibm.com')); //finds the e-mail address and replaces the @ and . with "at" and "dot" (uses backreferences) ('josmessa at uk dot ibm dot com')
+
+?>
+--EXPECT--
+
+string(54) "123456789 - Hello, world - This is a string."
+string(54) "123456789 - Hello, world - This is a string."
+string(54) "444444444 - Hello, world - This is a string."
+string(56) "123456789 - Bonjour, world - This is a string."
+string(42) "123456789. Hello, world. This is a string."
+string(30) "josmessa at uk dot ibm dot com"
diff --git a/ext/pcre/tests/preg_replace_callback_basic.phpt b/ext/pcre/tests/preg_replace_callback_basic.phpt
new file mode 100644
index 000000000..01d290a1b
--- /dev/null
+++ b/ext/pcre/tests/preg_replace_callback_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test preg_replace_callback() function : basic functionality
+--FILE--
+<?php
+/*
+* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+/*
+* Basic test for preg_replace_callback
+*/
+$replacement = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'); //array will have the default key values (0-9) and each value is the corresponding key written in words.
+function integer_word($matches) {
+ global $replacement;
+ return $replacement[$matches[0]]; //all examples will be looking for an integer value, if one is found it will be stored in $matches[0] which corresponds to a key in the $replacements array
+
+}
+$subject1 = 'there are 7 words in this sentence.';
+$new_subject1 = preg_replace_callback('/\d/', "integer_word", $subject1);
+print "$new_subject1 \n";
+$subject2 = '1 2 3 4 is now written in words';
+$new_subject2 = preg_replace_callback('/\d/', "integer_word", $subject2, 3); //limits to three replacements
+print "$new_subject2 \n";
+$subject3 = 'there are no numbers in this string';
+$new_subject3 = preg_replace_callback('/\d/', "integer_word", $subject3, 5, $count); //limites to five replacements and counts the number of replacements made ands stores in $count variable
+print "$new_subject3 \n";
+print $count;
+?>
+--EXPECTF--
+there are seven words in this sentence.
+one two three 4 is now written in words
+there are no numbers in this string
+0
diff --git a/ext/pcre/tests/preg_replace_callback_error.phpt b/ext/pcre/tests/preg_replace_callback_error.phpt
new file mode 100644
index 000000000..8d96446d4
--- /dev/null
+++ b/ext/pcre/tests/preg_replace_callback_error.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test preg_replace_callback() function : error
+--FILE--
+<?php
+/*
+* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+echo "***Testing preg_replace_callback() : error conditions***\n";
+//Zero arguments
+echo "\n-- Testing preg_replace_callback() function with Zero arguments --\n";
+var_dump(preg_replace_callback());
+//Test preg_replace_callback() with one more than the expected number of arguments
+echo "\n-- Testing preg_replace_callback() function with more than expected no. of arguments --\n";
+$replacement = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
+function integer_word($matches) {
+ global $replacement;
+ return $replacement[$matches[0]];
+}
+$regex = '/\d/';
+$subject = 'there are 7 words in this sentence.';
+$limit = 10;
+$extra_arg = 10;
+var_dump(preg_replace_callback($regex, 'integer_word', $subject, $limit, $count, $extra_arg));
+//Testing preg_replace_callback() with one less than the expected number of arguments
+echo "\n-- Testing preg_replace_callback() function with less than expected no. of arguments --\n";
+$regex = '/\d/';
+var_dump(preg_replace_callback($regex, 'integer word'));
+echo "Done";
+?>
+--EXPECTF--
+***Testing preg_replace_callback() : error conditions***
+
+-- Testing preg_replace_callback() function with Zero arguments --
+
+Warning: Wrong parameter count for preg_replace_callback() in %spreg_replace_callback_error.php on line %d
+NULL
+
+-- Testing preg_replace_callback() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for preg_replace_callback() in %spreg_replace_callback_error.php on line %d
+NULL
+
+-- Testing preg_replace_callback() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for preg_replace_callback() in %spreg_replace_callback_error.php on line %d
+NULL
+Done
diff --git a/ext/pcre/tests/preg_replace_error.phpt b/ext/pcre/tests/preg_replace_error.phpt
new file mode 100644
index 000000000..c91f500f7
--- /dev/null
+++ b/ext/pcre/tests/preg_replace_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test preg_replace() function : error - incorrect number of parameters
+--FILE--
+<?php
+/*
+* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+echo "*** Testing preg_replace() : error conditions ***\n";
+//Zero arguments
+echo "\n-- Testing preg_replace() function with zero arguments --\n";
+var_dump(preg_replace());
+//Test preg_replace() with one more than the expected number of arguments
+echo "\n-- Testing preg_replace() function with more than expected no. of arguments --\n";
+$regex = '/\w/';
+$replace = '1';
+$subject = 'string_val';
+$limit = 10;
+$extra_arg = 10;
+var_dump(preg_replace($regex, $replace, $subject, $limit, $count, $extra_arg));
+//Testing preg_replace() with one less than the expected number of arguments
+echo "\n-- Testing preg_replace() function with less than expected no. of arguments --\n";
+$regex = '/\w/';
+$replace = '1';
+var_dump(preg_replace($regex, $replace));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing preg_replace() : error conditions ***
+
+-- Testing preg_replace() function with zero arguments --
+
+Warning: Wrong parameter count for preg_replace() in %spreg_replace_error.php on line %d
+NULL
+
+-- Testing preg_replace() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for preg_replace() in %spreg_replace_error.php on line %d
+NULL
+
+-- Testing preg_replace() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for preg_replace() in %spreg_replace_error.php on line %d
+NULL
+Done
diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt
new file mode 100644
index 000000000..7ddfcfdef
--- /dev/null
+++ b/ext/pcre/tests/preg_replace_error1.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test preg_replace() function : error - bad regular expressions
+--FILE--
+<?php
+/*
+* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_replace reacts to being passed the wrong type of regex argument
+*/
+echo "*** Testing preg_replace() : error conditions***\n";
+$regex_array = array('abcdef', //Regex without delimeter
+'/[a-zA-Z]', //Regex without closing delimeter
+'[a-zA-Z]/', //Regex without opening delimeter
+'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
+'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
+);
+$replace = 1;
+$subject = 'a';
+foreach($regex_array as $regex_value) {
+ print "\nArg value is $regex_value\n";
+ var_dump(preg_replace($regex_value, $replace, $subject));
+}
+$regex_value = new stdclass(); //Object
+var_dump(preg_replace($regex_value, $replace, $subject));
+?>
+--EXPECTF--
+*** Testing preg_replace() : error conditions***
+
+Arg value is abcdef
+
+Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in %spreg_replace_error1.php on line %d
+NULL
+
+Arg value is /[a-zA-Z]
+
+Warning: preg_replace(): No ending delimiter '/' found in %spreg_replace_error1.php on line %d
+NULL
+
+Arg value is [a-zA-Z]/
+
+Warning: preg_replace(): Unknown modifier '/' in %spreg_replace_error1.php on line %d
+NULL
+
+Arg value is /[a-zA-Z]/F
+
+Warning: preg_replace(): Unknown modifier 'F' in %spreg_replace_error1.php on line %d
+NULL
+
+Arg value is Array
+string(1) "a"
+
+Arg value is /[a-zA-Z]/
+string(1) "1"
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %spreg_replace_error1.php on line %d
+
diff --git a/ext/pcre/tests/preg_replace_error2.phpt b/ext/pcre/tests/preg_replace_error2.phpt
new file mode 100644
index 000000000..bf5d3e072
--- /dev/null
+++ b/ext/pcre/tests/preg_replace_error2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test preg_replace() function : error conditions - wrong arg types
+--FILE--
+<?php
+/*
+* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_replace reacts to being passed the wrong type of replacement argument
+*/
+echo "*** Testing preg_replace() : error conditions ***\n";
+$regex = '/[a-zA-Z]/';
+$replace = array('this is a string', array('this is', 'a subarray'),);
+$subject = 'test';
+foreach($replace as $value) {
+ print "\nArg value is: $value\n";
+ var_dump(preg_replace($regex, $value, $subject));
+}
+$value = new stdclass(); //Object
+var_dump(preg_replace($regex, $value, $subject));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing preg_replace() : error conditions ***
+
+Arg value is: this is a string
+string(64) "this is a stringthis is a stringthis is a stringthis is a string"
+
+Arg value is: Array
+
+Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace_error2.php on line %d
+bool(false)
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %spreg_replace_error2.php on line %d
+
diff --git a/ext/pcre/tests/preg_replace_variation1.phpt b/ext/pcre/tests/preg_replace_variation1.phpt
new file mode 100644
index 000000000..ac79e0bfa
--- /dev/null
+++ b/ext/pcre/tests/preg_replace_variation1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test preg_replace() function : variation both arguments are arrays
+--FILE--
+<?php
+/*
+* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+/*
+* Testing preg_replace when the regex and the replacement are both arrays.
+*/
+$string = 'This is a string. It contains numbers (0-9) as well as parentheses and some other things!';
+$new_string = preg_replace(array('/\b\w{1}s/', '/(\d{1})-(\d{1})/', '/[\(!\)]/'), array('test', '$1 to $2', '*'), $string);
+print $new_string;
+?>
+--EXPECTF--
+This test a string. It contains numbers *0 to 9* test well test parentheses and some other things*
diff --git a/ext/pcre/tests/preg_split_basic.phpt b/ext/pcre/tests/preg_split_basic.phpt
new file mode 100644
index 000000000..324270ac3
--- /dev/null
+++ b/ext/pcre/tests/preg_split_basic.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test preg_split() function : basic functionality
+--INI--
+--FILE--
+<?php
+/*
+* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+$string = 'this is a_list: value1, Test__, string; Hello, world!_(parentheses)';
+var_dump(preg_split('/[:,;\(\)]/', $string, -1, PREG_SPLIT_NO_EMPTY)); //parts of $string seperated by : , ; ( or ) are put into an array.
+var_dump(preg_split('/:\s*(\w*,*\s*)+;/', $string)); //all text between : and ; is removed
+var_dump(preg_split('/(\(|\))/', $string, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY)); //all text before (parentheses) is put into first element, ( into second, "parentheses" into third and ) into fourth.
+var_dump(preg_split('/NAME/i', $string)); //tries to find NAME regardless of case in $string (can't split it so just returns how string as first element)
+var_dump(preg_split('/\w/', $string, -1, PREG_SPLIT_NO_EMPTY)); //every character (including whitespace) is put into an array element
+
+?>
+--EXPECT--
+array(7) {
+ [0]=>
+ string(14) "this is a_list"
+ [1]=>
+ string(7) " value1"
+ [2]=>
+ string(7) " Test__"
+ [3]=>
+ string(7) " string"
+ [4]=>
+ string(6) " Hello"
+ [5]=>
+ string(8) " world!_"
+ [6]=>
+ string(11) "parentheses"
+}
+array(2) {
+ [0]=>
+ string(14) "this is a_list"
+ [1]=>
+ string(28) " Hello, world!_(parentheses)"
+}
+array(4) {
+ [0]=>
+ string(54) "this is a_list: value1, Test__, string; Hello, world!_"
+ [1]=>
+ string(1) "("
+ [2]=>
+ string(11) "parentheses"
+ [3]=>
+ string(1) ")"
+}
+array(1) {
+ [0]=>
+ string(67) "this is a_list: value1, Test__, string; Hello, world!_(parentheses)"
+}
+array(10) {
+ [0]=>
+ string(1) " "
+ [1]=>
+ string(1) " "
+ [2]=>
+ string(2) ": "
+ [3]=>
+ string(2) ", "
+ [4]=>
+ string(2) ", "
+ [5]=>
+ string(2) "; "
+ [6]=>
+ string(2) ", "
+ [7]=>
+ string(1) "!"
+ [8]=>
+ string(1) "("
+ [9]=>
+ string(1) ")"
+} \ No newline at end of file
diff --git a/ext/pcre/tests/preg_split_error.phpt b/ext/pcre/tests/preg_split_error.phpt
new file mode 100644
index 000000000..960b286c9
--- /dev/null
+++ b/ext/pcre/tests/preg_split_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test preg_split() function : error conditions - incorrect number of parameters
+--FILE--
+<?php
+/*
+* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+echo "*** Testing preg_split() : error conditions ***\n";
+// Zero arguments
+echo "\n-- Testing preg_split() function with Zero arguments --\n";
+var_dump(preg_split());
+//Test preg_split with one more than the expected number of arguments
+echo "\n-- Testing preg_split() function with more than expected no. of arguments --\n";
+$pattern = '/_/';
+$subject = 'string_val';
+$limit = 10;
+$flags = PREG_SPLIT_NO_EMPTY;
+$extra_arg = 10;
+var_dump(preg_split($pattern, $subject, $limit, $flags, $extra_arg));
+// Testing preg_split withone less than the expected number of arguments
+echo "\n-- Testing preg_split() function with less than expected no. of arguments --\n";
+$pattern = '/\./';
+var_dump(preg_split($pattern));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing preg_split() : error conditions ***
+
+-- Testing preg_split() function with Zero arguments --
+
+Warning: preg_split() expects at least 2 parameters, 0 given in %spreg_split_error.php on line %d
+bool(false)
+
+-- Testing preg_split() function with more than expected no. of arguments --
+
+Warning: preg_split() expects at most 4 parameters, 5 given in %spreg_split_error.php on line %d
+bool(false)
+
+-- Testing preg_split() function with less than expected no. of arguments --
+
+Warning: preg_split() expects at least 2 parameters, 1 given in %spreg_split_error.php on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/pcre/tests/preg_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt
new file mode 100644
index 000000000..79942a948
--- /dev/null
+++ b/ext/pcre/tests/preg_split_error1.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test preg_split() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/*
+* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_split reacts to being passed the wrong type of regex argument
+*/
+echo "*** Testing preg_split() : error conditions ***\n";
+$regex_array = array('abcdef', //Regex without delimiter
+'/[a-zA-Z]', //Regex without closing delimiter
+'[a-zA-Z]/', //Regex without opening delimiter
+'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
+'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
+);
+$subject = '1 2 a 3 4 b 5 6';
+foreach($regex_array as $regex_value) {
+ print "\nArg value is $regex_value\n";
+ var_dump(preg_split($regex_value, $subject));
+}
+$regex_value = new stdclass(); //Object
+var_dump(preg_split($regex_value, $subject));
+?>
+--EXPECTF--
+*** Testing preg_split() : error conditions ***
+
+Arg value is abcdef
+
+Warning: preg_split(): Delimiter must not be alphanumeric or backslash in %spreg_split_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]
+
+Warning: preg_split(): No ending delimiter '/' found in %spreg_split_error1.php on line %d
+bool(false)
+
+Arg value is [a-zA-Z]/
+
+Warning: preg_split(): Unknown modifier '/' in %spreg_split_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]/F
+
+Warning: preg_split(): Unknown modifier 'F' in %spreg_split_error1.php on line %d
+bool(false)
+
+Arg value is Array
+
+Warning: preg_split() expects parameter 1 to be string, array given in %spreg_split_error1.php on line %d
+bool(false)
+
+Arg value is /[a-zA-Z]/
+array(3) {
+ [0]=>
+ string(4) "1 2 "
+ [1]=>
+ string(5) " 3 4 "
+ [2]=>
+ string(4) " 5 6"
+}
+
+Warning: preg_split() expects parameter 1 to be string, object given in %spreg_split_error1.php on line %d
+bool(false)
diff --git a/ext/pcre/tests/preg_split_error2.phpt b/ext/pcre/tests/preg_split_error2.phpt
new file mode 100644
index 000000000..e08182177
--- /dev/null
+++ b/ext/pcre/tests/preg_split_error2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test preg_split() function : error conditions - wrong arg types
+--FILE--
+<?php
+/*
+* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
+* Function is implemented in ext/pcre/php_pcre.c
+*/
+error_reporting(E_ALL&~E_NOTICE);
+/*
+* Testing how preg_split reacts to being passed the wrong type of input argument
+*/
+echo "*** Testing preg_split() : error conditions ***\n";
+$regex = '/[a-zA-Z]/';
+$input = array(array('this is', 'a subarray'),);
+foreach($input as $value) {
+ print "\nArg value is: $value\n";
+ var_dump(preg_split($regex, $value));
+}
+$value = new stdclass(); //Object
+var_dump(preg_split($regex, $value));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing preg_split() : error conditions ***
+
+Arg value is: Array
+
+Warning: preg_split() expects parameter 2 to be string, array given in %spreg_split_error2.php on line %d
+bool(false)
+
+Warning: preg_split() expects parameter 2 to be string, object given in %spreg_split_error2.php on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/pcre/upgrade-pcre.php b/ext/pcre/upgrade-pcre.php
index dd0a8a783..43a98c94b 100644
--- a/ext/pcre/upgrade-pcre.php
+++ b/ext/pcre/upgrade-pcre.php
@@ -37,9 +37,9 @@ function recurse($path)
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;
+ @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";
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index c19620115..2a55bf9a8 100755
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo.c,v 1.57.2.17.2.9 2007/07/23 11:53:58 jani Exp $ */
+/* $Id: pdo.c,v 1.57.2.17.2.10 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index e3d49f3c9..5d567741e 100755
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_dbh.c,v 1.82.2.31.2.17 2007/09/12 18:26:49 iliaa Exp $ */
+/* $Id: pdo_dbh.c,v 1.82.2.31.2.22 2008/03/03 21:14:33 iliaa Exp $ */
/* The PDO Database Handle Class */
@@ -669,8 +669,17 @@ static PHP_METHOD(PDO, rollBack)
static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_DC) /* {{{ */
{
+
+#define PDO_LONG_PARAM_CHECK \
+ if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_BOOL) { \
+ pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer" TSRMLS_CC); \
+ PDO_HANDLE_DBH_ERR(); \
+ return FAILURE; \
+ } \
+
switch (attr) {
case PDO_ATTR_ERRMODE:
+ PDO_LONG_PARAM_CHECK;
convert_to_long(value);
switch (Z_LVAL_P(value)) {
case PDO_ERRMODE_SILENT:
@@ -686,6 +695,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D
return FAILURE;
case PDO_ATTR_CASE:
+ PDO_LONG_PARAM_CHECK;
convert_to_long(value);
switch (Z_LVAL_P(value)) {
case PDO_CASE_NATURAL:
@@ -701,6 +711,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D
return FAILURE;
case PDO_ATTR_ORACLE_NULLS:
+ PDO_LONG_PARAM_CHECK;
convert_to_long(value);
dbh->oracle_nulls = Z_LVAL_P(value);
return SUCCESS;
@@ -714,6 +725,8 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D
return FAILURE;
}
}
+ } else {
+ PDO_LONG_PARAM_CHECK;
}
convert_to_long(value);
if (Z_LVAL_P(value) == PDO_FETCH_USE_DEFAULT) {
@@ -724,6 +737,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D
return SUCCESS;
case PDO_ATTR_STRINGIFY_FETCHES:
+ PDO_LONG_PARAM_CHECK;
convert_to_long(value);
dbh->stringify = Z_LVAL_P(value) ? 1 : 0;
return SUCCESS;
@@ -815,9 +829,9 @@ static PHP_METHOD(PDO, setAttribute)
{
pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
long attr;
- zval *value = NULL;
+ zval *value;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz!", &attr, &value)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &attr, &value)) {
RETURN_FALSE;
}
@@ -978,7 +992,7 @@ static PHP_METHOD(PDO, errorInfo)
pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
if (ZEND_NUM_ARGS()) {
- RETURN_FALSE;
+ WRONG_PARAM_COUNT;
}
PDO_CONSTRUCT_CHECK;
@@ -1119,6 +1133,10 @@ static PHP_METHOD(PDO, getAvailableDrivers)
{
HashPosition pos;
pdo_driver_t **pdriver;
+
+ if (ZEND_NUM_ARGS()) {
+ WRONG_PARAM_COUNT;
+ }
array_init(return_value);
@@ -1273,12 +1291,18 @@ static union _zend_function *dbh_method_get(
if (zend_hash_find(dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH],
lc_method_name, method_len+1, (void**)&fbc) == FAILURE) {
- fbc = NULL;
+ if (std_object_handlers.get_method) {
+ fbc = std_object_handlers.get_method(object_pp, lc_method_name, method_len TSRMLS_CC);
+ }
+ if (!fbc) {
+ fbc = NULL;
+ }
+
goto out;
}
/* got it */
}
-
+
out:
efree(lc_method_name);
return fbc;
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
index 4aaa8973a..1913f0dc7 100644
--- a/ext/pdo/pdo_sql_parser.c
+++ b/ext/pdo/pdo_sql_parser.c
@@ -1,9 +1,9 @@
-/* Generated by re2c 0.11.0 on Mon Oct 29 18:36:37 2007 */
+/* Generated by re2c 0.11.0 on Mon Nov 26 16:10:28 2007 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.13 2007/10/29 22:37:25 iliaa Exp $ */
+/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.15 2007/12/31 07:20:09 sebastian Exp $ */
#include "php.h"
#include "php_pdo_driver.h"
@@ -73,7 +73,6 @@ yy4:
yy5:
yych = *++YYCURSOR;
switch(yych) {
- case '-':
case '0':
case '1':
case '2':
@@ -183,7 +182,6 @@ yy16:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych) {
- case '-':
case '0':
case '1':
case '2':
diff --git a/ext/pdo/pdo_sql_parser.c.orig b/ext/pdo/pdo_sql_parser.c.orig
index 9b537680c..d507f7d9c 100644
--- a/ext/pdo/pdo_sql_parser.c.orig
+++ b/ext/pdo/pdo_sql_parser.c.orig
@@ -1,10 +1,10 @@
-/* Generated by re2c 0.11.0 on Mon Oct 29 18:36:37 2007 */
+/* Generated by re2c 0.11.0 on Mon Nov 26 16:10:28 2007 */
#line 1 "ext/pdo/pdo_sql_parser.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.13 2007/10/29 22:37:25 iliaa Exp $ */
+/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.15 2007/12/31 07:20:09 sebastian Exp $ */
#include "php.h"
#include "php_pdo_driver.h"
@@ -78,7 +78,6 @@ yy4:
yy5:
yych = *++YYCURSOR;
switch(yych) {
- case '-':
case '0':
case '1':
case '2':
@@ -156,7 +155,7 @@ yy6:
yy7:
#line 62 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_BIND_POS); }
-#line 160 "ext/pdo/pdo_sql_parser.c"
+#line 159 "ext/pdo/pdo_sql_parser.c"
yy8:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -172,12 +171,12 @@ yy8:
yy10:
#line 64 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 176 "ext/pdo/pdo_sql_parser.c"
+#line 175 "ext/pdo/pdo_sql_parser.c"
yy11:
++YYCURSOR;
#line 65 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_EOI); }
-#line 181 "ext/pdo/pdo_sql_parser.c"
+#line 180 "ext/pdo/pdo_sql_parser.c"
yy13:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -190,13 +189,12 @@ yy13:
yy15:
#line 60 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 194 "ext/pdo/pdo_sql_parser.c"
+#line 193 "ext/pdo/pdo_sql_parser.c"
yy16:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch(yych) {
- case '-':
case '0':
case '1':
case '2':
@@ -265,7 +263,7 @@ yy16:
yy18:
#line 61 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_BIND); }
-#line 269 "ext/pdo/pdo_sql_parser.c"
+#line 267 "ext/pdo/pdo_sql_parser.c"
yy19:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -279,7 +277,7 @@ yy21:
++YYCURSOR;
#line 59 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 283 "ext/pdo/pdo_sql_parser.c"
+#line 281 "ext/pdo/pdo_sql_parser.c"
yy23:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -293,7 +291,7 @@ yy25:
++YYCURSOR;
#line 58 "ext/pdo/pdo_sql_parser.re"
{ RET(PDO_PARSER_TEXT); }
-#line 297 "ext/pdo/pdo_sql_parser.c"
+#line 295 "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 5f957bc24..3b89d14d0 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sql_parser.re,v 1.28.2.4.2.10 2007/10/29 22:37:25 iliaa Exp $ */
+/* $Id: pdo_sql_parser.re,v 1.28.2.4.2.12 2007/12/31 07:17:40 sebastian 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_sqlstate.c b/ext/pdo/pdo_sqlstate.c
index c92ea4b4e..181415459 100644
--- a/ext/pdo/pdo_sqlstate.c
+++ b/ext/pdo/pdo_sqlstate.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sqlstate.c,v 1.7.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: pdo_sqlstate.c,v 1.7.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 3e85321b7..2e1621672 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.26 2007/10/31 12:58:24 iliaa Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.34 2008/02/26 00:14:04 iliaa Exp $ */
/* The PDO Statement Handle Class */
@@ -894,6 +894,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
int flags = how & PDO_FETCH_FLAGS, idx, old_arg_count = 0;
zend_class_entry *ce = NULL, *old_ce = NULL;
zval grp_val, *grp, **pgrp, *retval, *old_ctor_args = NULL;
+ int colno;
if (how == PDO_FETCH_USE_DEFAULT) {
how = stmt->default_fetch_type;
@@ -909,6 +910,12 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
return 1;
}
+ if (flags & PDO_FETCH_GROUP && stmt->fetch.column == -1) {
+ colno = 1;
+ } else {
+ colno = stmt->fetch.column;
+ }
+
if (return_value) {
int i = 0;
@@ -945,13 +952,21 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
break;
case PDO_FETCH_COLUMN:
- if (stmt->fetch.column >= 0 && stmt->fetch.column < stmt->column_count) {
- fetch_value(stmt, return_value, stmt->fetch.column, NULL TSRMLS_CC);
+ if (colno >= 0 && colno < stmt->column_count) {
+ if (flags == PDO_FETCH_GROUP && stmt->fetch.column == -1) {
+ fetch_value(stmt, return_value, 1, NULL TSRMLS_CC);
+ } else if (flags == PDO_FETCH_GROUP && colno) {
+ fetch_value(stmt, return_value, 0, NULL TSRMLS_CC);
+ } else {
+ fetch_value(stmt, return_value, colno, NULL TSRMLS_CC);
+ }
if (!return_all) {
return 1;
} else {
break;
}
+ } else {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Invalid column index" TSRMLS_CC);
}
return 0;
@@ -1049,7 +1064,11 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
if (return_all && how != PDO_FETCH_KEY_PAIR) {
INIT_PZVAL(&grp_val);
- fetch_value(stmt, &grp_val, i, NULL TSRMLS_CC);
+ if (flags == PDO_FETCH_GROUP && how == PDO_FETCH_COLUMN && stmt->fetch.column > 0) {
+ fetch_value(stmt, &grp_val, colno, NULL TSRMLS_CC);
+ } else {
+ fetch_value(stmt, &grp_val, i, NULL TSRMLS_CC);
+ }
convert_to_string(&grp_val);
if (how == PDO_FETCH_COLUMN) {
i = stmt->column_count; /* no more data to fetch */
@@ -1527,7 +1546,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
switch(ZEND_NUM_ARGS()) {
case 0:
case 1:
- stmt->fetch.column = how & PDO_FETCH_GROUP ? 1 : 0;
+ stmt->fetch.column = how & PDO_FETCH_GROUP ? -1 : 0;
break;
case 2:
convert_to_long(arg2);
diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h
index 52ecbd3d0..4812a6d48 100755
--- a/ext/pdo/php_pdo.h
+++ b/ext/pdo/php_pdo.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo.h,v 1.7.2.5.2.3 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pdo.h,v 1.7.2.5.2.4 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_H
#define PHP_PDO_H
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index 4bb2efc9d..eec8f2137 100755
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_driver.h,v 1.66.2.11.2.6 2007/07/23 11:53:58 jani Exp $ */
+/* $Id: php_pdo_driver.h,v 1.66.2.11.2.8 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_DRIVER_H
#define PHP_PDO_DRIVER_H
@@ -67,7 +67,7 @@ enum pdo_param_type {
PDO_PARAM_STMT, /* hierarchical result set */
/* get_col ptr should point to a zend_bool */
- PDO_PARAM_BOOL,
+ PDO_PARAM_BOOL
};
/* magic flag to denote a parameter as being input/output */
diff --git a/ext/pdo/php_pdo_int.h b/ext/pdo/php_pdo_int.h
index 3f8f76888..dd2218b3d 100755
--- a/ext/pdo/php_pdo_int.h
+++ b/ext/pdo/php_pdo_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_int.h,v 1.17.2.6.2.2 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pdo_int.h,v 1.17.2.6.2.3 2007/12/31 07:20:09 sebastian Exp $ */
/* Stuff private to the PDO extension and not for consumption by PDO drivers
* */
diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt
index 5082895cb..dd956299e 100644
--- a/ext/pdo/tests/bug_43130.phpt
+++ b/ext/pdo/tests/bug_43130.phpt
@@ -6,6 +6,7 @@ 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');
+if (!strncasecmp(getenv('PDOTEST_DSN'), 'pgsql', strlen('pgsql'))) die('skip not relevant for pgsql driver');
require_once $dir . 'pdo_test.inc';
PDOTest::skip();
?>
@@ -27,5 +28,8 @@ $id = '1';
$stmt->execute();
var_dump($stmt->fetch(PDO::FETCH_COLUMN));
?>
---EXPECT--
-string(5) "test1"
+--EXPECTF--
+Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in %s on line %d
+
+Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d
+bool(false)
diff --git a/ext/pdo/tests/bug_43663.phpt b/ext/pdo/tests/bug_43663.phpt
new file mode 100644
index 000000000..2e903d788
--- /dev/null
+++ b/ext/pdo/tests/bug_43663.phpt
@@ -0,0 +1,22 @@
+--TEST--
+PDO Common: Bug #43663 (__call on classes derived from PDO)
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo_sqlite')) die('skip no pdo_sqlite');
+?>
+--FILE--
+<?php
+class test extends PDO{
+ function __call($name, array $args) {
+ echo "Called $name in ".__CLASS__."\n";
+ }
+ function foo() {
+ echo "Called foo in ".__CLASS__."\n";
+ }
+}
+$a = new test('sqlite::memory:');
+$a->foo();
+$a->bar();
+--EXPECT--
+Called foo in test
+Called bar in test
diff --git a/ext/pdo/tests/bug_44159.phpt b/ext/pdo/tests/bug_44159.phpt
new file mode 100644
index 000000000..db4da4013
--- /dev/null
+++ b/ext/pdo/tests/bug_44159.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL))
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo_sqlite')) die('skip no pdo_sqlite');
+?>
+--FILE--
+<?php
+
+$pdo = new PDO("sqlite:/tmp/foo.db");
+
+$attrs = array(PDO::ATTR_STATEMENT_CLASS, PDO::ATTR_STRINGIFY_FETCHES, PDO::NULL_TO_STRING);
+
+foreach ($attrs as $attr) {
+ var_dump($pdo->setAttribute($attr, NULL));
+ var_dump($pdo->setAttribute($attr, 1));
+ var_dump($pdo->setAttribute($attr, 'nonsense'));
+}
+
+?>
+--EXPECTF--
+Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in %s on line %d
+bool(false)
+
+Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in %s on line %d
+bool(false)
+
+Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); the classname must be a string specifying an existing class in %s on line %d
+bool(false)
+
+Warning: PDO::setAttribute(): SQLSTATE[HY000]: General error: attribute value must be an integer in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index 7e80a19d0..1d7a826e7 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dblib_driver.c,v 1.9.2.2.2.2 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: dblib_driver.c,v 1.9.2.2.2.3 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index f183c63ef..6302fc3ae 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dblib_stmt.c,v 1.6.2.2.2.4 2007/01/15 01:56:09 fmk Exp $ */
+/* $Id: dblib_stmt.c,v 1.6.2.2.2.5 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index 67e48985f..5203da769 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_dblib.c,v 1.9.2.6.2.3 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: pdo_dblib.c,v 1.9.2.6.2.4 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/pdo_dblib/php_pdo_dblib.h b/ext/pdo_dblib/php_pdo_dblib.h
index 8c08d8936..6c546e1b2 100644
--- a/ext/pdo_dblib/php_pdo_dblib.h
+++ b/ext/pdo_dblib/php_pdo_dblib.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_dblib.h,v 1.2.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pdo_dblib.h,v 1.2.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_DBLIB_H
#define PHP_PDO_DBLIB_H
diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h
index af861731d..8f3096522 100644
--- a/ext/pdo_dblib/php_pdo_dblib_int.h
+++ b/ext/pdo_dblib/php_pdo_dblib_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_dblib_int.h,v 1.4.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pdo_dblib_int.h,v 1.4.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_DBLIB_INT_H
#define PHP_PDO_DBLIB_INT_H
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index af9861f96..e3d777be6 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: firebird_driver.c,v 1.17.2.2.2.4 2007/02/27 03:28:16 iliaa Exp $ */
+/* $Id: firebird_driver.c,v 1.17.2.2.2.5 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 0a72bc151..b58ea1b17 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: firebird_statement.c,v 1.18.2.1.2.5 2007/02/27 03:04:40 iliaa Exp $ */
+/* $Id: firebird_statement.c,v 1.18.2.1.2.6 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c
index f778cc71a..a5b8156e8 100644
--- a/ext/pdo_firebird/pdo_firebird.c
+++ b/ext/pdo_firebird/pdo_firebird.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_firebird.c,v 1.4.2.3.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: pdo_firebird.c,v 1.4.2.3.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_firebird/php_pdo_firebird.h b/ext/pdo_firebird/php_pdo_firebird.h
index 1ce59778d..0711450a5 100644
--- a/ext/pdo_firebird/php_pdo_firebird.h
+++ b/ext/pdo_firebird/php_pdo_firebird.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_firebird.h,v 1.3.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pdo_firebird.h,v 1.3.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_FIREBIRD_H
#define PHP_PDO_FIREBIRD_H
diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h
index ed9f9dc01..c49a31095 100644
--- a/ext/pdo_firebird/php_pdo_firebird_int.h
+++ b/ext/pdo_firebird/php_pdo_firebird_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_firebird_int.h,v 1.10.2.1.2.1 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pdo_firebird_int.h,v 1.10.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_FIREBIRD_INT_H
#define PHP_PDO_FIREBIRD_INT_H
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index bd487dedc..3073c4bf4 100755
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysql_driver.c,v 1.59.2.13.2.5 2007/06/18 21:51:32 stas Exp $ */
+/* $Id: mysql_driver.c,v 1.59.2.13.2.6 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 39e10530c..0a1a66e87 100755
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysql_statement.c,v 1.48.2.14.2.6 2007/05/17 15:12:23 tony2001 Exp $ */
+/* $Id: mysql_statement.c,v 1.48.2.14.2.7 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index d0bb2f79b..315770b12 100755
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_mysql.c,v 1.8.2.13.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: pdo_mysql.c,v 1.8.2.13.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_mysql/php_pdo_mysql.h b/ext/pdo_mysql/php_pdo_mysql.h
index cef81f992..3a5ee2b8f 100755
--- a/ext/pdo_mysql/php_pdo_mysql.h
+++ b/ext/pdo_mysql/php_pdo_mysql.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_mysql.h,v 1.3.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_mysql.h,v 1.3.2.1.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_MYSQL_H
#define PHP_PDO_MYSQL_H
diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h
index a41a727ad..c6e60bd35 100755
--- a/ext/pdo_mysql/php_pdo_mysql_int.h
+++ b/ext/pdo_mysql/php_pdo_mysql_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_mysql_int.h,v 1.16.2.4.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_mysql_int.h,v 1.16.2.4.2.2 2007/12/31 07:20:09 sebastian Exp $ */
#ifndef PHP_PDO_MYSQL_INT_H
#define PHP_PDO_MYSQL_INT_H
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 6dcbf5989..7ed6d83fc 100755
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci_driver.c,v 1.24.2.4.2.7 2007/08/31 21:08:48 sixd Exp $ */
+/* $Id: oci_driver.c,v 1.24.2.4.2.10 2008/03/08 14:01:49 felipe Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -494,9 +494,12 @@ static int oci_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_valu
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
+#elif defined(PHP_PDO_OCI_CLIENT_VERSION)
/* Compile time client version */
ZVAL_STRING(return_value, PHP_PDO_OCI_CLIENT_VERSION, 1);
+#else
+ return FALSE;
+
#endif /* Check for OCIClientVersion() support */
return TRUE;
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index a2aa0c4d5..9b453e460 100755
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci_statement.c,v 1.16.2.10.2.7 2007/08/31 21:08:48 sixd Exp $ */
+/* $Id: oci_statement.c,v 1.16.2.10.2.8 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_oci/pdo_oci.c b/ext/pdo_oci/pdo_oci.c
index 3f8c83198..68d1d8385 100755
--- a/ext/pdo_oci/pdo_oci.c
+++ b/ext/pdo_oci/pdo_oci.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_oci.c,v 1.5.2.6.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: pdo_oci.c,v 1.5.2.6.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_oci/php_pdo_oci.h b/ext/pdo_oci/php_pdo_oci.h
index da54ec3ea..74ecee076 100755
--- a/ext/pdo_oci/php_pdo_oci.h
+++ b/ext/pdo_oci/php_pdo_oci.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_oci.h,v 1.2.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_oci.h,v 1.2.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_PDO_OCI_H
#define PHP_PDO_OCI_H
diff --git a/ext/pdo_oci/php_pdo_oci_int.h b/ext/pdo_oci/php_pdo_oci_int.h
index 079cc5465..33bf1ccf8 100755
--- a/ext/pdo_oci/php_pdo_oci_int.h
+++ b/ext/pdo_oci/php_pdo_oci_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_oci_int.h,v 1.4.2.2.2.4 2007/08/31 21:08:48 sixd Exp $ */
+/* $Id: php_pdo_oci_int.h,v 1.4.2.2.2.5 2007/12/31 07:20:10 sebastian Exp $ */
#include <oci.h>
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index b338947dc..da45d5836 100755
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: odbc_driver.c,v 1.27.2.4.2.3 2007/02/24 02:17:25 helly Exp $ */
+/* $Id: odbc_driver.c,v 1.27.2.4.2.4 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 9f0840b63..83909dab2 100755
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: odbc_stmt.c,v 1.26.2.2.2.3 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: odbc_stmt.c,v 1.26.2.2.2.4 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index 00a36fc7a..1eeed26d3 100755
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_odbc.c,v 1.14.2.7.2.2 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: pdo_odbc.c,v 1.14.2.7.2.3 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h
index fab288d9d..9fc026e99 100644
--- a/ext/pdo_odbc/php_pdo_odbc.h
+++ b/ext/pdo_odbc/php_pdo_odbc.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_odbc.h,v 1.2.4.3 2007/05/28 12:19:41 bjori Exp $ */
+/* $Id: php_pdo_odbc.h,v 1.2.4.4 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_PDO_ODBC_H
#define PHP_PDO_ODBC_H
diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h
index 8b855b929..89e91b5a1 100755
--- a/ext/pdo_odbc/php_pdo_odbc_int.h
+++ b/ext/pdo_odbc/php_pdo_odbc_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_odbc_int.h,v 1.9.2.1.2.2 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_odbc_int.h,v 1.9.2.1.2.3 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef PHP_WIN32
# define PDO_ODBC_TYPE "Win32"
diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c
index 1f4b443b9..000e4a859 100644
--- a/ext/pdo_pgsql/pdo_pgsql.c
+++ b/ext/pdo_pgsql/pdo_pgsql.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_pgsql.c,v 1.7.2.11.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: pdo_pgsql.c,v 1.7.2.11.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -123,7 +123,7 @@ PHP_MINFO_FUNCTION(pdo_pgsql)
php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
#endif
php_info_print_table_row(2, "Module version", pdo_pgsql_module_entry.version);
- php_info_print_table_row(2, "Revision", " $Id: pdo_pgsql.c,v 1.7.2.11.2.1 2007/01/01 09:36:05 sebastian Exp $ ");
+ php_info_print_table_row(2, "Revision", " $Id: pdo_pgsql.c,v 1.7.2.11.2.2 2007/12/31 07:20:10 sebastian Exp $ ");
php_info_print_table_end();
}
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index bcd510558..82d141522 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql_driver.c,v 1.53.2.14.2.9 2007/06/28 03:13:29 iliaa Exp $ */
+/* $Id: pgsql_driver.c,v 1.53.2.14.2.11 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -692,14 +692,14 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
}
/* support both full connection string & connection string + login and/or password */
- if (!dbh->username || !dbh->password) {
- spprintf(&conn_str, 0, "%s connect_timeout=%ld", (char *) dbh->data_source, connect_timeout);
- } else if (dbh->username && dbh->password) {
+ if (dbh->username && dbh->password) {
spprintf(&conn_str, 0, "%s user=%s password=%s connect_timeout=%ld", dbh->data_source, dbh->username, dbh->password, connect_timeout);
} else if (dbh->username) {
spprintf(&conn_str, 0, "%s user=%s connect_timeout=%ld", dbh->data_source, dbh->username, connect_timeout);
- } else {
+ } else if (dbh->password) {
spprintf(&conn_str, 0, "%s password=%s connect_timeout=%ld", dbh->data_source, dbh->password, connect_timeout);
+ } else {
+ spprintf(&conn_str, 0, "%s connect_timeout=%ld", (char *) dbh->data_source, connect_timeout);
}
H->server = PQconnectdb(conn_str);
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index c0cbccd9b..33aea2335 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql_statement.c,v 1.31.2.12.2.7 2007/04/17 15:29:13 iliaa Exp $ */
+/* $Id: pgsql_statement.c,v 1.31.2.12.2.11 2008/02/26 00:14:04 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -238,7 +238,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
param->name, param->namelen + 1, (void**)&nameptr)) {
param->paramno = atoi(nameptr + 1) - 1;
} else {
- pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY093");
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY093", param->name TSRMLS_CC);
return 0;
}
}
@@ -250,6 +250,9 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
return 1;
case PDO_PARAM_EVT_EXEC_PRE:
+ if (!stmt->bound_param_map) {
+ return 0;
+ }
if (!S->param_values) {
S->param_values = ecalloc(
zend_hash_num_elements(stmt->bound_param_map),
@@ -265,6 +268,11 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
sizeof(Oid));
}
if (param->paramno >= 0) {
+ if (param->paramno > zend_hash_num_elements(stmt->bound_param_map)) {
+ pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY105");
+ return 0;
+ }
+
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB &&
Z_TYPE_P(param->parameter) == IS_RESOURCE) {
php_stream *stm;
diff --git a/ext/pdo_pgsql/php_pdo_pgsql.h b/ext/pdo_pgsql/php_pdo_pgsql.h
index 2cd992647..4a6e2d6cc 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_pgsql.h,v 1.3.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_pgsql.h,v 1.3.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_PDO_PGSQL_H
#define PHP_PDO_PGSQL_H
diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h
index e988eccc8..87b56dcb1 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql_int.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_pgsql_int.h,v 1.13.2.4.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_pgsql_int.h,v 1.13.2.4.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_PDO_PGSQL_INT_H
#define PHP_PDO_PGSQL_INT_H
diff --git a/ext/pdo_pgsql/tests/bug36727.phpt b/ext/pdo_pgsql/tests/bug36727.phpt
index c6f7c8a80..f1b906bd6 100644
--- a/ext/pdo_pgsql/tests/bug36727.phpt
+++ b/ext/pdo_pgsql/tests/bug36727.phpt
@@ -18,6 +18,7 @@ var_dump($stmt->bindValue(':test', 1, PDO::PARAM_INT));
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
+Warning: PDOStatement::bindValue(): SQLSTATE[HY093]: Invalid parameter number: :test in %s/bug36727.php on line %d
bool(false)
-Done
+Done \ No newline at end of file
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
index 25ac02a36..3b266039a 100644
--- a/ext/pdo_sqlite/pdo_sqlite.c
+++ b/ext/pdo_sqlite/pdo_sqlite.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sqlite.c,v 1.10.2.6.2.2 2007/03/23 14:30:00 wez Exp $ */
+/* $Id: pdo_sqlite.c,v 1.10.2.6.2.3 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -100,7 +100,7 @@ PHP_MINFO_FUNCTION(pdo_sqlite)
"(bundled) "
#endif
PHP_PDO_SQLITE_MODULE_VERSION
- " $Id: pdo_sqlite.c,v 1.10.2.6.2.2 2007/03/23 14:30:00 wez Exp $");
+ " $Id: pdo_sqlite.c,v 1.10.2.6.2.3 2007/12/31 07:20:10 sebastian Exp $");
php_info_print_table_row(2, "SQLite Library", sqlite3_libversion());
php_info_print_table_end();
}
diff --git a/ext/pdo_sqlite/php_pdo_sqlite.h b/ext/pdo_sqlite/php_pdo_sqlite.h
index 3bf8c2fdf..3e912c518 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_sqlite.h,v 1.2.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_sqlite.h,v 1.2.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_PDO_SQLITE_H
diff --git a/ext/pdo_sqlite/php_pdo_sqlite_int.h b/ext/pdo_sqlite/php_pdo_sqlite_int.h
index 483fdc9f4..0269e9c6a 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite_int.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite_int.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_sqlite_int.h,v 1.3.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_sqlite_int.h,v 1.3.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_PDO_SQLITE_INT_H
#define PHP_PDO_SQLITE_INT_H
diff --git a/ext/pdo_sqlite/sqlite/VERSION b/ext/pdo_sqlite/sqlite/VERSION
index e9f0bde54..86fb65044 100644
--- a/ext/pdo_sqlite/sqlite/VERSION
+++ b/ext/pdo_sqlite/sqlite/VERSION
@@ -1 +1 @@
-3.3.17
+3.3.7
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 820372555..f65cc9320 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sqlite_driver.c,v 1.20.2.5.2.2 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: sqlite_driver.c,v 1.20.2.5.2.3 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c
index 96b4ef58c..339f47143 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sqlite_statement.c,v 1.18.2.4.2.3 2007/08/01 22:45:31 iliaa Exp $ */
+/* $Id: sqlite_statement.c,v 1.18.2.4.2.4 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 968eda3f1..15371e01c 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.331.2.13.2.25 2007/10/03 23:31:58 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.331.2.13.2.27 2007/12/31 07:20:10 sebastian Exp $ */
#include <stdlib.h>
@@ -4083,6 +4083,7 @@ PHP_FUNCTION(pg_send_query_params)
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "There are results on this connection. Call pg_get_result() until it returns FALSE");
}
+ SEPARATE_ZVAL(pv_param_arr);
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(pv_param_arr));
num_params = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr));
if (num_params > 0) {
@@ -4097,7 +4098,8 @@ PHP_FUNCTION(pg_send_query_params)
}
otype = (*tmp)->type;
- convert_to_string(*tmp);
+ SEPARATE_ZVAL(tmp);
+ convert_to_string_ex(tmp);
if (Z_TYPE_PP(tmp) != IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
_php_pgsql_free_params(params, num_params);
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index 128f762f4..08b2a394d 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pgsql.h,v 1.73.2.1.2.2 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pgsql.h,v 1.73.2.1.2.3 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_PGSQL_H
#define PHP_PGSQL_H
diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h
index 2f1729877..a966b490f 100644
--- a/ext/posix/php_posix.h
+++ b/ext/posix/php_posix.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
*/
-/* $Id: php_posix.h,v 1.18.2.1.2.2 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_posix.h,v 1.18.2.1.2.3 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_POSIX_H
#define PHP_POSIX_H
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 7182d56bf..ba9d09aa4 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: posix.c,v 1.70.2.3.2.16 2007/07/25 09:06:22 bjori Exp $ */
+/* $Id: posix.c,v 1.70.2.3.2.18 2008/04/11 11:00:24 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -147,7 +147,7 @@ zend_function_entry posix_functions[] = {
static PHP_MINFO_FUNCTION(posix)
{
php_info_print_table_start();
- php_info_print_table_row(2, "Revision", "$Revision: 1.70.2.3.2.16 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.70.2.3.2.18 $");
php_info_print_table_end();
}
/* }}} */
@@ -875,7 +875,7 @@ PHP_FUNCTION(posix_getgrgid)
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
int ret;
struct group _g;
- struct group *retgrptr;
+ struct group *retgrptr = NULL;
long grbuflen;
char *grbuf;
#endif
@@ -894,7 +894,7 @@ PHP_FUNCTION(posix_getgrgid)
grbuf = emalloc(grbuflen);
ret = getgrgid_r(gid, &_g, grbuf, grbuflen, &retgrptr);
- if (ret) {
+ if (ret || retgrptr == NULL) {
POSIX_G(last_error) = ret;
efree(grbuf);
RETURN_FALSE;
@@ -1009,7 +1009,7 @@ PHP_FUNCTION(posix_getpwuid)
pwbuf = emalloc(pwbuflen);
ret = getpwuid_r(uid, &_pw, pwbuf, pwbuflen, &retpwptr);
- if (ret) {
+ if (ret || retpwptr == NULL) {
POSIX_G(last_error) = ret;
efree(pwbuf);
RETURN_FALSE;
diff --git a/ext/posix/tests/posix_get_last_error_error.phpt b/ext/posix/tests/posix_get_last_error_error.phpt
new file mode 100644
index 000000000..1089b440a
--- /dev/null
+++ b/ext/posix/tests/posix_get_last_error_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_get_last_error() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_get_last_error(void)
+ * Description: Retrieve the error number set by the last posix function which failed.
+ * Source code: ext/posix/posix.c
+ * Alias to functions: posix_errno
+ */
+
+echo "*** Testing posix_get_last_error() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_get_last_error() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_get_last_error($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_get_last_error() : error conditions ***
+
+-- Testing posix_get_last_error() function with one argument --
+
+Warning: Wrong parameter count for posix_get_last_error() in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getgid_error.phpt b/ext/posix/tests/posix_getgid_error.phpt
new file mode 100644
index 000000000..8c1a4ec1e
--- /dev/null
+++ b/ext/posix/tests/posix_getgid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getgid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getgid(void)
+ * Description: Get the current group id (POSIX.1, 4.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getgid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getgid() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getgid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getgid() : error conditions ***
+
+-- Testing posix_getgid() function with one argument --
+
+Warning: Wrong parameter count for posix_getgid() in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getgrgid_error.phpt b/ext/posix/tests/posix_getgrgid_error.phpt
new file mode 100644
index 000000000..bce624f45
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid_error.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test posix_getgrgid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getgrgid(long gid)
+ * Description: Group database access (POSIX.1, 9.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing posix_getgrgid() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing posix_getgrgid() function with Zero arguments --\n";
+var_dump( posix_getgrgid() );
+
+//Test posix_getgrgid with one more than the expected number of arguments
+echo "\n-- Testing posix_getgrgid() function with more than expected no. of arguments --\n";
+
+$extra_arg = 10;
+$gid = 0;
+var_dump( posix_getgrgid($gid, $extra_arg) );
+
+echo "\n-- Testing posix_getgrgid() function with a negative group id --\n";
+$gid = -999;
+var_dump( posix_getgrgid($gid));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getgrgid() : error conditions ***
+
+-- Testing posix_getgrgid() function with Zero arguments --
+
+Warning: posix_getgrgid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_getgrgid() function with more than expected no. of arguments --
+
+Warning: posix_getgrgid() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_getgrgid() function with a negative group id --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_getgrgid_variation.phpt b/ext/posix/tests/posix_getgrgid_variation.phpt
new file mode 100644
index 000000000..13db73b79
--- /dev/null
+++ b/ext/posix/tests/posix_getgrgid_variation.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test posix_getgrgid() function : usage variations - parameter types
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getgrgid(long gid)
+ * Description: Group database access (POSIX.1, 9.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getgrgid() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for gid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ $result = posix_getgrgid($value);
+ if ((is_array($result) && (count($result) == 4))
+ ||
+ ($result === false)) {
+ echo "valid output\n";
+ } else {
+ var_dump($result);
+ }
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getgrgid() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+valid output
+
+Arg value -10.5
+valid output
+
+Arg value 101234567000
+valid output
+
+Arg value 1.07654321E-9
+valid output
+
+Arg value 0.5
+valid output
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getgrgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getgrgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_getpgid_error.phpt b/ext/posix/tests/posix_getpgid_error.phpt
new file mode 100644
index 000000000..e703b8fdc
--- /dev/null
+++ b/ext/posix/tests/posix_getpgid_error.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test posix_getpgid() function : error conditions
+--SKIPIF--
+<?php
+if((!extension_loaded("posix")) || (!function_exists(posix_getpgid))) {
+ print "skip - POSIX extension not loaded or posix_getpgid() does not exist";
+}
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpgid(void)
+ * Description: Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpgid() : error conditions ***\n";
+
+echo "\n-- Testing posix_getpgid() function no arguments --\n";
+var_dump( posix_getpgid() );
+
+echo "\n-- Testing posix_getpgid() with one extra argument --\n";
+$pid = 10;
+$extra_arg = 20;
+var_dump( posix_getpgid($pid, $extra_arg) );
+
+echo "\n-- Testing posix_getpgid() with negative pid --\n";
+$pid = -99;
+var_dump( posix_getpgid($pid) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpgid() : error conditions ***
+
+-- Testing posix_getpgid() function no arguments --
+
+Warning: posix_getpgid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpgid() with one extra argument --
+
+Warning: posix_getpgid() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpgid() with negative pid --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_getpgid_variation.phpt b/ext/posix/tests/posix_getpgid_variation.phpt
new file mode 100644
index 000000000..34a4beb0a
--- /dev/null
+++ b/ext/posix/tests/posix_getpgid_variation.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test posix_getpgid() function : variation
+--SKIPIF--
+<?php
+if((!extension_loaded("posix")) || (!function_exists(posix_getpgid))) {
+ print "skip - POSIX extension not loaded or posix_getpgid() does not exist";
+}
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpgid(void)
+ * Description: Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpgid() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for gid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ $result = posix_getpgid($value);
+ if (is_int($result) || $result === false) {
+ echo "valid output\n";
+ } else {
+ var_dump($result);
+ }
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpgid() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+valid output
+
+Arg value -10.5
+valid output
+
+Arg value 101234567000
+valid output
+
+Arg value 1.07654321E-9
+valid output
+
+Arg value 0.5
+valid output
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpgid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpgid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_getpgrp_error.phpt b/ext/posix/tests/posix_getpgrp_error.phpt
new file mode 100644
index 000000000..e3c071dd6
--- /dev/null
+++ b/ext/posix/tests/posix_getpgrp_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getpgrp() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpgrp(void)
+ * Description: Get current process group id (POSIX.1, 4.3.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpgrp() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getpgrp() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getpgrp($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpgrp() : error conditions ***
+
+-- Testing posix_getpgrp() function with one argument --
+
+Warning: Wrong parameter count for posix_getpgrp() in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getpid_error.phpt b/ext/posix/tests/posix_getpid_error.phpt
new file mode 100644
index 000000000..460cc4254
--- /dev/null
+++ b/ext/posix/tests/posix_getpid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getpid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getpid(void)
+ * Description: Get the current process id (POSIX.1, 4.1.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getpid() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getpid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpid() : error conditions ***
+
+-- Testing posix_getpid() function with one argument --
+
+Warning: Wrong parameter count for posix_getpid() in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getppid_error.phpt b/ext/posix/tests/posix_getppid_error.phpt
new file mode 100644
index 000000000..26426ac6a
--- /dev/null
+++ b/ext/posix/tests/posix_getppid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getppid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getppid(void)
+ * Description: Get the parent process id (POSIX.1, 4.1.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getppid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getppid() function with one argument --\n";
+$extra_arg = 10;
+var_dump( posix_getppid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getppid() : error conditions ***
+
+-- Testing posix_getppid() function with one argument --
+
+Warning: Wrong parameter count for posix_getppid() in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_getpwuid_error.phpt b/ext/posix/tests/posix_getpwuid_error.phpt
new file mode 100644
index 000000000..4920e4e9d
--- /dev/null
+++ b/ext/posix/tests/posix_getpwuid_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test posix_getpwuid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getpwuid(long uid)
+ * Description: User database access (POSIX.1, 9.2.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpwuid() : error conditions ***\n";
+
+echo "\n-- Testing posix_getpwuid() function with Zero arguments --\n";
+var_dump( posix_getpwuid() );
+
+echo "\n-- Testing posix_getpwuid() function with more than expected no. of arguments --\n";
+$uid = posix_getuid();
+$extra_arg = 10;
+var_dump( posix_getpwuid($uid, $extra_arg) );
+
+echo "\n-- Testing posix_getpwuid() function negative uid --\n";
+$uid = -99;
+var_dump( posix_getpwuid($uid) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpwuid() : error conditions ***
+
+-- Testing posix_getpwuid() function with Zero arguments --
+
+Warning: posix_getpwuid() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpwuid() function with more than expected no. of arguments --
+
+Warning: posix_getpwuid() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_getpwuid() function negative uid --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_getpwuid_variation.phpt b/ext/posix/tests/posix_getpwuid_variation.phpt
new file mode 100644
index 000000000..8e91d6c31
--- /dev/null
+++ b/ext/posix/tests/posix_getpwuid_variation.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test posix_getpwuid() function : usage variations - parameter types
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_getpwuid(long uid)
+ * Description: User database access (POSIX.1, 9.2.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getpwuid() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for uid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ $result = posix_getpwuid($value);
+ if ((is_array($result) && (count($result) == 7))
+ ||
+ ($result === false)) {
+ echo "valid output\n";
+ } else {
+ var_dump($result);
+ }
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getpwuid() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+valid output
+
+Arg value -10.5
+valid output
+
+Arg value 101234567000
+valid output
+
+Arg value 1.07654321E-9
+valid output
+
+Arg value 0.5
+valid output
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value Array
+
+Warning: posix_getpwuid() expects parameter 1 to be long, array given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value 1
+valid output
+
+Arg value
+valid output
+
+Arg value
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value string
+
+Warning: posix_getpwuid() expects parameter 1 to be long, string given in %s on line %d
+valid output
+
+Arg value
+valid output
+
+Arg value
+valid output
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_getuid_error.phpt b/ext/posix/tests/posix_getuid_error.phpt
new file mode 100644
index 000000000..44c0b945b
--- /dev/null
+++ b/ext/posix/tests/posix_getuid_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_getuid() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto int posix_getuid(void)
+ * Description: Get the current user id (POSIX.1, 4.2.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_getuid() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_getuid() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( posix_getuid($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_getuid() : error conditions ***
+
+-- Testing posix_getuid() function with one argument --
+
+Warning: Wrong parameter count for posix_getuid() in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_kill_error.phpt b/ext/posix/tests/posix_kill_error.phpt
new file mode 100644
index 000000000..082b21d6a
--- /dev/null
+++ b/ext/posix/tests/posix_kill_error.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test posix_kill() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto bool posix_kill(int pid, int sig)
+ * Description: Send a signal to a process (POSIX.1, 3.3.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing posix_kill() : error conditions ***\n";
+
+
+echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n";
+$pid = posix_getpid();
+$sig = 9;
+$extra_arg = 10;
+var_dump( posix_kill($pid, $sig, $extra_arg) );
+
+echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n";
+$pid = posix_getpid();
+var_dump( posix_kill($pid) );
+
+echo "\n-- Testing posix_kill() function with invalid signal --\n";
+$pid = posix_getpid();
+$sig = 999;
+var_dump( posix_kill($pid, 999) );
+
+echo "\n-- Testing posix_kill() function with negative pid --\n";
+$pid = -999;
+$sig = 9;
+var_dump( posix_kill($pid, 999) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_kill() : error conditions ***
+
+-- Testing posix_kill() function with more than expected no. of arguments --
+
+Warning: posix_kill() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+
+-- Testing posix_kill() function with less than expected no. of arguments --
+
+Warning: posix_kill() expects exactly 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- Testing posix_kill() function with invalid signal --
+bool(false)
+
+-- Testing posix_kill() function with negative pid --
+bool(false)
+Done
diff --git a/ext/posix/tests/posix_kill_variation1.phpt b/ext/posix/tests/posix_kill_variation1.phpt
new file mode 100644
index 000000000..46268f241
--- /dev/null
+++ b/ext/posix/tests/posix_kill_variation1.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test posix_kill() function : usage variations - first parameter type
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto bool posix_kill(int pid, int sig)
+ * Description: Send a signal to a process (POSIX.1, 3.3.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing posix_kill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$sig = -999;
+
+//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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for pid
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( posix_kill($value, $sig) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_kill() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_kill_variation2.phpt b/ext/posix/tests/posix_kill_variation2.phpt
new file mode 100644
index 000000000..aef9acd04
--- /dev/null
+++ b/ext/posix/tests/posix_kill_variation2.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test posix_kill() function : usage variations - second parameter type
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto bool posix_kill(int pid, int sig)
+ * Description: Send a signal to a process (POSIX.1, 3.3.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing posix_kill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pid = -999;
+
+//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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for sig
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( posix_kill($pid, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_kill() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_kill() expects parameter 2 to be long, array given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_kill() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_strerror_error.phpt b/ext/posix/tests/posix_strerror_error.phpt
new file mode 100644
index 000000000..6fc17ec0c
--- /dev/null
+++ b/ext/posix/tests/posix_strerror_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test posix_strerror() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto string posix_strerror(int errno)
+ * Description: Retrieve the system error message associated with the given errno.
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_strerror() : error conditions ***\n";
+
+echo "\n-- Testing posix_strerror() function with Zero arguments --\n";
+var_dump( posix_strerror() );
+
+echo "\n-- Testing posix_strerror() function with more than expected no. of arguments --\n";
+$errno = posix_get_last_error();
+$extra_arg = 10;
+var_dump( posix_strerror($errno, $extra_arg) );
+
+echo "\n-- Testing posix_strerror() function with invalid error number --\n";
+$errno = -999;
+var_dump( posix_strerror($errno) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_strerror() : error conditions ***
+
+-- Testing posix_strerror() function with Zero arguments --
+
+Warning: posix_strerror() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing posix_strerror() function with more than expected no. of arguments --
+
+Warning: posix_strerror() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing posix_strerror() function with invalid error number --
+string(%d) "Unknown error %d"
+Done
diff --git a/ext/posix/tests/posix_strerror_variation1.phpt b/ext/posix/tests/posix_strerror_variation1.phpt
new file mode 100644
index 000000000..40cfab2aa
--- /dev/null
+++ b/ext/posix/tests/posix_strerror_variation1.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test posix_strerror() function : usage variations
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto string posix_strerror(int errno)
+ * Description: Retrieve the system error message associated with the given errno.
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing posix_strerror() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // object data
+ new stdclass(),
+);
+
+// loop through each element of the array for errno
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( posix_strerror($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_strerror() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+Arg value 10.5
+string(18) "No child processes"
+
+Arg value -10.5
+string(%d) "Unknown error %d"
+
+Arg value 101234567000
+string(%d) "Unknown error %d"
+
+Arg value 1.07654321E-9
+string(7) "Success"
+
+Arg value 0.5
+string(7) "Success"
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value Array
+
+Warning: posix_strerror() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Arg value
+string(7) "Success"
+
+Arg value
+string(7) "Success"
+
+Arg value 1
+string(23) "Operation not permitted"
+
+Arg value
+string(7) "Success"
+
+Arg value 1
+string(23) "Operation not permitted"
+
+Arg value
+string(7) "Success"
+
+Arg value
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value string
+
+Warning: posix_strerror() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Arg value
+string(7) "Success"
+
+Arg value
+string(7) "Success"
+
+Catchable fatal error: Object of class stdClass could not be converted to string in %s on line %d
diff --git a/ext/posix/tests/posix_times_error.phpt b/ext/posix/tests/posix_times_error.phpt
new file mode 100644
index 000000000..79b1f797c
--- /dev/null
+++ b/ext/posix/tests/posix_times_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_times() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_times(void)
+ * Description: Get process times (POSIX.1, 4.5.2)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_times() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_times() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( posix_times($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_times() : error conditions ***
+
+-- Testing posix_times() function with one argument --
+
+Warning: Wrong parameter count for posix_times() in %s on line %d
+NULL
+Done
diff --git a/ext/posix/tests/posix_uname_error.phpt b/ext/posix/tests/posix_uname_error.phpt
new file mode 100644
index 000000000..df531734f
--- /dev/null
+++ b/ext/posix/tests/posix_uname_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test posix_uname() function : error conditions
+--SKIPIF--
+<?php
+ if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
+?>
+--FILE--
+<?php
+/* Prototype : proto array posix_uname(void)
+ * Description: Get system name (POSIX.1, 4.4.1)
+ * Source code: ext/posix/posix.c
+ * Alias to functions:
+ */
+
+echo "*** Testing posix_uname() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing posix_uname() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( posix_uname($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing posix_uname() : error conditions ***
+
+-- Testing posix_uname() function with one argument --
+
+Warning: Wrong parameter count for posix_uname() in %s on line %d
+NULL
+Done
diff --git a/ext/pspell/php_pspell.h b/ext/pspell/php_pspell.h
index 416507486..30fabb8d3 100644
--- a/ext/pspell/php_pspell.h
+++ b/ext/pspell/php_pspell.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pspell.h,v 1.15.2.1.2.3 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pspell.h,v 1.15.2.1.2.4 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef _PSPELL_H
#define _PSPELL_H
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 921bf26aa..693e3919a 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pspell.c,v 1.45.2.4.2.7 2007/02/24 02:17:25 helly Exp $ */
+/* $Id: pspell.c,v 1.45.2.4.2.8 2007/12/31 07:20:10 sebastian Exp $ */
#define IS_EXT_MODULE
diff --git a/ext/readline/php_readline.h b/ext/readline/php_readline.h
index 29543471e..726236187 100644
--- a/ext/readline/php_readline.h
+++ b/ext/readline/php_readline.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_readline.h,v 1.17.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_readline.h,v 1.17.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_READLINE_H
#define PHP_READLINE_H
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index e1f36f329..e2131f500 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: readline.c,v 1.42.2.3.2.3 2007/02/12 01:23:17 iliaa Exp $ */
+/* $Id: readline.c,v 1.42.2.3.2.4 2007/12/31 07:20:10 sebastian Exp $ */
/* {{{ includes & prototypes */
diff --git a/ext/recode/php_recode.h b/ext/recode/php_recode.h
index b7054ea05..d1027882c 100644
--- a/ext/recode/php_recode.h
+++ b/ext/recode/php_recode.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_recode.h,v 1.17.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_recode.h,v 1.17.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_RECODE_H
#define PHP_RECODE_H
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
index c29b123b0..c6598e7c9 100644
--- a/ext/recode/recode.c
+++ b/ext/recode/recode.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: recode.c,v 1.37.2.1.2.3 2007/06/22 00:02:15 stas Exp $ */
+/* $Id: recode.c,v 1.37.2.1.2.4 2007/12/31 07:20:10 sebastian Exp $ */
/* {{{ includes & prototypes */
@@ -122,7 +122,7 @@ PHP_MINFO_FUNCTION(recode)
{
php_info_print_table_start();
php_info_print_table_row(2, "Recode Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.37.2.1.2.3 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.37.2.1.2.4 $");
php_info_print_table_end();
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 3e3e4b67a..88791a3fe 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.164.2.33.2.47 2007/10/28 13:47:14 iliaa Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.50 2008/03/13 15:56:21 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -836,7 +836,7 @@ static int _extension_ini_string(zend_ini_entry *ini_entry, int num_args, va_lis
if (number == ini_entry->module_number) {
string_printf(str, " %sEntry [ %s <", indent, ini_entry->name);
- if (ini_entry->modifiable == ZEND_INI_ALL) {
+ if (ini_entry->modifiable & ZEND_INI_ALL) {
string_printf(str, "ALL");
} else {
if (ini_entry->modifiable & ZEND_INI_USER) {
@@ -2144,7 +2144,6 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
reflection_object *intern;
parameter_reference *param;
zend_op *precv;
- zval *zv, zv_copy;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
@@ -2164,10 +2163,12 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
return;
}
- zv_copy = precv->op2.u.constant;
- zv = &zv_copy;
- zval_update_constant_ex(&zv, (void*)0, param->fptr->common.scope TSRMLS_CC);
- RETURN_ZVAL(zv, 1, 1);
+ *return_value = precv->op2.u.constant;
+ INIT_PZVAL(return_value);
+ if (Z_TYPE_P(return_value) != IS_CONSTANT) {
+ zval_copy_ctor(return_value);
+ }
+ zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
}
/* }}} */
@@ -4907,7 +4908,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.47 2007/10/28 13:47:14 iliaa Exp $");
+ php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.50 2008/03/13 15:56:21 iliaa Exp $");
php_info_print_table_end();
} /* }}} */
diff --git a/ext/reflection/php_reflection.h b/ext/reflection/php_reflection.h
index 8ebeffb63..f7ff5fe4c 100644
--- a/ext/reflection/php_reflection.h
+++ b/ext/reflection/php_reflection.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.h,v 1.4.2.3.2.2 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_reflection.h,v 1.4.2.3.2.3 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_REFLECTION_H
#define PHP_REFLECTION_H
diff --git a/ext/reflection/tests/ReflectionMethod_basic1.phpt b/ext/reflection/tests/ReflectionMethod_basic1.phpt
new file mode 100644
index 000000000..8671c5acb
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_basic1.phpt
@@ -0,0 +1,300 @@
+--TEST--
+ReflectionMethod class - various methods
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectMethod($class, $method) {
+ $methodInfo = new ReflectionMethod($class, $method);
+ echo "**********************************\n";
+ echo "Reflecting on method $class::$method()\n\n";
+ echo "\nisFinal():\n";
+ var_dump($methodInfo->isFinal());
+ echo "\nisAbstract():\n";
+ var_dump($methodInfo->isAbstract());
+ echo "\nisPublic():\n";
+ var_dump($methodInfo->isPublic());
+ echo "\nisPrivate():\n";
+ var_dump($methodInfo->isPrivate());
+ echo "\nisProtected():\n";
+ var_dump($methodInfo->isProtected());
+ echo "\nisStatic():\n";
+ var_dump($methodInfo->isStatic());
+ echo "\nisConstructor():\n";
+ var_dump($methodInfo->isConstructor());
+ echo "\nisDestructor():\n";
+ var_dump($methodInfo->isDestructor());
+ echo "\n**********************************\n";
+}
+
+class TestClass
+{
+ public function foo() {
+ echo "Called foo()\n";
+ }
+
+ static function stat() {
+ echo "Called stat()\n";
+ }
+
+ private function priv() {
+ echo "Called priv()\n";
+ }
+
+ protected function prot() {}
+
+ public function __destruct() {}
+}
+
+class DerivedClass extends TestClass {}
+
+interface TestInterface {
+ public function int();
+}
+
+reflectMethod("DerivedClass", "foo");
+reflectMethod("TestClass", "stat");
+reflectMethod("TestClass", "priv");
+reflectMethod("TestClass", "prot");
+reflectMethod("DerivedClass", "prot");
+reflectMethod("TestInterface", "int");
+reflectMethod("ReflectionProperty", "__construct");
+reflectMethod("TestClass", "__destruct");
+
+?>
+--EXPECT--
+**********************************
+Reflecting on method DerivedClass::foo()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(false)
+
+isPublic():
+bool(true)
+
+isPrivate():
+bool(false)
+
+isProtected():
+bool(false)
+
+isStatic():
+bool(false)
+
+isConstructor():
+bool(false)
+
+isDestructor():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method TestClass::stat()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(false)
+
+isPublic():
+bool(true)
+
+isPrivate():
+bool(false)
+
+isProtected():
+bool(false)
+
+isStatic():
+bool(true)
+
+isConstructor():
+bool(false)
+
+isDestructor():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method TestClass::priv()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(false)
+
+isPublic():
+bool(false)
+
+isPrivate():
+bool(true)
+
+isProtected():
+bool(false)
+
+isStatic():
+bool(false)
+
+isConstructor():
+bool(false)
+
+isDestructor():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method TestClass::prot()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(false)
+
+isPublic():
+bool(false)
+
+isPrivate():
+bool(false)
+
+isProtected():
+bool(true)
+
+isStatic():
+bool(false)
+
+isConstructor():
+bool(false)
+
+isDestructor():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method DerivedClass::prot()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(false)
+
+isPublic():
+bool(false)
+
+isPrivate():
+bool(false)
+
+isProtected():
+bool(true)
+
+isStatic():
+bool(false)
+
+isConstructor():
+bool(false)
+
+isDestructor():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method TestInterface::int()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(true)
+
+isPublic():
+bool(true)
+
+isPrivate():
+bool(false)
+
+isProtected():
+bool(false)
+
+isStatic():
+bool(false)
+
+isConstructor():
+bool(false)
+
+isDestructor():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method ReflectionProperty::__construct()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(false)
+
+isPublic():
+bool(true)
+
+isPrivate():
+bool(false)
+
+isProtected():
+bool(false)
+
+isStatic():
+bool(false)
+
+isConstructor():
+bool(true)
+
+isDestructor():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method TestClass::__destruct()
+
+
+isFinal():
+bool(false)
+
+isAbstract():
+bool(false)
+
+isPublic():
+bool(true)
+
+isPrivate():
+bool(false)
+
+isProtected():
+bool(false)
+
+isStatic():
+bool(false)
+
+isConstructor():
+bool(false)
+
+isDestructor():
+bool(true)
+
+**********************************
+
+
diff --git a/ext/reflection/tests/ReflectionMethod_basic2.phpt b/ext/reflection/tests/ReflectionMethod_basic2.phpt
new file mode 100644
index 000000000..56ddb7fce
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_basic2.phpt
@@ -0,0 +1,188 @@
+--TEST--
+ReflectionMethod class __toString() and export() methods
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectMethod($class, $method) {
+ $methodInfo = new ReflectionMethod($class, $method);
+ echo "**********************************\n";
+ echo "Reflecting on method $class::$method()\n\n";
+ echo "__toString():\n";
+ var_dump($methodInfo->__toString());
+ echo "\nexport():\n";
+ var_dump(ReflectionMethod::export($class, $method, true));
+ echo "\n**********************************\n";
+}
+
+class TestClass
+{
+ public function foo() {
+ echo "Called foo()\n";
+ }
+
+ static function stat() {
+ echo "Called stat()\n";
+ }
+
+ private function priv() {
+ echo "Called priv()\n";
+ }
+
+ protected function prot() {}
+
+ public function __destruct() {}
+}
+
+class DerivedClass extends TestClass {}
+
+interface TestInterface {
+ public function int();
+}
+
+reflectMethod("DerivedClass", "foo");
+reflectMethod("TestClass", "stat");
+reflectMethod("TestClass", "priv");
+reflectMethod("TestClass", "prot");
+reflectMethod("DerivedClass", "prot");
+reflectMethod("TestInterface", "int");
+reflectMethod("ReflectionProperty", "__construct");
+reflectMethod("TestClass", "__destruct");
+
+?>
+--EXPECTF--
+**********************************
+Reflecting on method DerivedClass::foo()
+
+__toString():
+string(%d) "Method [ <user, inherits TestClass> public method foo ] {
+ @@ %s 16 - 18
+}
+"
+
+export():
+string(%d) "Method [ <user, inherits TestClass> public method foo ] {
+ @@ %s 16 - 18
+}
+"
+
+**********************************
+**********************************
+Reflecting on method TestClass::stat()
+
+__toString():
+string(%d) "Method [ <user> static public method stat ] {
+ @@ %s 20 - 22
+}
+"
+
+export():
+string(%d) "Method [ <user> static public method stat ] {
+ @@ %s 20 - 22
+}
+"
+
+**********************************
+**********************************
+Reflecting on method TestClass::priv()
+
+__toString():
+string(%d) "Method [ <user> private method priv ] {
+ @@ %s 24 - 26
+}
+"
+
+export():
+string(%d) "Method [ <user> private method priv ] {
+ @@ %s 24 - 26
+}
+"
+
+**********************************
+**********************************
+Reflecting on method TestClass::prot()
+
+__toString():
+string(%d) "Method [ <user> protected method prot ] {
+ @@ %s 28 - 28
+}
+"
+
+export():
+string(%d) "Method [ <user> protected method prot ] {
+ @@ %s 28 - 28
+}
+"
+
+**********************************
+**********************************
+Reflecting on method DerivedClass::prot()
+
+__toString():
+string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
+ @@ %s 28 - 28
+}
+"
+
+export():
+string(%d) "Method [ <user, inherits TestClass> protected method prot ] {
+ @@ %s 28 - 28
+}
+"
+
+**********************************
+**********************************
+Reflecting on method TestInterface::int()
+
+__toString():
+string(%d) "Method [ <user> abstract public method int ] {
+ @@ %s 36 - 36
+}
+"
+
+export():
+string(%d) "Method [ <user> abstract public method int ] {
+ @@ %s 36 - 36
+}
+"
+
+**********************************
+**********************************
+Reflecting on method ReflectionProperty::__construct()
+
+__toString():
+string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $argument ]
+ }
+}
+"
+
+export():
+string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $argument ]
+ }
+}
+"
+
+**********************************
+**********************************
+Reflecting on method TestClass::__destruct()
+
+__toString():
+string(%d) "Method [ <user, dtor> public method __destruct ] {
+ @@ %s 30 - 30
+}
+"
+
+export():
+string(%d) "Method [ <user, dtor> public method __destruct ] {
+ @@ %s 30 - 30
+}
+"
+
+**********************************
diff --git a/ext/reflection/tests/ReflectionMethod_basic3.phpt b/ext/reflection/tests/ReflectionMethod_basic3.phpt
new file mode 100644
index 000000000..3bc517138
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_basic3.phpt
@@ -0,0 +1,169 @@
+--TEST--
+ReflectionMethod class getName(), isInternal() and isUserDefined() methods
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectMethod($class, $method) {
+ $methodInfo = new ReflectionMethod($class, $method);
+ echo "**********************************\n";
+ echo "Reflecting on method $class::$method()\n\n";
+ echo "\ngetName():\n";
+ var_dump($methodInfo->getName());
+ echo "\nisInternal():\n";
+ var_dump($methodInfo->isInternal());
+ echo "\nisUserDefined():\n";
+ var_dump($methodInfo->isUserDefined());
+ echo "\n**********************************\n";
+}
+
+class TestClass
+{
+ public function foo() {
+ echo "Called foo()\n";
+ }
+
+ static function stat() {
+ echo "Called stat()\n";
+ }
+
+ private function priv() {
+ echo "Called priv()\n";
+ }
+
+ protected function prot() {}
+
+ public function __destruct() {}
+}
+
+class DerivedClass extends TestClass {}
+
+interface TestInterface {
+ public function int();
+}
+
+reflectMethod("DerivedClass", "foo");
+reflectMethod("TestClass", "stat");
+reflectMethod("TestClass", "priv");
+reflectMethod("TestClass", "prot");
+reflectMethod("DerivedClass", "prot");
+reflectMethod("TestInterface", "int");
+reflectMethod("ReflectionProperty", "__construct");
+reflectMethod("TestClass", "__destruct");
+
+
+?>
+--EXPECT--
+**********************************
+Reflecting on method DerivedClass::foo()
+
+
+getName():
+string(3) "foo"
+
+isInternal():
+bool(false)
+
+isUserDefined():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on method TestClass::stat()
+
+
+getName():
+string(4) "stat"
+
+isInternal():
+bool(false)
+
+isUserDefined():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on method TestClass::priv()
+
+
+getName():
+string(4) "priv"
+
+isInternal():
+bool(false)
+
+isUserDefined():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on method TestClass::prot()
+
+
+getName():
+string(4) "prot"
+
+isInternal():
+bool(false)
+
+isUserDefined():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on method DerivedClass::prot()
+
+
+getName():
+string(4) "prot"
+
+isInternal():
+bool(false)
+
+isUserDefined():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on method TestInterface::int()
+
+
+getName():
+string(3) "int"
+
+isInternal():
+bool(false)
+
+isUserDefined():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on method ReflectionProperty::__construct()
+
+
+getName():
+string(11) "__construct"
+
+isInternal():
+bool(true)
+
+isUserDefined():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method TestClass::__destruct()
+
+
+getName():
+string(10) "__destruct"
+
+isInternal():
+bool(false)
+
+isUserDefined():
+bool(true)
+
+**********************************
diff --git a/ext/reflection/tests/ReflectionMethod_basic4.phpt b/ext/reflection/tests/ReflectionMethod_basic4.phpt
new file mode 100644
index 000000000..9aac8c67f
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_basic4.phpt
@@ -0,0 +1,172 @@
+--TEST--
+ReflectionMethod class getFileName(), getStartLine() and getEndLine() methods
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectMethod($class, $method) {
+ $methodInfo = new ReflectionMethod($class, $method);
+ echo "**********************************\n";
+ echo "Reflecting on method $class::$method()\n\n";
+ echo "\ngetFileName():\n";
+ var_dump($methodInfo->getFileName());
+ echo "\ngetStartLine():\n";
+ var_dump($methodInfo->getStartLine());
+ echo "\ngetEndLine():\n";
+ var_dump($methodInfo->getEndLine());
+ echo "\n**********************************\n";
+}
+
+class TestClass
+{
+ public function foo() {
+
+
+ echo "Called foo()\n";
+
+
+ }
+
+ static function stat() {
+ echo "Called stat()\n";
+ }
+
+ private function priv() {
+ echo "Called priv()\n";
+ }
+
+ protected function prot() {}
+
+ public function __destruct() {}
+}
+
+class DerivedClass extends TestClass {}
+
+interface TestInterface {
+ public function int();
+}
+
+reflectMethod("DerivedClass", "foo");
+reflectMethod("TestClass", "stat");
+reflectMethod("TestClass", "priv");
+reflectMethod("TestClass", "prot");
+reflectMethod("DerivedClass", "prot");
+reflectMethod("TestInterface", "int");
+reflectMethod("ReflectionProperty", "__construct");
+reflectMethod("TestClass", "__destruct");
+
+?>
+--EXPECTF--
+**********************************
+Reflecting on method DerivedClass::foo()
+
+
+getFileName():
+string(%d) "%sReflectionMethod_basic4.php"
+
+getStartLine():
+int(18)
+
+getEndLine():
+int(24)
+
+**********************************
+**********************************
+Reflecting on method TestClass::stat()
+
+
+getFileName():
+string(%d) "%sReflectionMethod_basic4.php"
+
+getStartLine():
+int(26)
+
+getEndLine():
+int(28)
+
+**********************************
+**********************************
+Reflecting on method TestClass::priv()
+
+
+getFileName():
+string(%d) "%sReflectionMethod_basic4.php"
+
+getStartLine():
+int(30)
+
+getEndLine():
+int(32)
+
+**********************************
+**********************************
+Reflecting on method TestClass::prot()
+
+
+getFileName():
+string(%d) "%sReflectionMethod_basic4.php"
+
+getStartLine():
+int(34)
+
+getEndLine():
+int(34)
+
+**********************************
+**********************************
+Reflecting on method DerivedClass::prot()
+
+
+getFileName():
+string(%d) "%sReflectionMethod_basic4.php"
+
+getStartLine():
+int(34)
+
+getEndLine():
+int(34)
+
+**********************************
+**********************************
+Reflecting on method TestInterface::int()
+
+
+getFileName():
+string(%d) "%sReflectionMethod_basic4.php"
+
+getStartLine():
+int(42)
+
+getEndLine():
+int(42)
+
+**********************************
+**********************************
+Reflecting on method ReflectionProperty::__construct()
+
+
+getFileName():
+bool(false)
+
+getStartLine():
+bool(false)
+
+getEndLine():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on method TestClass::__destruct()
+
+
+getFileName():
+string(%d) "%sReflectionMethod_basic4.php"
+
+getStartLine():
+int(36)
+
+getEndLine():
+int(36)
+
+**********************************
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
new file mode 100644
index 000000000..5655b0eea
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
@@ -0,0 +1,121 @@
+--TEST--
+ReflectionMethod::isConstructor()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class NewCtor {
+ function __construct() {
+ echo "In " . __METHOD__ . "\n";
+ }
+
+}
+echo "New-style constructor:\n";
+$methodInfo = new ReflectionMethod("NewCtor::__construct");
+var_dump($methodInfo->isConstructor());
+
+class ExtendsNewCtor extends NewCtor {
+}
+echo "\nInherited new-style constructor\n";
+$methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct");
+var_dump($methodInfo->isConstructor());
+
+class OldCtor {
+ function OldCtor() {
+ echo "In " . __METHOD__ . "\n";
+ }
+}
+echo "\nOld-style constructor:\n";
+$methodInfo = new ReflectionMethod("OldCtor::OldCtor");
+var_dump($methodInfo->isConstructor());
+
+class ExtendsOldCtor extends OldCtor {
+}
+echo "\nInherited old-style constructor:\n";
+$methodInfo = new ReflectionMethod("ExtendsOldCtor::OldCtor");
+var_dump($methodInfo->isConstructor());
+
+class X {
+ function Y() {
+ echo "In " . __METHOD__ . "\n";
+ }
+}
+echo "\nNot a constructor:\n";
+$methodInfo = new ReflectionMethod("X::Y");
+var_dump($methodInfo->isConstructor());
+
+class Y extends X {
+}
+echo "\nInherited method of the same name as the class:\n";
+$methodInfo = new ReflectionMethod("Y::Y");
+var_dump($methodInfo->isConstructor());
+
+class OldAndNewCtor {
+ function OldAndNewCtor() {
+ echo "In " . __METHOD__ . "\n";
+ }
+
+ function __construct() {
+ echo "In " . __METHOD__ . "\n";
+ }
+}
+echo "\nOld-style constructor:\n";
+$methodInfo = new ReflectionMethod("OldAndNewCtor::OldAndNewCtor");
+var_dump($methodInfo->isConstructor());
+
+echo "\nRedefined constructor:\n";
+$methodInfo = new ReflectionMethod("OldAndNewCtor::__construct");
+var_dump($methodInfo->isConstructor());
+
+class NewAndOldCtor {
+ function __construct() {
+ echo "In " . __METHOD__ . "\n";
+ }
+
+ function NewAndOldCtor() {
+ echo "In " . __METHOD__ . "\n";
+ }
+}
+echo "\nNew-style constructor:\n";
+$methodInfo = new ReflectionMethod("NewAndOldCtor::__construct");
+var_dump($methodInfo->isConstructor());
+
+echo "\nRedefined old-style constructor:\n";
+$methodInfo = new ReflectionMethod("NewAndOldCtor::NewAndOldCtor");
+var_dump($methodInfo->isConstructor());
+
+?>
+--EXPECTF--
+Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
+
+Strict Standards: %s for class NewAndOldCtor in %s on line %d
+New-style constructor:
+bool(true)
+
+Inherited new-style constructor
+bool(true)
+
+Old-style constructor:
+bool(true)
+
+Inherited old-style constructor:
+bool(true)
+
+Not a constructor:
+bool(false)
+
+Inherited method of the same name as the class:
+bool(false)
+
+Old-style constructor:
+bool(false)
+
+Redefined constructor:
+bool(true)
+
+New-style constructor:
+bool(true)
+
+Redefined old-style constructor:
+bool(false)
diff --git a/ext/reflection/tests/ReflectionMethod_getDeclaringClass_basic.phpt b/ext/reflection/tests/ReflectionMethod_getDeclaringClass_basic.phpt
new file mode 100644
index 000000000..f043e5247
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_getDeclaringClass_basic.phpt
@@ -0,0 +1,32 @@
+--TEST--
+ReflectionMethod::getDeclaringClass()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class A {
+ function foo() {}
+}
+
+class B extends A {
+ function bar() {}
+}
+
+$methodInfo = new ReflectionMethod('B', 'foo');
+var_dump($methodInfo->getDeclaringClass());
+
+$methodInfo = new ReflectionMethod('B', 'bar');
+var_dump($methodInfo->getDeclaringClass());
+
+?>
+--EXPECTF--
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(1) "A"
+}
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(1) "B"
+}
+
diff --git a/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
new file mode 100644
index 000000000..542ddf014
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
@@ -0,0 +1,115 @@
+--TEST--
+ReflectionMethod::getDocComment()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+/**
+ * My Doc Comment for A
+ */
+class A {
+ /**
+ * My Doc Comment for A::f
+ */
+ function f() {}
+
+ /**
+ * My Doc Comment for A::privf
+ */
+ private function privf() {}
+
+ /** My Doc Comment for A::protStatf */
+ protected static function protStatf() {}
+
+ /**
+
+ * My Doc Comment for A::finalStatPubf
+ */
+ final static public function finalStatPubf() {}
+
+}
+
+
+class B extends A {
+ /*** Not a doc comment */
+ function f() {}
+
+ /** *
+ * My Doc Comment for B::privf
+ */
+
+
+
+
+ private function privf() {}
+
+
+ /** My Doc Comment for B::protStatf
+
+
+
+
+ */
+ protected static function protStatf() {}
+
+}
+
+foreach (array('A', 'B') as $class) {
+ $rc = new ReflectionClass($class);
+ $rms = $rc->getMethods();
+ foreach ($rms as $rm) {
+ echo "\n\n---> Doc comment for $class::" . $rm->getName() . "():\n";
+ var_dump($rm->getDocComment());
+ }
+}
+?>
+--EXPECTF--
+
+
+---> Doc comment for A::f():
+string(%d) "/**
+ * My Doc Comment for A::f
+ */"
+
+
+---> Doc comment for A::privf():
+string(%d) "/**
+ * My Doc Comment for A::privf
+ */"
+
+
+---> Doc comment for A::protStatf():
+string(%d) "/** My Doc Comment for A::protStatf */"
+
+
+---> Doc comment for A::finalStatPubf():
+string(%d) "/**
+
+ * My Doc Comment for A::finalStatPubf
+ */"
+
+
+---> Doc comment for B::f():
+bool(false)
+
+
+---> Doc comment for B::privf():
+string(%d) "/** *
+ * My Doc Comment for B::privf
+ */"
+
+
+---> Doc comment for B::protStatf():
+string(%d) "/** My Doc Comment for B::protStatf
+
+
+
+
+ */"
+
+
+---> Doc comment for B::finalStatPubf():
+string(%d) "/**
+
+ * My Doc Comment for A::finalStatPubf
+ */" \ No newline at end of file
diff --git a/ext/reflection/tests/ReflectionMethod_getDocComment_error.phpt b/ext/reflection/tests/ReflectionMethod_getDocComment_error.phpt
new file mode 100644
index 000000000..041d17ef3
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_getDocComment_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+ReflectionMethod::getDocComment() errors
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+class C { function f() {} }
+$rc = new ReflectionMethod('C::f');
+var_dump($rc->getDocComment(null));
+var_dump($rc->getDocComment('X'));
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for ReflectionFunctionAbstract::getDocComment() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionFunctionAbstract::getDocComment() in %s on line %d
+NULL
+
diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
new file mode 100644
index 000000000..74b96f8ee
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
@@ -0,0 +1,244 @@
+--TEST--
+ReflectionMethod::getModifiers()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectMethodModifiers($class) {
+ $classInfo = new reflectionClass($class);
+ $methodArray = $classInfo->getMethods();
+
+ foreach ($methodArray as $method) {
+ echo "Modifiers for method $method->class::$method->name():\n";
+ var_dump($method->getModifiers());
+ echo "\n\n";
+ }
+}
+
+class TestClass
+{
+ public function foo() {
+ echo "Called foo()\n";
+ }
+
+ static function stat() {
+ echo "Called stat()\n";
+ }
+
+ private function priv() {
+ echo "Called priv()\n";
+ }
+
+ protected function prot() {}
+
+ public final function fin() {}
+
+ public function __destruct() {}
+
+ public function __call($a, $b) {}
+
+ public function __clone() {}
+
+ public function __get($a) {}
+
+ public function __set($a, $b) {}
+
+ public function __unset($a) {}
+
+ public function __isset($a) {}
+
+ public function __tostring() {}
+
+ public function __sleep() {}
+
+ public function __wakeup() {}
+
+ public function __set_state() {}
+
+ public function __autoload() {}
+}
+
+class DerivedClass extends TestClass {}
+
+interface TestInterface {
+ public function int();
+ public function __clone();
+}
+
+abstract class AbstractClass {
+ public abstract function foo();
+}
+
+
+
+reflectMethodModifiers("TestClass");
+reflectMethodModifiers("DerivedClass");
+reflectMethodModifiers("TestInterface");
+reflectMethodModifiers("AbstractClass");
+
+echo "Wrong number of params:\n";
+$a = new ReflectionMethod('TestClass::foo');
+$a->getModifiers(1);
+
+$a = new ReflectionMethod('ReflectionMethod::getModifiers');
+
+echo "\nReflectionMethod::getModifiers() modifiers:\n";
+var_dump($a->getModifiers());
+
+?>
+--EXPECTF--
+Modifiers for method TestClass::foo():
+int(65792)
+
+
+Modifiers for method TestClass::stat():
+int(257)
+
+
+Modifiers for method TestClass::priv():
+int(66560)
+
+
+Modifiers for method TestClass::prot():
+int(66048)
+
+
+Modifiers for method TestClass::fin():
+int(65796)
+
+
+Modifiers for method TestClass::__destruct():
+int(16640)
+
+
+Modifiers for method TestClass::__call():
+int(256)
+
+
+Modifiers for method TestClass::__clone():
+int(33024)
+
+
+Modifiers for method TestClass::__get():
+int(256)
+
+
+Modifiers for method TestClass::__set():
+int(256)
+
+
+Modifiers for method TestClass::__unset():
+int(256)
+
+
+Modifiers for method TestClass::__isset():
+int(256)
+
+
+Modifiers for method TestClass::__tostring():
+int(256)
+
+
+Modifiers for method TestClass::__sleep():
+int(65792)
+
+
+Modifiers for method TestClass::__wakeup():
+int(65792)
+
+
+Modifiers for method TestClass::__set_state():
+int(65792)
+
+
+Modifiers for method TestClass::__autoload():
+int(65792)
+
+
+Modifiers for method DerivedClass::foo():
+int(65792)
+
+
+Modifiers for method DerivedClass::stat():
+int(257)
+
+
+Modifiers for method DerivedClass::priv():
+int(66560)
+
+
+Modifiers for method DerivedClass::prot():
+int(66048)
+
+
+Modifiers for method DerivedClass::fin():
+int(65796)
+
+
+Modifiers for method DerivedClass::__destruct():
+int(16640)
+
+
+Modifiers for method DerivedClass::__call():
+int(256)
+
+
+Modifiers for method DerivedClass::__clone():
+int(33024)
+
+
+Modifiers for method DerivedClass::__get():
+int(256)
+
+
+Modifiers for method DerivedClass::__set():
+int(256)
+
+
+Modifiers for method DerivedClass::__unset():
+int(256)
+
+
+Modifiers for method DerivedClass::__isset():
+int(256)
+
+
+Modifiers for method DerivedClass::__tostring():
+int(256)
+
+
+Modifiers for method DerivedClass::__sleep():
+int(65792)
+
+
+Modifiers for method DerivedClass::__wakeup():
+int(65792)
+
+
+Modifiers for method DerivedClass::__set_state():
+int(65792)
+
+
+Modifiers for method DerivedClass::__autoload():
+int(65792)
+
+
+Modifiers for method TestInterface::int():
+int(258)
+
+
+Modifiers for method TestInterface::__clone():
+int(258)
+
+
+Modifiers for method AbstractClass::foo():
+int(65794)
+
+
+Wrong number of params:
+
+Warning: Wrong parameter count for ReflectionMethod::getModifiers() in %s on line %d
+
+ReflectionMethod::getModifiers() modifiers:
+int(256)
diff --git a/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt b/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt
new file mode 100644
index 000000000..1a3d7c8ea
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+ReflectionMethod::getStaticVariables()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public function foo() {
+ static $c;
+ static $a = 1;
+ static $b = "hello";
+ $d = 5;
+ }
+
+ private function bar() {
+ static $a = 1;
+ }
+
+ public function noStatics() {
+ $a = 54;
+ }
+}
+
+echo "Public method:\n";
+$methodInfo = new ReflectionMethod('TestClass::foo');
+var_dump($methodInfo->getStaticVariables());
+
+echo "\nPrivate method:\n";
+$methodInfo = new ReflectionMethod('TestClass::bar');
+var_dump($methodInfo->getStaticVariables());
+
+echo "\nMethod with no static variables:\n";
+$methodInfo = new ReflectionMethod('TestClass::noStatics');
+var_dump($methodInfo->getStaticVariables());
+
+echo "\nInternal Method:\n";
+$methodInfo = new ReflectionMethod('ReflectionClass::getName');
+var_dump($methodInfo->getStaticVariables());
+
+?>
+--EXPECT--
+Public method:
+array(3) {
+ ["c"]=>
+ NULL
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ string(5) "hello"
+}
+
+Private method:
+array(1) {
+ ["a"]=>
+ int(1)
+}
+
+Method with no static variables:
+array(0) {
+}
+
+Internal Method:
+array(0) {
+} \ No newline at end of file
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_basic.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_basic.phpt
new file mode 100644
index 000000000..b6dd1c90f
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_basic.phpt
@@ -0,0 +1,75 @@
+--TEST--
+ReflectionMethod::invokeArgs()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public $prop = 2;
+
+ public function foo() {
+ echo "Called foo(), property = $this->prop\n";
+ var_dump($this);
+ return "Return Val";
+ }
+
+ public function willThrow() {
+ throw new Exception("Called willThrow()");
+ }
+
+ public function methodWithArgs($a, $b) {
+ echo "Called methodWithArgs($a, $b)\n";
+ }
+}
+
+
+$testClassInstance = new TestClass();
+$testClassInstance->prop = "Hello";
+
+$foo = new ReflectionMethod($testClassInstance, 'foo');
+$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
+$methodThatThrows = new ReflectionMethod("TestClass::willThrow");
+
+
+echo "Public method:\n";
+
+var_dump($foo->invokeArgs($testClassInstance, array()));
+var_dump($foo->invokeArgs($testClassInstance, array(true)));
+
+echo "\nMethod with args:\n";
+
+var_dump($methodWithArgs->invokeArgs($testClassInstance, array(1, "arg2")));
+var_dump($methodWithArgs->invokeArgs($testClassInstance, array(1, "arg2", 3)));
+
+echo "\nMethod that throws an exception:\n";
+try {
+ $methodThatThrows->invokeArgs($testClassInstance, array());
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+Public method:
+Called foo(), property = Hello
+object(TestClass)#%d (1) {
+ ["prop"]=>
+ string(5) "Hello"
+}
+string(10) "Return Val"
+Called foo(), property = Hello
+object(TestClass)#%d (1) {
+ ["prop"]=>
+ string(5) "Hello"
+}
+string(10) "Return Val"
+
+Method with args:
+Called methodWithArgs(1, arg2)
+NULL
+Called methodWithArgs(1, arg2)
+NULL
+
+Method that throws an exception:
+string(18) "Called willThrow()"
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error1.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error1.phpt
new file mode 100644
index 000000000..19b7fe288
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error1.phpt
@@ -0,0 +1,38 @@
+--TEST--
+ReflectionMethod:invokeArgs() errors
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+
+ public function methodWithArgs($a, $b) {
+ echo "Called methodWithArgs($a, $b)\n";
+ }
+}
+
+abstract class AbstractClass {
+ abstract function foo();
+}
+
+$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
+
+$testClassInstance = new TestClass();
+
+echo "\nMethod with args:\n";
+var_dump($methodWithArgs->invokeArgs($testClassInstance, array()));
+
+?>
+--EXPECTF--
+Method with args:
+
+Warning: Missing argument 1 for TestClass::methodWithArgs() in %s on line %d
+
+Warning: Missing argument 2 for TestClass::methodWithArgs() in %s on line %d
+
+Notice: Undefined variable: a in %s on line %d
+
+Notice: Undefined variable: b in %s on line %d
+Called methodWithArgs(, )
+NULL
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
new file mode 100644
index 000000000..ebdf9730b
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
@@ -0,0 +1,29 @@
+--TEST--
+ReflectionMethod::invokeArgs() further errors
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+
+ public function foo() {
+ echo "Called foo()\n";
+ var_dump($this);
+ return "Return Val";
+ }
+}
+
+$foo = new ReflectionMethod('TestClass', 'foo');
+
+$testClassInstance = new TestClass();
+
+try {
+ var_dump($foo->invokeArgs($testClassInstance, true));
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+Catchable fatal error: Argument 2 passed to ReflectionMethod::invokeArgs() must be an array, boolean given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
new file mode 100644
index 000000000..834f35d66
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
@@ -0,0 +1,119 @@
+--TEST--
+ReflectionMethod::invokeArgs() further errors
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public $prop = 2;
+
+ public function foo() {
+ echo "Called foo(), property = $this->prop\n";
+ var_dump($this);
+ return "Return Val";
+ }
+
+ public static function staticMethod() {
+ echo "Called staticMethod()\n";
+ var_dump($this);
+ }
+
+ private static function privateMethod() {
+ echo "Called privateMethod()\n";
+ }
+}
+
+abstract class AbstractClass {
+ abstract function foo();
+}
+
+$testClassInstance = new TestClass();
+$testClassInstance->prop = "Hello";
+
+$foo = new ReflectionMethod($testClassInstance, 'foo');
+$staticMethod = new ReflectionMethod('TestClass::staticMethod');
+$privateMethod = new ReflectionMethod("TestClass::privateMethod");
+
+echo "Wrong number of parameters:\n";
+var_dump($foo->invokeArgs());
+var_dump($foo->invokeArgs(true));
+
+echo "\nNon-instance:\n";
+try {
+ var_dump($foo->invokeArgs(new stdClass(), array()));
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+
+echo "\nNon-object:\n";
+var_dump($foo->invokeArgs(true, array()));
+
+echo "\nStatic method:\n";
+
+var_dump($staticMethod->invokeArgs());
+var_dump($staticMethod->invokeArgs(true));
+var_dump($staticMethod->invokeArgs(true, array()));
+var_dump($staticMethod->invokeArgs(null, array()));
+
+echo "\nPrivate method:\n";
+try {
+ var_dump($privateMethod->invokeArgs($testClassInstance, array()));
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+
+echo "\nAbstract method:\n";
+$abstractMethod = new ReflectionMethod("AbstractClass::foo");
+try {
+ $abstractMethod->invokeArgs($testClassInstance, array());
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+try {
+ $abstractMethod->invokeArgs(true);
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+Wrong number of parameters:
+
+Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Non-instance:
+string(72) "Given object is not an instance of the class this method was declared in"
+
+Non-object:
+
+Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+
+Static method:
+
+Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+Called staticMethod()
+
+Notice: Undefined variable: this in %s on line %d
+NULL
+NULL
+
+Private method:
+string(84) "Trying to invoke private method TestClass::privateMethod from scope ReflectionMethod"
+
+Abstract method:
+string(51) "Trying to invoke abstract method AbstractClass::foo"
+
+Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
new file mode 100644
index 000000000..c08b915e8
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
@@ -0,0 +1,110 @@
+--TEST--
+ReflectionMethod::invoke()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public $prop = 2;
+
+ public function foo() {
+ echo "Called foo(), property = $this->prop\n";
+ var_dump($this);
+ return "Return Val";
+ }
+
+ public function willThrow() {
+ throw new Exception("Called willThrow()");
+ }
+
+ public function methodWithArgs($a, $b) {
+ echo "Called methodWithArgs($a, $b)\n";
+ }
+
+ public static function staticMethod() {
+ echo "Called staticMethod()\n";
+ var_dump($this);
+ }
+
+ private static function privateMethod() {
+ echo "Called privateMethod()\n";
+ }
+}
+
+abstract class AbstractClass {
+ abstract function foo();
+}
+
+$foo = new ReflectionMethod('TestClass', 'foo');
+$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
+$staticMethod = new ReflectionMethod('TestClass::staticMethod');
+$privateMethod = new ReflectionMethod("TestClass::privateMethod");
+$methodThatThrows = new ReflectionMethod("TestClass::willThrow");
+
+$testClassInstance = new TestClass();
+$testClassInstance->prop = "Hello";
+
+echo "Public method:\n";
+
+var_dump($foo->invoke($testClassInstance));
+
+var_dump($foo->invoke($testClassInstance, true));
+
+echo "\nMethod with args:\n";
+
+var_dump($methodWithArgs->invoke($testClassInstance, 1, "arg2"));
+var_dump($methodWithArgs->invoke($testClassInstance, 1, "arg2", 3));
+
+echo "\nStatic method:\n";
+
+var_dump($staticMethod->invoke());
+var_dump($staticMethod->invoke(true));
+var_dump($staticMethod->invoke(new stdClass()));
+
+echo "\nMethod that throws an exception:\n";
+try {
+ var_dump($methodThatThrows->invoke($testClassInstance));
+} catch (Exception $exc) {
+ var_dump($exc->getMessage());
+}
+
+?>
+--EXPECTF--
+Public method:
+Called foo(), property = Hello
+object(TestClass)#%d (1) {
+ ["prop"]=>
+ string(5) "Hello"
+}
+string(10) "Return Val"
+Called foo(), property = Hello
+object(TestClass)#%d (1) {
+ ["prop"]=>
+ string(5) "Hello"
+}
+string(10) "Return Val"
+
+Method with args:
+Called methodWithArgs(1, arg2)
+NULL
+Called methodWithArgs(1, arg2)
+NULL
+
+Static method:
+
+Warning: Invoke() expects at least one parameter, none given in %s on line %d
+bool(false)
+Called staticMethod()
+
+Notice: Undefined variable: this in %s on line %d
+NULL
+NULL
+Called staticMethod()
+
+Notice: Undefined variable: this in %s on line %d
+NULL
+NULL
+
+Method that throws an exception:
+string(18) "Called willThrow()"
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
new file mode 100644
index 000000000..2846a13c6
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
@@ -0,0 +1,73 @@
+--TEST--
+ReflectionMethod::invoke() errors
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public $prop = 2;
+
+ public function foo() {
+ echo "Called foo(), property = $this->prop\n";
+ var_dump($this);
+ return "Return Val";
+ }
+
+ private static function privateMethod() {
+ echo "Called privateMethod()\n";
+ }
+}
+
+abstract class AbstractClass {
+ abstract function foo();
+}
+
+$foo = new ReflectionMethod('TestClass', 'foo');
+$privateMethod = new ReflectionMethod("TestClass::privateMethod");
+
+$testClassInstance = new TestClass();
+$testClassInstance->prop = "Hello";
+
+echo "invoke() on a non-object:\n";
+try {
+ var_dump($foo->invoke(true));
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+
+echo "\ninvoke() on a non-instance:\n";
+try {
+ var_dump($foo->invoke(new stdClass()));
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+
+echo "\nPrivate method:\n";
+try {
+ var_dump($privateMethod->invoke($testClassInstance));
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+
+echo "\nAbstract method:\n";
+$abstractMethod = new ReflectionMethod("AbstractClass::foo");
+try {
+ $abstractMethod->invoke(true);
+} catch (ReflectionException $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+invoke() on a non-object:
+string(29) "Non-object passed to Invoke()"
+
+invoke() on a non-instance:
+string(72) "Given object is not an instance of the class this method was declared in"
+
+Private method:
+string(86) "Trying to invoke private method TestClass::privateMethod() from scope ReflectionMethod"
+
+Abstract method:
+string(53) "Trying to invoke abstract method AbstractClass::foo()"
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_error2.phpt b/ext/reflection/tests/ReflectionMethod_invoke_error2.phpt
new file mode 100644
index 000000000..cb3b1c2d2
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_invoke_error2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+ReflectionMethod::invoke() further errors
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+
+ public function methodWithArgs($a, $b) {
+ echo "Called methodWithArgs($a, $b)\n";
+ }
+}
+
+$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
+
+$testClassInstance = new TestClass();
+
+echo "\nMethod with args:\n";
+var_dump($methodWithArgs->invoke($testClassInstance));
+
+?>
+--EXPECTF--
+Method with args:
+
+Warning: Missing argument 1 for TestClass::methodWithArgs() in %s on line %d
+
+Warning: Missing argument 2 for TestClass::methodWithArgs() in %s on line %d
+
+Notice: Undefined variable: a in %s on line %d
+
+Notice: Undefined variable: b in %s on line %d
+Called methodWithArgs(, )
+NULL
diff --git a/ext/reflection/tests/ReflectionMethod_returnsReference_basic.phpt b/ext/reflection/tests/ReflectionMethod_returnsReference_basic.phpt
new file mode 100644
index 000000000..b3a1f8c00
--- /dev/null
+++ b/ext/reflection/tests/ReflectionMethod_returnsReference_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+ReflectionMethod::returnsReference()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public function &foo() {
+ }
+
+ private function bar() {
+ }
+}
+
+$methodInfo = new ReflectionMethod('TestClass::foo');
+var_dump($methodInfo->returnsReference());
+
+$methodInfo = new ReflectionMethod('TestClass::bar');
+var_dump($methodInfo->returnsReference());
+
+?>
+--EXPECT--
+bool(true)
+bool(false)
diff --git a/ext/reflection/tests/reflectionProperty_basic1.phpt b/ext/reflection/tests/reflectionProperty_basic1.phpt
new file mode 100644
index 000000000..f7c1c8f10
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_basic1.phpt
@@ -0,0 +1,162 @@
+--TEST--
+Test usage of ReflectionProperty methods __toString(), export(), getName(), isPublic(), isPrivate(), isProtected(), isStatic(), getValue() and setValue().
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectProperty($class, $property) {
+ $propInfo = new ReflectionProperty($class, $property);
+ echo "**********************************\n";
+ echo "Reflecting on property $class::$property\n\n";
+ echo "__toString():\n";
+ var_dump($propInfo->__toString());
+ echo "export():\n";
+ var_dump(ReflectionProperty::export($class, $property, true));
+ echo "export():\n";
+ var_dump(ReflectionProperty::export($class, $property, false));
+ echo "getName():\n";
+ var_dump($propInfo->getName());
+ echo "isPublic():\n";
+ var_dump($propInfo->isPublic());
+ echo "isPrivate():\n";
+ var_dump($propInfo->isPrivate());
+ echo "isProtected():\n";
+ var_dump($propInfo->isProtected());
+ echo "isStatic():\n";
+ var_dump($propInfo->isStatic());
+ $instance = new $class();
+ if ($propInfo->isPublic()) {
+ echo "getValue():\n";
+ var_dump($propInfo->getValue($instance));
+ $propInfo->setValue($instance, "NewValue");
+ echo "getValue() after a setValue():\n";
+ var_dump($propInfo->getValue($instance));
+ }
+ echo "\n**********************************\n";
+}
+
+class TestClass {
+ public $pub;
+ static public $stat = "static property";
+ protected $prot = 4;
+ private $priv = "keepOut";
+}
+
+reflectProperty("TestClass", "pub");
+reflectProperty("TestClass", "stat");
+reflectProperty("TestClass", "prot");
+reflectProperty("TestClass", "priv");
+
+?>
+--EXPECT--
+**********************************
+Reflecting on property TestClass::pub
+
+__toString():
+string(35) "Property [ <default> public $pub ]
+"
+export():
+string(35) "Property [ <default> public $pub ]
+"
+export():
+Property [ <default> public $pub ]
+
+NULL
+getName():
+string(3) "pub"
+isPublic():
+bool(true)
+isPrivate():
+bool(false)
+isProtected():
+bool(false)
+isStatic():
+bool(false)
+getValue():
+NULL
+getValue() after a setValue():
+string(8) "NewValue"
+
+**********************************
+**********************************
+Reflecting on property TestClass::stat
+
+__toString():
+string(33) "Property [ public static $stat ]
+"
+export():
+string(33) "Property [ public static $stat ]
+"
+export():
+Property [ public static $stat ]
+
+NULL
+getName():
+string(4) "stat"
+isPublic():
+bool(true)
+isPrivate():
+bool(false)
+isProtected():
+bool(false)
+isStatic():
+bool(true)
+getValue():
+string(15) "static property"
+getValue() after a setValue():
+string(8) "NewValue"
+
+**********************************
+**********************************
+Reflecting on property TestClass::prot
+
+__toString():
+string(39) "Property [ <default> protected $prot ]
+"
+export():
+string(39) "Property [ <default> protected $prot ]
+"
+export():
+Property [ <default> protected $prot ]
+
+NULL
+getName():
+string(4) "prot"
+isPublic():
+bool(false)
+isPrivate():
+bool(false)
+isProtected():
+bool(true)
+isStatic():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on property TestClass::priv
+
+__toString():
+string(37) "Property [ <default> private $priv ]
+"
+export():
+string(37) "Property [ <default> private $priv ]
+"
+export():
+Property [ <default> private $priv ]
+
+NULL
+getName():
+string(4) "priv"
+isPublic():
+bool(false)
+isPrivate():
+bool(true)
+isProtected():
+bool(false)
+isStatic():
+bool(false)
+
+**********************************
+
+
diff --git a/ext/reflection/tests/reflectionProperty_basic2.phpt b/ext/reflection/tests/reflectionProperty_basic2.phpt
new file mode 100644
index 000000000..f2b5ff4fb
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_basic2.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test usage of ReflectionProperty methods isDefault(), getModifiers(), getDeclaringClass() and getDocComment().
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectProperty($class, $property) {
+ $propInfo = new ReflectionProperty($class, $property);
+ echo "**********************************\n";
+ echo "Reflecting on property $class::$property\n\n";
+ echo "isDefault():\n";
+ var_dump($propInfo->isDefault());
+ echo "getModifiers():\n";
+ var_dump($propInfo->getModifiers());
+ echo "getDeclaringClass():\n";
+ var_dump($propInfo->getDeclaringClass());
+ echo "getDocComment():\n";
+ var_dump($propInfo->getDocComment());
+ echo "\n**********************************\n";
+}
+
+class TestClass {
+ public $pub;
+ static public $stat = "static property";
+ /**
+ * This property has a comment.
+ */
+ protected $prot = 4;
+ private $priv = "keepOut";
+}
+
+reflectProperty("TestClass", "pub");
+reflectProperty("TestClass", "stat");
+reflectProperty("TestClass", "prot");
+reflectProperty("TestClass", "priv");
+
+?>
+--EXPECTF--
+**********************************
+Reflecting on property TestClass::pub
+
+isDefault():
+bool(true)
+getModifiers():
+int(256)
+getDeclaringClass():
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(9) "TestClass"
+}
+getDocComment():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on property TestClass::stat
+
+isDefault():
+bool(true)
+getModifiers():
+int(257)
+getDeclaringClass():
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(9) "TestClass"
+}
+getDocComment():
+bool(false)
+
+**********************************
+**********************************
+Reflecting on property TestClass::prot
+
+isDefault():
+bool(true)
+getModifiers():
+int(512)
+getDeclaringClass():
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(9) "TestClass"
+}
+getDocComment():
+string(%d) "/**
+ * This property has a comment.
+ */"
+
+**********************************
+**********************************
+Reflecting on property TestClass::priv
+
+isDefault():
+bool(true)
+getModifiers():
+int(1024)
+getDeclaringClass():
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(9) "TestClass"
+}
+getDocComment():
+bool(false)
+
+**********************************
diff --git a/ext/reflection/tests/reflectionProperty_constructor_error.phpt b/ext/reflection/tests/reflectionProperty_constructor_error.phpt
new file mode 100644
index 000000000..46cdc87ea
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_constructor_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test ReflectionProperty class constructor errors.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+}
+
+$a = 5;
+
+echo "Non-existent class:\n";
+try {
+ $propInfo = new ReflectionProperty("NonExistentClass", "prop");
+}
+catch(Exception $e) {
+ echo $e->getMessage();
+}
+
+echo "\n\nWrong property parameter type:\n";
+try {
+ $propInfo = new ReflectionProperty($a, 'TestClass');
+}
+catch(ReflectionException $e) {
+ echo $e->getMessage();
+}
+
+echo "\n\nNon-existent property:\n";
+try {
+ $propInfo = new ReflectionProperty('TestClass', "nonExistentProperty");
+}
+catch(Exception $e) {
+ echo $e->getMessage();
+}
+
+?>
+--EXPECT--
+Non-existent class:
+Class NonExistentClass does not exist
+
+Wrong property parameter type:
+The parameter class is expected to be either a string or an object
+
+Non-existent property:
+Property TestClass::$nonExistentProperty does not exist
diff --git a/ext/reflection/tests/reflectionProperty_error.phpt b/ext/reflection/tests/reflectionProperty_error.phpt
new file mode 100644
index 000000000..bae255c23
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_error.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test ReflectionProperty class errors.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class C {
+ public static $p;
+}
+
+var_dump(new ReflectionProperty());
+var_dump(new ReflectionProperty('C::p'));
+var_dump(new ReflectionProperty('C', 'p', 'x'));
+$rp = new ReflectionProperty('C', 'p');
+var_dump($rp->getName(1));
+var_dump($rp->isPrivate(1));
+var_dump($rp->isProtected(1));
+var_dump($rp->isPublic(1));
+var_dump($rp->isStatic(1));
+var_dump($rp->getModifiers(1));
+var_dump($rp->isDefault(1));
+
+?>
+--EXPECTF--
+
+Warning: ReflectionProperty::__construct() expects exactly 2 parameters, 0 given in %s on line %d
+object(ReflectionProperty)#%d (2) {
+ ["name"]=>
+ string(0) ""
+ ["class"]=>
+ string(0) ""
+}
+
+Warning: ReflectionProperty::__construct() expects exactly 2 parameters, 1 given in %s on line %d
+object(ReflectionProperty)#%d (2) {
+ ["name"]=>
+ string(0) ""
+ ["class"]=>
+ string(0) ""
+}
+
+Warning: ReflectionProperty::__construct() expects exactly 2 parameters, 3 given in %s on line %d
+object(ReflectionProperty)#%d (2) {
+ ["name"]=>
+ string(0) ""
+ ["class"]=>
+ string(0) ""
+}
+
+Warning: Wrong parameter count for ReflectionProperty::getName() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::isPrivate() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::isProtected() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::isPublic() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::isStatic() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::getModifiers() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::isDefault() in %s on line %d
+NULL
diff --git a/ext/reflection/tests/reflectionProperty_export_basic.phpt b/ext/reflection/tests/reflectionProperty_export_basic.phpt
new file mode 100644
index 000000000..331fdb6a2
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_export_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test ReflectionProperty::export() usage.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public $proper = 5;
+}
+
+var_dump(ReflectionProperty::export('TestClass', 'proper'));
+
+?>
+--EXPECT--
+Property [ <default> public $proper ]
+
+NULL
diff --git a/ext/reflection/tests/reflectionProperty_export_error.phpt b/ext/reflection/tests/reflectionProperty_export_error.phpt
new file mode 100644
index 000000000..9351846f6
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_export_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test ReflectionProperty::export() errors.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+}
+
+$a = 5;
+
+echo "Non-existent class:\n";
+try {
+ ReflectionProperty::export("NonExistentClass", "prop", true);
+}
+catch(Exception $e) {
+ echo $e->getMessage();
+}
+
+echo "\n\nWrong property parameter type:\n";
+try {
+ ReflectionProperty::export($a, 'TestClass', false);
+}
+catch(ReflectionException $e) {
+ echo $e->getMessage();
+}
+
+echo "\n\nNon-existent property:\n";
+try {
+ ReflectionProperty::export('TestClass', "nonExistentProperty", true);
+}
+catch(Exception $e) {
+ echo $e->getMessage();
+}
+
+echo "\n\nIncorrect number of args:\n";
+ReflectionProperty::export();
+ReflectionProperty::export('TestClass', "nonExistentProperty", true, false);
+
+?>
+--EXPECTF--
+Non-existent class:
+Class NonExistentClass does not exist
+
+Wrong property parameter type:
+The parameter class is expected to be either a string or an object
+
+Non-existent property:
+Property TestClass::$nonExistentProperty does not exist
+
+Incorrect number of args:
+
+Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d
+
+Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d
diff --git a/ext/reflection/tests/reflectionProperty_getDeclaringClass_variation1.phpt b/ext/reflection/tests/reflectionProperty_getDeclaringClass_variation1.phpt
new file mode 100644
index 000000000..3df3b2605
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_getDeclaringClass_variation1.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test ReflectionProperty::getDeclaringClass() with inherited properties.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class A {
+ public $prop;
+}
+
+class B extends A {
+}
+
+$propInfo = new ReflectionProperty('B', 'prop');
+var_dump($propInfo->getDeclaringClass());
+
+echo "Wrong number of params:\n";
+$propInfo->getDeclaringClass(1);
+
+?>
+--EXPECTF--
+object(ReflectionClass)#%d (1) {
+ ["name"]=>
+ string(1) "A"
+}
+Wrong number of params:
+
+Warning: Wrong parameter count for ReflectionProperty::getDeclaringClass() in %s on line %d
diff --git a/ext/reflection/tests/reflectionProperty_getDocComment_basic.phpt b/ext/reflection/tests/reflectionProperty_getDocComment_basic.phpt
new file mode 100644
index 000000000..44416b7fc
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_getDocComment_basic.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test ReflectionProperty::getDocComment() usage.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class A {
+ /**
+ * My Doc Comment for $a
+ *
+ */
+ public $a = 2, $b, $c = 1;
+ /**
+ * My Doc Comment for $d
+ */
+ var $d;
+ /**Not a doc comment */
+ private $e;
+ /**
+ * Doc comment for $f
+ */
+ static protected $f;
+}
+
+class B extends A {
+ public $a = 2;
+ /** A doc comment for $b */
+ var $b, $c = 1;
+ /** A doc comment for $e */
+ var $e;
+}
+
+foreach(array('A', 'B') as $class) {
+ $rc = new ReflectionClass($class);
+ $rps = $rc->getProperties();
+ foreach($rps as $rp) {
+ echo "\n\n---> Doc comment for $class::$" . $rp->getName() . ":\n";
+ var_dump($rp->getDocComment());
+ }
+}
+
+?>
+--EXPECTF--
+
+---> Doc comment for A::$a:
+string(%d) "/**
+ * My Doc Comment for $a
+ *
+ */"
+
+
+---> Doc comment for A::$b:
+bool(false)
+
+
+---> Doc comment for A::$c:
+bool(false)
+
+
+---> Doc comment for A::$d:
+string(%d) "/**
+ * My Doc Comment for $d
+ */"
+
+
+---> Doc comment for A::$e:
+bool(false)
+
+
+---> Doc comment for A::$f:
+string(%d) "/**
+ * Doc comment for $f
+ */"
+
+
+---> Doc comment for B::$a:
+bool(false)
+
+
+---> Doc comment for B::$b:
+string(%d) "/** A doc comment for $b */"
+
+
+---> Doc comment for B::$c:
+bool(false)
+
+
+---> Doc comment for B::$e:
+string(%d) "/** A doc comment for $e */"
+
+
+---> Doc comment for B::$d:
+string(%d) "/**
+ * My Doc Comment for $d
+ */"
+
+
+---> Doc comment for B::$f:
+string(%d) "/**
+ * Doc comment for $f
+ */"
diff --git a/ext/reflection/tests/reflectionProperty_getDocComment_error.phpt b/ext/reflection/tests/reflectionProperty_getDocComment_error.phpt
new file mode 100644
index 000000000..8c1b68e81
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_getDocComment_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test ReflectionProperty::getDocComment() errors.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class C {
+ public $a;
+}
+
+$rc = new ReflectionProperty('C', 'a');
+var_dump($rc->getDocComment(null));
+var_dump($rc->getDocComment('X'));
+var_dump($rc->getDocComment(true));
+var_dump($rc->getDocComment(array(1, 2, 3)));
+
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for ReflectionProperty::getDocComment() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::getDocComment() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::getDocComment() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ReflectionProperty::getDocComment() in %s on line %d
+NULL
diff --git a/ext/reflection/tests/reflectionProperty_getModifiers_basic.phpt b/ext/reflection/tests/reflectionProperty_getModifiers_basic.phpt
new file mode 100644
index 000000000..907a7e7be
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_getModifiers_basic.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test ReflectionProperty::getModifiers() usage.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class C {
+ public $a1;
+ protected $a2;
+ private $a3;
+ static public $a4;
+ static protected $a5;
+ static private $a6;
+}
+
+class D extends C {
+ public $a1;
+ protected $a2;
+ private $a3;
+ static public $a4;
+ static protected $a5;
+ static private $a6;
+}
+
+for ($i = 1;$i <= 6;$i++) {
+ $rp = new ReflectionProperty("C", "a$i");
+ echo "C::a$i: ";
+ var_dump($rp->getModifiers());
+ $rp = new ReflectionProperty("D", "a$i");
+ echo "D::a$i: ";
+ var_dump($rp->getModifiers());
+}
+
+?>
+--EXPECTF--
+C::a1: int(256)
+D::a1: int(256)
+C::a2: int(512)
+D::a2: int(512)
+C::a3: int(1024)
+D::a3: int(3072)
+C::a4: int(257)
+D::a4: int(257)
+C::a5: int(513)
+D::a5: int(513)
+C::a6: int(1025)
+D::a6: int(3073) \ No newline at end of file
diff --git a/ext/reflection/tests/reflectionProperty_getValue_error.phpt b/ext/reflection/tests/reflectionProperty_getValue_error.phpt
new file mode 100644
index 000000000..acfc3b0a0
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_getValue_error.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test ReflectionProperty::getValue() errors.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public $pub;
+ public $pub2 = 5;
+ static public $stat = "static property";
+ protected $prot = 4;
+ private $priv = "keepOut";
+}
+
+class AnotherClass {
+}
+
+$instance = new TestClass();
+$instanceWithNoProperties = new AnotherClass();
+$propInfo = new ReflectionProperty('TestClass', 'pub2');
+
+echo "Too few args:\n";
+var_dump($propInfo->getValue());
+
+echo "\nToo many args:\n";
+var_dump($propInfo->getValue($instance, true));
+
+echo "\nWrong type of arg:\n";
+var_dump($propInfo->getValue(true));
+
+echo "\nInstance without property:\n";
+$propInfo = new ReflectionProperty('TestClass', 'stat');
+
+echo "\nStatic property / too many args:\n";
+var_dump($propInfo->getValue($instance, true));
+
+echo "\nStatic property / wrong type of arg:\n";
+var_dump($propInfo->getValue(true));
+
+echo "\nProtected property:\n";
+try {
+ $propInfo = new ReflectionProperty('TestClass', 'prot');
+ var_dump($propInfo->getValue($instance));
+}
+catch(Exception $exc) {
+ echo $exc->getMessage();
+}
+
+echo "\n\nInstance without property:\n";
+$propInfo = new ReflectionProperty('TestClass', 'pub2');
+var_dump($propInfo->getValue($instanceWithNoProperties));
+
+?>
+--EXPECTF--
+Too few args:
+
+Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Too many args:
+
+Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Wrong type of arg:
+
+Warning: ReflectionProperty::getValue() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+
+Instance without property:
+
+Static property / too many args:
+string(15) "static property"
+
+Static property / wrong type of arg:
+string(15) "static property"
+
+Protected property:
+Cannot access non-public member TestClass::prot
+
+Instance without property:
+NULL
diff --git a/ext/reflection/tests/reflectionProperty_isDefault_basic.phpt b/ext/reflection/tests/reflectionProperty_isDefault_basic.phpt
new file mode 100644
index 000000000..57c3d0f3c
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_isDefault_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test ReflectionProperty::isDefault() usage.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+function reflectProperty($class, $property) {
+ $propInfo = new ReflectionProperty($class, $property);
+ echo "**********************************\n";
+ echo "Reflecting on property $class::$property\n\n";
+ echo "isDefault():\n";
+ var_dump($propInfo->isDefault());
+ echo "\n**********************************\n";
+}
+
+class TestClass {
+ public $pub;
+ static public $stat = "static property";
+ protected $prot = 4;
+ private $priv = "keepOut";
+}
+
+reflectProperty("TestClass", "pub");
+reflectProperty("TestClass", "stat");
+reflectProperty("TestClass", "prot");
+reflectProperty("TestClass", "priv");
+
+echo "Wrong number of params:\n";
+$propInfo = new ReflectionProperty('TestClass', 'pub');
+$propInfo->isDefault(1);
+
+?>
+--EXPECTF--
+**********************************
+Reflecting on property TestClass::pub
+
+isDefault():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on property TestClass::stat
+
+isDefault():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on property TestClass::prot
+
+isDefault():
+bool(true)
+
+**********************************
+**********************************
+Reflecting on property TestClass::priv
+
+isDefault():
+bool(true)
+
+**********************************
+Wrong number of params:
+
+Warning: Wrong parameter count for ReflectionProperty::isDefault() in %s on line %d
diff --git a/ext/reflection/tests/reflectionProperty_setValue_error.phpt b/ext/reflection/tests/reflectionProperty_setValue_error.phpt
new file mode 100644
index 000000000..960778235
--- /dev/null
+++ b/ext/reflection/tests/reflectionProperty_setValue_error.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test ReflectionProperty::setValue() error cases.
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+
+class TestClass {
+ public $pub;
+ public $pub2 = 5;
+ static public $stat = "static property";
+ protected $prot = 4;
+ private $priv = "keepOut";
+}
+
+class AnotherClass {
+}
+
+$instance = new TestClass();
+$instanceWithNoProperties = new AnotherClass();
+$propInfo = new ReflectionProperty('TestClass', 'pub2');
+
+echo "Too few args:\n";
+var_dump($propInfo->setValue());
+var_dump($propInfo->setValue($instance));
+
+echo "\nToo many args:\n";
+var_dump($propInfo->setValue($instance, "NewValue", true));
+
+echo "\nWrong type of arg:\n";
+var_dump($propInfo->setValue(true, "NewValue"));
+$propInfo = new ReflectionProperty('TestClass', 'stat');
+
+echo "\nStatic property / too many args:\n";
+var_dump($propInfo->setValue($instance, "NewValue", true));
+
+echo "\nStatic property / too few args:\n";
+var_dump($propInfo->setValue("A new value"));
+var_dump(TestClass::$stat);
+var_dump($propInfo->setValue());
+var_dump(TestClass::$stat);
+
+echo "\nStatic property / wrong type of arg:\n";
+var_dump($propInfo->setValue(true, "Another new value"));
+var_dump(TestClass::$stat);
+
+echo "\nProtected property:\n";
+try {
+ $propInfo = new ReflectionProperty('TestClass', 'prot');
+ var_dump($propInfo->setValue($instance, "NewValue"));
+}
+catch(Exception $exc) {
+ echo $exc->getMessage();
+}
+
+echo "\n\nInstance without property:\n";
+$propInfo = new ReflectionProperty('TestClass', 'pub2');
+var_dump($propInfo->setValue($instanceWithNoProperties, "NewValue"));
+var_dump($instanceWithNoProperties->pub2);
+?>
+--EXPECTF--
+Too few args:
+
+Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
+Too many args:
+
+Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Wrong type of arg:
+
+Warning: ReflectionProperty::setValue() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+
+Static property / too many args:
+
+Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Static property / too few args:
+NULL
+string(11) "A new value"
+
+Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+string(11) "A new value"
+
+Static property / wrong type of arg:
+NULL
+string(17) "Another new value"
+
+Protected property:
+Cannot access non-public member TestClass::prot
+
+Instance without property:
+NULL
+string(8) "NewValue"
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 3166b1577..290c0e286 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_files.c,v 1.100.2.3.2.10 2007/09/10 23:42:54 iliaa Exp $ */
+/* $Id: mod_files.c,v 1.100.2.3.2.11 2007/12/31 07:20:10 sebastian Exp $ */
#include "php.h"
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
index 99ade933e..3fc0a3a01 100644
--- a/ext/session/mod_files.h
+++ b/ext/session/mod_files.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_files.h,v 1.11.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: mod_files.h,v 1.11.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef MOD_FILES_H
#define MOD_FILES_H
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index a8859cad4..b3f593d7f 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_mm.c,v 1.46.2.1.2.5 2007/02/27 03:28:16 iliaa Exp $ */
+/* $Id: mod_mm.c,v 1.46.2.1.2.6 2007/12/31 07:20:10 sebastian Exp $ */
#include "php.h"
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
index 77ead68fb..98c44c18c 100644
--- a/ext/session/mod_mm.h
+++ b/ext/session/mod_mm.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_mm.h,v 1.12.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: mod_mm.h,v 1.12.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef MOD_MM_H
#define MOD_MM_H
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 4c28a9cec..d344feef7 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_user.c,v 1.29.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: mod_user.c,v 1.29.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#include "php.h"
#include "php_session.h"
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
index e535cc848..c7709c787 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_user.h,v 1.14.2.1.2.1 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: mod_user.h,v 1.14.2.1.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef MOD_USER_H
#define MOD_USER_H
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 5ae237e74..8ff826036 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_session.h,v 1.101.2.2.2.5 2007/02/06 00:01:18 iliaa Exp $ */
+/* $Id: php_session.h,v 1.101.2.2.2.6 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_SESSION_H
#define PHP_SESSION_H
diff --git a/ext/session/session.c b/ext/session/session.c
index 9ec40f6e2..520c820f3 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c,v 1.417.2.8.2.40 2007/08/03 01:16:40 stas Exp $ */
+/* $Id: session.c,v 1.417.2.8.2.42 2008/04/29 14:42:38 scottmac Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -78,7 +78,7 @@ zend_function_entry session_functions[] = {
PHP_FE(session_get_cookie_params, NULL)
PHP_FE(session_write_close, NULL)
PHP_FALIAS(session_commit, session_write_close, NULL)
- {NULL, NULL, NULL}
+ {NULL, NULL, NULL}
};
/* }}} */
@@ -232,7 +232,7 @@ static ps_module *ps_modules[MAX_MODULES + 1] = {
#define IF_SESSION_VARS() \
if (PS(http_session_vars) && PS(http_session_vars)->type == IS_ARRAY)
-PHPAPI int php_session_register_serializer(const char *name,
+PHPAPI int php_session_register_serializer(const char *name,
int (*encode)(PS_SERIALIZER_ENCODE_ARGS),
int (*decode)(PS_SERIALIZER_DECODE_ARGS))
{
@@ -263,9 +263,9 @@ PHPAPI int php_session_register_module(ps_module *ptr)
ps_modules[i] = ptr;
ret = 0;
break;
- }
+ }
}
-
+
return ret;
}
@@ -316,7 +316,7 @@ PHPAPI void php_add_session_var(char *name, size_t namelen TSRMLS_DC)
zval **sym_track = NULL;
IF_SESSION_VARS() {
- zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1,
+ zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1,
(void *) &sym_track);
} else {
return;
@@ -328,8 +328,8 @@ PHPAPI void php_add_session_var(char *name, size_t namelen TSRMLS_DC)
if (PG(register_globals)) {
zval **sym_global = NULL;
-
- if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void *) &sym_global) == SUCCESS) {
+
+ if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void *) &sym_global) == SUCCESS) {
if ((Z_TYPE_PP(sym_global) == IS_ARRAY && Z_ARRVAL_PP(sym_global) == &EG(symbol_table)) || *sym_global == PS(http_session_vars)) {
return;
}
@@ -352,7 +352,7 @@ PHPAPI void php_add_session_var(char *name, size_t namelen TSRMLS_DC)
} else {
if (sym_track == NULL) {
zval *empty_var;
-
+
ALLOC_INIT_ZVAL(empty_var);
ZEND_SET_SYMBOL_WITH_LENGTH(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1, empty_var, 1, 0);
}
@@ -363,12 +363,12 @@ PHPAPI void php_set_session_var(char *name, size_t namelen, zval *state_val, php
{
if (PG(register_globals)) {
zval **old_symbol;
- if (zend_hash_find(&EG(symbol_table),name,namelen+1,(void *)&old_symbol) == SUCCESS) {
+ if (zend_hash_find(&EG(symbol_table),name,namelen+1,(void *)&old_symbol) == SUCCESS) {
if ((Z_TYPE_PP(old_symbol) == IS_ARRAY && Z_ARRVAL_PP(old_symbol) == &EG(symbol_table)) || *old_symbol == PS(http_session_vars)) {
return;
}
- /*
+ /*
* A global symbol with the same name exists already. That
* symbol might have been created by other means (e.g. $_GET).
*
@@ -380,12 +380,12 @@ PHPAPI void php_set_session_var(char *name, size_t namelen, zval *state_val, php
* session-vars won't work because of this very reason!
*/
-
+
REPLACE_ZVAL_VALUE(old_symbol,state_val,1);
/*
* The following line will update the reference table used for
- * unserialization. It is optional, because some storage
+ * unserialization. It is optional, because some storage
* formats may not be able to represent references.
*/
@@ -407,7 +407,7 @@ PHPAPI int php_get_session_var(char *name, size_t namelen, zval ***state_var TSR
int ret = FAILURE;
IF_SESSION_VARS() {
- ret = zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name,
+ ret = zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name,
namelen+1, (void **) state_var);
/*
@@ -417,8 +417,8 @@ PHPAPI int php_get_session_var(char *name, size_t namelen, zval ***state_var TSR
* if the global var exists, then
* we prefer the same key in the global sym table
*/
-
- if (PG(register_globals) && ret == SUCCESS
+
+ if (PG(register_globals) && ret == SUCCESS
&& Z_TYPE_PP(*state_var) == IS_NULL) {
zval **tmp;
@@ -428,7 +428,7 @@ PHPAPI int php_get_session_var(char *name, size_t namelen, zval ***state_var TSR
}
}
}
-
+
return ret;
}
@@ -448,14 +448,14 @@ PS_SERIALIZER_ENCODE_FUNC(php_binary)
if (key_length > PS_BIN_MAX) continue;
smart_str_appendc(&buf, (unsigned char) key_length);
smart_str_appendl(&buf, key, key_length);
-
+
php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
} else {
if (key_length > PS_BIN_MAX) continue;
smart_str_appendc(&buf, (unsigned char) (key_length & PS_BIN_UNDEF));
smart_str_appendl(&buf, key, key_length);
);
-
+
if (newlen) *newlen = buf.len;
*newstr = buf.c;
PHP_VAR_SERIALIZE_DESTROY(var_hash);
@@ -527,18 +527,18 @@ PS_SERIALIZER_ENCODE_FUNC(php)
smart_str_appendl(&buf, key, key_length);
if (memchr(key, PS_DELIMITER, key_length)) {
PHP_VAR_SERIALIZE_DESTROY(var_hash);
- smart_str_free(&buf);
+ smart_str_free(&buf);
return FAILURE;
}
smart_str_appendc(&buf, PS_DELIMITER);
-
+
php_var_serialize(&buf, struc, &var_hash TSRMLS_CC);
} else {
smart_str_appendc(&buf, PS_UNDEF_MARKER);
smart_str_appendl(&buf, key, key_length);
smart_str_appendc(&buf, PS_DELIMITER);
);
-
+
if (newlen) *newlen = buf.len;
*newstr = buf.c;
@@ -546,7 +546,7 @@ PS_SERIALIZER_ENCODE_FUNC(php)
return SUCCESS;
}
-PS_SERIALIZER_DECODE_FUNC(php)
+PS_SERIALIZER_DECODE_FUNC(php)
{
const char *p, *q;
char *name;
@@ -565,14 +565,14 @@ PS_SERIALIZER_DECODE_FUNC(php)
q = p;
while (*q != PS_DELIMITER)
if (++q >= endptr) goto break_outer_loop;
-
+
if (p[0] == PS_UNDEF_MARKER) {
p++;
has_value = 0;
} else {
has_value = 1;
}
-
+
namelen = q - p;
name = estrndup(p, namelen);
q++;
@@ -596,7 +596,7 @@ skip:
p = q;
}
break_outer_loop:
-
+
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return SUCCESS;
@@ -605,7 +605,7 @@ break_outer_loop:
static void php_session_track_init(TSRMLS_D)
{
zval *session_vars = NULL;
-
+
/* Unconditionally destroy existing arrays -- possible dirty data */
zend_delete_global_variable("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS")-1 TSRMLS_CC);
zend_delete_global_variable("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);
@@ -617,7 +617,7 @@ static void php_session_track_init(TSRMLS_D)
MAKE_STD_ZVAL(session_vars);
array_init(session_vars);
PS(http_session_vars) = session_vars;
-
+
if (PG(register_long_arrays)) {
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 3, 1);
ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 3, 1);
@@ -678,14 +678,14 @@ static char *bin_to_readable(char *in, size_t inlen, char *out, char nbits)
unsigned short w;
int mask;
int have;
-
+
p = (unsigned char *) in;
q = (unsigned char *)in + inlen;
w = 0;
have = 0;
mask = (1 << nbits) - 1;
-
+
while (1) {
if (have < nbits) {
if (p < q) {
@@ -704,7 +704,7 @@ static char *bin_to_readable(char *in, size_t inlen, char *out, char nbits)
w >>= nbits;
have -= nbits;
}
-
+
*out = '\0';
return out;
}
@@ -723,7 +723,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS)
char *remote_addr = NULL;
gettimeofday(&tv, NULL);
-
+
if (zend_hash_find(&EG(symbol_table), "_SERVER",
sizeof("_SERVER"), (void **) &array) == SUCCESS &&
Z_TYPE_PP(array) == IS_ARRAY &&
@@ -732,8 +732,8 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS)
remote_addr = Z_STRVAL_PP(token);
}
- /* maximum 15+19+19+10 bytes */
- spprintf(&buf, 0, "%.15s%ld%ld%0.8F", remote_addr ? remote_addr : "",
+ /* maximum 15+19+19+10 bytes */
+ spprintf(&buf, 0, "%.15s%ld%ld%0.8F", remote_addr ? remote_addr : "",
tv.tv_sec, (long int)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10);
switch (PS(hash_func)) {
@@ -761,11 +761,11 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS)
unsigned char rbuf[2048];
int n;
int to_read = PS(entropy_length);
-
+
while (to_read > 0) {
n = read(fd, rbuf, MIN(to_read, sizeof(rbuf)));
if (n <= 0) break;
-
+
switch (PS(hash_func)) {
case PS_HASH_FUNC_MD5:
PHP_MD5Update(&md5_context, rbuf, n);
@@ -796,8 +796,8 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ini setting hash_bits_per_character is out of range (should be 4, 5, or 6) - using 4 for now");
}
j = (int) (bin_to_readable((char *)digest, digest_len, buf, PS(hash_bits_per_character)) - buf);
-
- if (newlen)
+
+ if (newlen)
*newlen = j;
return buf;
}
@@ -823,7 +823,7 @@ static void php_session_initialize(TSRMLS_D)
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
return;
}
-
+
/* If there is no ID, use session module to create one */
if (!PS(id)) {
new_session:
@@ -832,7 +832,7 @@ new_session:
PS(send_cookie) = 1;
}
}
-
+
/* Read data */
/* Question: if you create a SID here, should you also try to read data?
* I'm not sure, but while not doing so will remove one session operation
@@ -860,15 +860,15 @@ static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
int n;
zval **val;
int ret = 0;
-
+
n = zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key, 0, pos);
switch (n) {
case HASH_KEY_IS_STRING:
- if (zend_hash_find(&EG(symbol_table), str, str_len,
- (void **) &val) == SUCCESS
+ if (zend_hash_find(&EG(symbol_table), str, str_len,
+ (void **) &val) == SUCCESS
&& val && Z_TYPE_PP(val) != IS_NULL) {
- ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, *val,
+ ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, *val,
(*val)->refcount + 1 , 1);
ret = 1;
}
@@ -879,14 +879,14 @@ static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
"numeric nature.", num_key);
break;
}
-
+
return ret;
}
static void php_session_save_current_state(TSRMLS_D)
{
int ret = FAILURE;
-
+
IF_SESSION_VARS() {
if (PS(bug_compat) && !PG(register_globals)) {
HashTable *ht = Z_ARRVAL_P(PS(http_session_vars));
@@ -896,7 +896,7 @@ static void php_session_save_current_state(TSRMLS_D)
zend_hash_internal_pointer_reset_ex(ht, &pos);
- while (zend_hash_get_current_data_ex(ht,
+ while (zend_hash_get_current_data_ex(ht,
(void **) &val, &pos) != FAILURE) {
if (Z_TYPE_PP(val) == IS_NULL) {
if (migrate_global(ht, &pos TSRMLS_CC))
@@ -930,7 +930,7 @@ static void php_session_save_current_state(TSRMLS_D)
PS(mod)->s_name,
PS(save_path));
}
-
+
if (PS(mod_data))
PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
}
@@ -949,18 +949,18 @@ static void strcpy_gmt(char *ubuf, time_t *when)
char buf[MAX_STR];
struct tm tm, *res;
int n;
-
+
res = php_gmtime_r(when, &tm);
if (!res) {
buf[0] = '\0';
return;
}
-
+
n = slprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
- week_days[tm.tm_wday], tm.tm_mday,
- month_names[tm.tm_mon], tm.tm_year + 1900,
- tm.tm_hour, tm.tm_min,
+ week_days[tm.tm_wday], tm.tm_mday,
+ month_names[tm.tm_mon], tm.tm_year + 1900,
+ tm.tm_hour, tm.tm_min,
tm.tm_sec);
memcpy(ubuf, buf, n);
ubuf[n] = '\0';
@@ -971,7 +971,7 @@ static void last_modified(TSRMLS_D)
const char *path;
struct stat sb;
char buf[MAX_STR + 1];
-
+
path = SG(request_info).path_translated;
if (path) {
if (VCWD_STAT(path, &sb) == -1) {
@@ -994,24 +994,24 @@ CACHE_LIMITER_FUNC(public)
char buf[MAX_STR + 1];
struct timeval tv;
time_t now;
-
+
gettimeofday(&tv, NULL);
now = tv.tv_sec + PS(cache_expire) * 60;
#define EXPIRES "Expires: "
memcpy(buf, EXPIRES, sizeof(EXPIRES) - 1);
strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now);
ADD_HEADER(buf);
-
+
snprintf(buf, sizeof(buf) , "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); /* SAFE */
ADD_HEADER(buf);
-
+
last_modified(TSRMLS_C);
}
CACHE_LIMITER_FUNC(private_no_expire)
{
char buf[MAX_STR + 1];
-
+
snprintf(buf, sizeof(buf), "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */
ADD_HEADER(buf);
@@ -1046,7 +1046,7 @@ static int php_session_cache_limiter(TSRMLS_D)
php_session_cache_limiter_t *lim;
if (PS(cache_limiter)[0] == '\0') return 0;
-
+
if (SG(headers_sent)) {
char *output_start_filename = php_get_output_start_filename(TSRMLS_C);
int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);
@@ -1056,10 +1056,10 @@ static int php_session_cache_limiter(TSRMLS_D)
output_start_filename, output_start_lineno);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cache limiter - headers already sent");
- }
+ }
return -2;
}
-
+
for (lim = php_session_cache_limiters; lim->name; lim++) {
if (!strcasecmp(lim->name, PS(cache_limiter))) {
lim->func(TSRMLS_C);
@@ -1092,10 +1092,10 @@ static void php_session_send_cookie(TSRMLS_D)
output_start_filename, output_start_lineno);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot send session cookie - headers already sent");
- }
+ }
return;
}
-
+
/* URL encode session_name and id because they might be user supplied */
e_session_name = php_url_encode(PS(session_name), strlen(PS(session_name)), NULL);
e_id = php_url_encode(PS(id), strlen(PS(id)), NULL);
@@ -1104,17 +1104,17 @@ static void php_session_send_cookie(TSRMLS_D)
smart_str_appends(&ncookie, e_session_name);
smart_str_appendc(&ncookie, '=');
smart_str_appends(&ncookie, e_id);
-
+
efree(e_session_name);
efree(e_id);
-
+
if (PS(cookie_lifetime) > 0) {
struct timeval tv;
time_t t;
-
+
gettimeofday(&tv, NULL);
t = tv.tv_sec + PS(cookie_lifetime);
-
+
if (t > 0) {
date_fmt = php_std_date(t TSRMLS_CC);
smart_str_appends(&ncookie, COOKIE_EXPIRES);
@@ -1127,7 +1127,7 @@ static void php_session_send_cookie(TSRMLS_D)
smart_str_appends(&ncookie, COOKIE_PATH);
smart_str_appends(&ncookie, PS(cookie_path));
}
-
+
if (PS(cookie_domain)[0]) {
smart_str_appends(&ncookie, COOKIE_DOMAIN);
smart_str_appends(&ncookie, PS(cookie_domain));
@@ -1142,7 +1142,7 @@ static void php_session_send_cookie(TSRMLS_D)
}
smart_str_0(&ncookie);
-
+
/* 'replace' must be 0 here, else a previous Set-Cookie
header, probably sent with setcookie() will be replaced! */
sapi_add_header_ex(ncookie.c, ncookie.len, 0, 0 TSRMLS_CC);
@@ -1159,7 +1159,7 @@ PHPAPI ps_module *_php_find_ps_module(char *name TSRMLS_DC)
ret = *mod;
break;
}
-
+
return ret;
}
@@ -1184,7 +1184,7 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC)
static void php_session_reset_id(TSRMLS_D)
{
int module_number = PS(module_number);
-
+
if (PS(use_cookies) && PS(send_cookie)) {
php_session_send_cookie(TSRMLS_C);
PS(send_cookie) = 0;
@@ -1192,7 +1192,7 @@ static void php_session_reset_id(TSRMLS_D)
/* if the SID constant exists, destroy it. */
zend_hash_del(EG(zend_constants), "sid", sizeof("sid"));
-
+
if (PS(define_sid)) {
smart_str var = {0};
@@ -1210,7 +1210,7 @@ static void php_session_reset_id(TSRMLS_D)
php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), PS(id), strlen(PS(id)), 1 TSRMLS_CC);
}
}
-
+
PHPAPI void php_session_start(TSRMLS_D)
{
zval **ppid;
@@ -1226,8 +1226,8 @@ PHPAPI void php_session_start(TSRMLS_D)
char *value;
value = zend_ini_string("session.save_handler", sizeof("session.save_handler"), 0);
-
- if (value) {
+
+ if (value) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot find save handler %s", value);
}
else {
@@ -1235,7 +1235,7 @@ PHPAPI void php_session_start(TSRMLS_D)
}
return;
}
-
+
php_error(E_NOTICE, "A session had already been started - ignoring session_start()");
return;
} else {
@@ -1244,11 +1244,11 @@ PHPAPI void php_session_start(TSRMLS_D)
}
lensess = strlen(PS(session_name));
-
+
/*
* Cookies are preferred, because initially
- * cookie and get variables will be available.
+ * cookie and get variables will be available.
*/
if (!PS(id)) {
@@ -1306,7 +1306,7 @@ PHPAPI void php_session_start(TSRMLS_D)
/* check whether the current request was referred to by
an external site which invalidates the previously found id */
-
+
if (PS(id) &&
PS(extern_referer_chk)[0] != '\0' &&
PG(http_globals)[TRACK_VARS_SERVER] &&
@@ -1321,9 +1321,9 @@ PHPAPI void php_session_start(TSRMLS_D)
if (PS(use_trans_sid))
PS(apply_trans_sid) = 1;
}
-
+
php_session_initialize(TSRMLS_C);
-
+
if (!PS(use_cookies) && PS(send_cookie)) {
if (PS(use_trans_sid))
PS(apply_trans_sid) = 1;
@@ -1331,7 +1331,7 @@ PHPAPI void php_session_start(TSRMLS_D)
}
php_session_reset_id(TSRMLS_C);
-
+
PS(session_status) = php_session_active;
php_session_cache_limiter(TSRMLS_C);
@@ -1363,7 +1363,7 @@ static int php_session_destroy(TSRMLS_D)
retval = FAILURE;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session object destruction failed");
}
-
+
php_rshutdown_session_globals(TSRMLS_C);
php_rinit_session_globals(TSRMLS_C);
@@ -1408,7 +1408,7 @@ PHP_FUNCTION(session_set_cookie_params)
/* }}} */
/* {{{ proto array session_get_cookie_params(void)
- Return the session cookie parameters */
+ Return the session cookie parameters */
PHP_FUNCTION(session_get_cookie_params)
{
if (ZEND_NUM_ARGS() != 0) {
@@ -1435,14 +1435,14 @@ PHP_FUNCTION(session_name)
if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
WRONG_PARAM_COUNT;
-
+
old = estrdup(PS(session_name));
if (ac == 1) {
convert_to_string_ex(p_name);
zend_alter_ini_entry("session.name", sizeof("session.name"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
}
-
+
RETVAL_STRING(old, 0);
}
/* }}} */
@@ -1464,7 +1464,7 @@ PHP_FUNCTION(session_module_name)
} else {
RETVAL_EMPTY_STRING();
}
-
+
if (ac == 1) {
convert_to_string_ex(p_name);
if (!_php_find_ps_module(Z_STRVAL_PP(p_name) TSRMLS_CC)) {
@@ -1494,10 +1494,10 @@ PHP_FUNCTION(session_set_save_handler)
if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_array_ex(6, args) == FAILURE)
WRONG_PARAM_COUNT;
-
- if (PS(session_status) != php_session_none)
+
+ if (PS(session_status) != php_session_none)
RETURN_FALSE;
-
+
for (i = 0; i < 6; i++) {
if (!zend_is_callable(*args[i], 0, &name)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument %d is not a valid callback", i+1);
@@ -1506,18 +1506,18 @@ PHP_FUNCTION(session_set_save_handler)
}
efree(name);
}
-
+
zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
mdata = emalloc(sizeof(*mdata));
-
+
for (i = 0; i < 6; i++) {
ZVAL_ADDREF(*args[i]);
mdata->names[i] = *args[i];
}
PS(mod_data) = (void *) mdata;
-
+
RETURN_TRUE;
}
/* }}} */
@@ -1532,14 +1532,14 @@ PHP_FUNCTION(session_save_path)
if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
WRONG_PARAM_COUNT;
-
+
old = estrdup(PS(save_path));
if (ac == 1) {
convert_to_string_ex(p_name);
zend_alter_ini_entry("session.save_path", sizeof("session.save_path"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
}
-
+
RETVAL_STRING(old, 0);
}
/* }}} */
@@ -1566,7 +1566,7 @@ PHP_FUNCTION(session_id)
if (PS(id)) efree(PS(id));
PS(id) = estrndup(Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name));
}
-
+
RETVAL_STRING(old, 0);
}
/* }}} */
@@ -1595,12 +1595,12 @@ PHP_FUNCTION(session_regenerate_id)
efree(PS(id));
PS(id) = NULL;
}
-
+
PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC);
PS(send_cookie) = 1;
php_session_reset_id(TSRMLS_C);
-
+
RETURN_TRUE;
}
RETURN_FALSE;
@@ -1617,14 +1617,14 @@ PHP_FUNCTION(session_cache_limiter)
if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_cache_limiter) == FAILURE)
WRONG_PARAM_COUNT;
-
+
old = estrdup(PS(cache_limiter));
if (ac == 1) {
convert_to_string_ex(p_cache_limiter);
zend_alter_ini_entry("session.cache_limiter", sizeof("session.cache_limiter"), Z_STRVAL_PP(p_cache_limiter), Z_STRLEN_PP(p_cache_limiter), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
}
-
+
RETVAL_STRING(old, 0);
}
/* }}} */
@@ -1655,14 +1655,21 @@ PHP_FUNCTION(session_cache_expire)
static void php_register_var(zval** entry TSRMLS_DC)
{
zval **value;
-
+
if (Z_TYPE_PP(entry) == IS_ARRAY) {
+ if (Z_ARRVAL_PP(entry)->nApplyCount > 1) {
+ return;
+ }
+
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(entry));
+ Z_ARRVAL_PP(entry)->nApplyCount++;
while (zend_hash_get_current_data(Z_ARRVAL_PP(entry), (void**)&value) == SUCCESS) {
php_register_var(value TSRMLS_CC);
zend_hash_move_forward(Z_ARRVAL_PP(entry));
}
+
+ Z_ARRVAL_PP(entry)->nApplyCount--;
} else {
convert_to_string_ex(entry);
@@ -1686,7 +1693,7 @@ PHP_FUNCTION(session_register)
RETURN_FALSE
else
args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
-
+
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
@@ -1695,20 +1702,20 @@ PHP_FUNCTION(session_register)
if (PS(session_status) == php_session_none || PS(session_status) == php_session_disabled) {
php_session_start(TSRMLS_C);
}
-
+
if (PS(session_status) == php_session_disabled) {
efree(args);
RETURN_FALSE;
}
-
+
for (i = 0; i < argc; i++) {
if (Z_TYPE_PP(args[i]) == IS_ARRAY)
SEPARATE_ZVAL(args[i]);
php_register_var(args[i] TSRMLS_CC);
- }
-
+ }
+
efree(args);
-
+
RETURN_TRUE;
}
/* }}} */
@@ -1722,9 +1729,9 @@ PHP_FUNCTION(session_unregister)
if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
WRONG_PARAM_COUNT;
-
+
convert_to_string_ex(p_name);
-
+
PS_DEL_VARL(Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name));
RETURN_TRUE;
@@ -1741,15 +1748,15 @@ PHP_FUNCTION(session_is_registered)
if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
WRONG_PARAM_COUNT;
-
+
convert_to_string_ex(p_name);
-
+
if (PS(session_status) == php_session_none)
RETURN_FALSE;
IF_SESSION_VARS() {
- if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)),
- Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name)+1,
+ if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)),
+ Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name)+1,
(void **)&p_var) == SUCCESS) {
RETURN_TRUE;
}
@@ -1773,7 +1780,7 @@ PHP_FUNCTION(session_encode)
if (enc == NULL) {
RETURN_FALSE;
}
-
+
RETVAL_STRINGL(enc, len, 0);
}
/* }}} */
@@ -1795,7 +1802,7 @@ PHP_FUNCTION(session_decode)
convert_to_string_ex(str);
php_session_decode(Z_STRVAL_PP(str), Z_STRLEN_PP(str) TSRMLS_CC);
-
+
RETURN_TRUE;
}
/* }}} */
@@ -1842,16 +1849,16 @@ PHP_FUNCTION(session_unset)
char *str;
ulong num_key;
HashPosition pos;
-
+
zend_hash_internal_pointer_reset_ex(ht, &pos);
- while (zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key,
+ while (zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key,
0, &pos) == HASH_KEY_IS_STRING) {
zend_delete_global_variable(str, str_len-1 TSRMLS_CC);
zend_hash_move_forward_ex(ht, &pos);
}
}
-
+
/* Clean $_SESSION. */
zend_hash_clean(ht);
}
@@ -1866,7 +1873,7 @@ PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t
}
static void php_rinit_session_globals(TSRMLS_D)
-{
+{
PS(id) = NULL;
PS(session_status) = php_session_none;
PS(mod_data) = NULL;
@@ -1990,7 +1997,7 @@ PHP_MINFO_FUNCTION(session)
smart_str save_handlers = {0};
smart_str ser_handlers = {0};
int i;
-
+
/* Get save handlers */
for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++) {
if (*mod && (*mod)->s_name) {
@@ -2006,7 +2013,7 @@ PHP_MINFO_FUNCTION(session)
smart_str_appendc(&ser_handlers, ' ');
}
}
-
+
php_info_print_table_start();
php_info_print_table_row(2, "Session Support", "enabled" );
diff --git a/ext/session/tests/023.phpt b/ext/session/tests/023.phpt
new file mode 100644
index 000000000..42b1e5b1b
--- /dev/null
+++ b/ext/session/tests/023.phpt
@@ -0,0 +1,46 @@
+--TEST--
+session object deserialization
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+class foo {
+ public $bar = "ok";
+ function method() { $this->yes++; }
+}
+
+session_id("abtest");
+session_start();
+session_decode('baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}');
+$baz = $_SESSION['baz'];
+$arr = $_SESSION['arr'];
+
+$baz->method();
+$arr[3]->method();
+
+var_dump($baz);
+var_dump($arr);
+session_destroy();
+--EXPECT--
+object(foo)#1 (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+}
+array(1) {
+ [3]=>
+ object(foo)#2 (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+ }
+}
diff --git a/ext/session/tests/024.phpt b/ext/session/tests/024.phpt
new file mode 100644
index 000000000..2ad26067a
--- /dev/null
+++ b/ext/session/tests/024.phpt
@@ -0,0 +1,114 @@
+--TEST--
+session_set_save_handler test
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+session.name=PHPSESSID
+session.serialize_handler=php
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+class handler {
+ public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
+
+ function open($save_path, $session_name)
+ {
+ print "OPEN: $session_name\n";
+ return true;
+ }
+ function close()
+ {
+ return true;
+ }
+ function read($key)
+ {
+ print "READ: $key\n";
+ return $GLOBALS["hnd"]->data;
+ }
+
+ function write($key, $val)
+ {
+ print "WRITE: $key, $val\n";
+ $GLOBALS["hnd"]->data = $val;
+ return true;
+ }
+
+ function destroy($key)
+ {
+ print "DESTROY: $key\n";
+ return true;
+ }
+
+ function gc() { return true; }
+}
+
+$hnd = new handler;
+
+class foo {
+ public $bar = "ok";
+ function method() { $this->yes++; }
+}
+
+session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
+
+session_id("abtest");
+session_start();
+
+$baz = $_SESSION['baz'];
+$arr = $_SESSION['arr'];
+$baz->method();
+$arr[3]->method();
+
+var_dump($baz);
+var_dump($arr);
+
+session_write_close();
+
+session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
+session_start();
+
+var_dump($baz);
+var_dump($arr);
+
+session_destroy();
+?>
+--EXPECTF--
+OPEN: PHPSESSID
+READ: abtest
+object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+}
+array(1) {
+ [3]=>
+ object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+ }
+}
+WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
+OPEN: PHPSESSID
+READ: abtest
+object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+}
+array(1) {
+ [3]=>
+ object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+ }
+}
+DESTROY: abtest
diff --git a/ext/session/tests/025.phpt b/ext/session/tests/025.phpt
new file mode 100644
index 000000000..4fd095f81
--- /dev/null
+++ b/ext/session/tests/025.phpt
@@ -0,0 +1,159 @@
+--TEST--
+custom save handler, multiple session_start()s, complex data structure test.
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+session.name=PHPSESSID
+session.serialize_handler=php
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+class handler {
+ public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
+
+ function open($save_path, $session_name)
+ {
+ print "OPEN: $session_name\n";
+ return true;
+ }
+ function close()
+ {
+ print "CLOSE\n";
+ return true;
+ }
+ function read($key)
+ {
+ print "READ: $key\n";
+ return $GLOBALS["hnd"]->data;
+ }
+
+ function write($key, $val)
+ {
+ print "WRITE: $key, $val\n";
+ $GLOBALS["hnd"]->data = $val;
+ return true;
+ }
+
+ function destroy($key)
+ {
+ print "DESTROY: $key\n";
+ return true;
+ }
+
+ function gc() { return true; }
+
+ function __construct()
+ {
+ if (ini_get("unicode.semantics")) {
+ $this->data = str_replace('s:', 'U:', $this->data);
+ }
+ }
+}
+
+$hnd = new handler;
+
+class foo {
+ public $bar = "ok";
+ function method() { $this->yes++; }
+}
+
+session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
+
+session_id("abtest");
+session_start();
+$baz = $_SESSION['baz'];
+$arr = $_SESSION['arr'];
+$baz->method();
+$arr[3]->method();
+
+var_dump($baz);
+var_dump($arr);
+
+session_write_close();
+
+session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
+session_start();
+$baz = $_SESSION['baz'];
+$arr = $_SESSION['arr'];
+
+
+$baz->method();
+$arr[3]->method();
+
+
+$c = 123;
+$_SESSION['c'] = $c;
+var_dump($baz); var_dump($arr); var_dump($c);
+
+session_write_close();
+
+session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
+session_start();
+var_dump($baz); var_dump($arr); var_dump($c);
+
+session_destroy();
+?>
+--EXPECTF--
+OPEN: PHPSESSID
+READ: abtest
+object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+}
+array(1) {
+ [3]=>
+ object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(2)
+ }
+}
+WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
+CLOSE
+OPEN: PHPSESSID
+READ: abtest
+object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(3)
+}
+array(1) {
+ [3]=>
+ object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(3)
+ }
+}
+int(123)
+WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}}c|i:123;
+CLOSE
+OPEN: PHPSESSID
+READ: abtest
+object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(3)
+}
+array(1) {
+ [3]=>
+ object(foo)#%d (2) {
+ ["bar"]=>
+ string(2) "ok"
+ ["yes"]=>
+ int(3)
+ }
+}
+int(123)
+DESTROY: abtest
+CLOSE
diff --git a/ext/session/tests/026.phpt b/ext/session/tests/026.phpt
new file mode 100644
index 000000000..06c135d04
--- /dev/null
+++ b/ext/session/tests/026.phpt
@@ -0,0 +1,71 @@
+--TEST--
+correct instantiation of references between variables in sessions
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+session_id("abtest");
+session_start();
+
+class a {
+ public $test = "hallo";
+}
+
+class b {
+ public $a;
+ function b(&$a) {
+ $this->a = &$a;
+ }
+}
+
+$a = new a();
+$b = new b($a);
+
+echo "original values:\n";
+var_dump($a,$b);
+
+$_SESSION['a'] = $a;
+$_SESSION['b'] = $b;
+
+session_write_close();
+unset($_SESSION['a']);
+unset($_SESSION['b']);
+
+session_start();
+$a = $_SESSION['a'];
+$b = $_SESSION['b'];
+echo "values after session:\n";
+var_dump($a,$b);
+?>
+--EXPECTF--
+original values:
+object(a)#%d (1) {
+ ["test"]=>
+ string(5) "hallo"
+}
+object(b)#%d (1) {
+ ["a"]=>
+ &object(a)#%d (1) {
+ ["test"]=>
+ string(5) "hallo"
+ }
+}
+values after session:
+object(a)#%d (1) {
+ ["test"]=>
+ string(5) "hallo"
+}
+object(b)#%d (1) {
+ ["a"]=>
+ &object(a)#%d (1) {
+ ["test"]=>
+ string(5) "hallo"
+ }
+}
diff --git a/ext/session/tests/027.phpt b/ext/session/tests/027.phpt
new file mode 100644
index 000000000..600a992f7
--- /dev/null
+++ b/ext/session/tests/027.phpt
@@ -0,0 +1,55 @@
+--TEST--
+unset($_SESSION["name"]); should work
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+session_id("abtest");
+
+### Phase 1 cleanup
+session_start();
+session_destroy();
+
+### Phase 2 $_SESSION["c"] does not contain any value
+session_id("abtest");
+session_start();
+var_dump($_SESSION);
+$_SESSION["name"] = "foo";
+var_dump($_SESSION);
+session_write_close();
+
+### Phase 3 $_SESSION["c"] is set
+session_start();
+var_dump($_SESSION);
+unset($_SESSION["name"]);
+var_dump($_SESSION);
+session_write_close();
+
+### Phase 4 final
+
+session_start();
+var_dump($_SESSION);
+session_destroy();
+?>
+--EXPECT--
+array(0) {
+}
+array(1) {
+ ["name"]=>
+ string(3) "foo"
+}
+array(1) {
+ ["name"]=>
+ string(3) "foo"
+}
+array(0) {
+}
+array(0) {
+}
diff --git a/ext/session/tests/028.phpt b/ext/session/tests/028.phpt
new file mode 100644
index 000000000..79638d283
--- /dev/null
+++ b/ext/session/tests/028.phpt
@@ -0,0 +1,16 @@
+--TEST--
+$session_array = explode(";", session_encode()); should not segfault
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+$session_array = explode(";", @session_encode());
+print "I live\n";
+?>
+--EXPECT--
+I live
diff --git a/ext/session/tests/029.phpt b/ext/session/tests/029.phpt
new file mode 100644
index 000000000..ff1adbaec
--- /dev/null
+++ b/ext/session/tests/029.phpt
@@ -0,0 +1,17 @@
+--TEST--
+session_decode(); should not segfault
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+@session_decode("garbage data and no session started");
+@session_decode("userid|s:5:\"mazen\";chatRoom|s:1:\"1\";");
+print "I live\n";
+?>
+--EXPECT--
+I live
diff --git a/ext/session/tests/030.phpt b/ext/session/tests/030.phpt
new file mode 100644
index 000000000..8d0f284b1
--- /dev/null
+++ b/ext/session/tests/030.phpt
@@ -0,0 +1,24 @@
+--TEST--
+redefining SID should not cause warnings
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.use_cookies=0
+session.cache_limiter=
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+error_reporting(E_ALL);
+
+session_id("abtest");
+session_start();
+session_destroy();
+session_id("abtest2");
+session_start();
+session_destroy();
+
+print "I live\n";
+?>
+--EXPECT--
+I live
diff --git a/ext/session/tests/save_handler.inc b/ext/session/tests/save_handler.inc
new file mode 100644
index 000000000..ebe9cac56
--- /dev/null
+++ b/ext/session/tests/save_handler.inc
@@ -0,0 +1,63 @@
+<?php
+
+DEFINE("SESSION_FILE_PREFIX" ,"session_test_");
+function open($save_path, $session_name) {
+ global $session_save_path, $name;
+ $session_save_path = $save_path;
+ $name = $session_name;
+ echo "Open [${session_save_path},${session_name}]\n";
+ return true;
+}
+
+function close() {
+ global $session_save_path, $name;
+ echo "Close [${session_save_path},${name}]\n";
+ return true;
+}
+
+function read($id) {
+ global $session_save_path, $name, $session_id;
+ $session_id = $id;
+ echo "Read [${session_save_path},${id}]\n";
+ $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ return (string) @file_get_contents($session_file);
+}
+
+function write($id, $session_data) {
+ global $session_save_path, $name, $session_id;
+ $session_id = $id;
+ echo "Write [${session_save_path},${id},${session_data}]\n";
+ $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ if ($fp = fopen($session_file, "w")) {
+ $return = fwrite($fp, $session_data);
+ fclose($fp);
+ return $return;
+ }
+ return false;
+}
+
+function destroy($id) {
+ global $session_save_path, $name;
+ echo "Destroy [${session_save_path},${id}]\n";
+ $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ return unlink($session_file);
+}
+
+function gc($maxlifetime) {
+ global $session_save_path, $name;
+ $directory = opendir($session_save_path."/");
+ $length = strlen(SESSION_FILE_PREFIX);
+ while (($file = readdir($directory)) !== FALSE) {
+ $qualified = ($session_save_path."/".$file);
+ if (is_file($qualified) === TRUE) {
+ if (substr($file, 0, $length) === SESSION_FILE_PREFIX) {
+ unlink($qualified);
+ }
+ }
+ }
+ closedir($directory);
+ return true;
+}
+
+?>
+
diff --git a/ext/session/tests/session_cache_expire_basic.phpt b/ext/session/tests/session_cache_expire_basic.phpt
new file mode 100644
index 000000000..716648593
--- /dev/null
+++ b/ext/session/tests/session_cache_expire_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test session_cache_expire() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : int session_cache_expire([int $new_cache_expire])
+ * Description : Return current cache expire
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_expire() : basic functionality ***\n";
+
+var_dump(session_cache_expire());
+var_dump(session_cache_expire(1234567890));
+var_dump(session_cache_expire(180));
+var_dump(session_start());
+var_dump(session_cache_expire());
+var_dump(session_destroy());
+var_dump(session_cache_expire());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_expire() : basic functionality ***
+int(180)
+int(180)
+int(1234567890)
+bool(true)
+int(180)
+bool(true)
+int(180)
+Done
+
diff --git a/ext/session/tests/session_cache_expire_error.phpt b/ext/session/tests/session_cache_expire_error.phpt
new file mode 100644
index 000000000..486ba787e
--- /dev/null
+++ b/ext/session/tests/session_cache_expire_error.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test session_cache_expire() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : int session_cache_expire([int $new_cache_expire])
+ * Description : Return current cache expire
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_expire() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_cache_expire($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_expire() : error functionality ***
+
+-- Iteration 1 --
+int(180)
+
+-- Iteration 2 --
+int(0)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(12345)
+
+-- Iteration 5 --
+int(-2345)
+
+-- Iteration 6 --
+int(10)
+
+-- Iteration 7 --
+int(-10)
+
+-- Iteration 8 --
+int(%s)
+
+-- Iteration 9 --
+int(1)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(1)
+
+-- 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)
+Done
+
diff --git a/ext/session/tests/session_cache_expire_variation1.phpt b/ext/session/tests/session_cache_expire_variation1.phpt
new file mode 100644
index 000000000..9d0ba27fe
--- /dev/null
+++ b/ext/session/tests/session_cache_expire_variation1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test session_cache_expire() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.cache_expire=360
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : int session_cache_expire([int $new_cache_expire])
+ * Description : Return current cache expire
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_expire() : variation ***\n";
+
+var_dump(session_cache_expire());
+var_dump(session_cache_expire(1234567890));
+var_dump(session_cache_expire(180));
+var_dump(session_start());
+var_dump(session_cache_expire());
+var_dump(session_destroy());
+var_dump(session_cache_expire());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_expire() : variation ***
+int(360)
+int(360)
+int(1234567890)
+bool(true)
+int(180)
+bool(true)
+int(180)
+Done
+
diff --git a/ext/session/tests/session_cache_expire_variation2.phpt b/ext/session/tests/session_cache_expire_variation2.phpt
new file mode 100644
index 000000000..f17f4711a
--- /dev/null
+++ b/ext/session/tests/session_cache_expire_variation2.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test session_cache_expire() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : int session_cache_expire([int $new_cache_expire])
+ * Description : Return current cache expire
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_expire() : variation ***\n";
+
+ini_set("session.cache_expire", 360);
+var_dump(session_cache_expire());
+var_dump(session_cache_expire(1234567890));
+var_dump(session_cache_expire(180));
+var_dump(session_start());
+var_dump(session_cache_expire());
+var_dump(session_destroy());
+var_dump(session_cache_expire());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_expire() : variation ***
+int(360)
+int(360)
+int(1234567890)
+bool(true)
+int(180)
+bool(true)
+int(180)
+Done
+
+
diff --git a/ext/session/tests/session_cache_expire_variation3.phpt b/ext/session/tests/session_cache_expire_variation3.phpt
new file mode 100644
index 000000000..c243c1f11
--- /dev/null
+++ b/ext/session/tests/session_cache_expire_variation3.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test session_cache_expire() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : int session_cache_expire([int $new_cache_expire])
+ * Description : Return current cache expire
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_expire() : variation ***\n";
+
+var_dump(ini_get("session.cache_expire"));
+var_dump(session_cache_expire());
+var_dump(ini_get("session.cache_expire"));
+var_dump(session_cache_expire(1234567890));
+var_dump(ini_get("session.cache_expire"));
+var_dump(session_start());
+var_dump(session_cache_expire());
+var_dump(ini_get("session.cache_expire"));
+var_dump(session_destroy());
+var_dump(session_cache_expire());
+var_dump(ini_get("session.cache_expire"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_expire() : variation ***
+string(3) "180"
+int(180)
+string(3) "180"
+int(180)
+string(10) "1234567890"
+bool(true)
+int(1234567890)
+string(10) "1234567890"
+bool(true)
+int(1234567890)
+string(10) "1234567890"
+Done
+
diff --git a/ext/session/tests/session_cache_limiter_basic.phpt b/ext/session/tests/session_cache_limiter_basic.phpt
new file mode 100644
index 000000000..d0531878f
--- /dev/null
+++ b/ext/session/tests/session_cache_limiter_basic.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test session_cache_limiter() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_cache_limiter([string $cache_limiter])
+ * Description : Get and/or set the current cache limiter
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_limiter() : basic functionality ***\n";
+
+var_dump(session_start());
+var_dump(session_cache_limiter());
+var_dump(session_cache_limiter("public"));
+var_dump(session_cache_limiter());
+var_dump(session_destroy());
+
+var_dump(session_start());
+var_dump(session_cache_limiter());
+var_dump(session_cache_limiter("private"));
+var_dump(session_cache_limiter());
+var_dump(session_destroy());
+
+var_dump(session_start());
+var_dump(session_cache_limiter());
+var_dump(session_cache_limiter("nocache"));
+var_dump(session_cache_limiter());
+var_dump(session_destroy());
+
+var_dump(session_start());
+var_dump(session_cache_limiter());
+var_dump(session_cache_limiter("private_no_expire"));
+var_dump(session_cache_limiter());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_limiter() : basic functionality ***
+bool(true)
+string(7) "nocache"
+string(7) "nocache"
+string(6) "public"
+bool(true)
+bool(true)
+string(6) "public"
+string(6) "public"
+string(7) "private"
+bool(true)
+bool(true)
+string(7) "private"
+string(7) "private"
+string(7) "nocache"
+bool(true)
+bool(true)
+string(7) "nocache"
+string(7) "nocache"
+string(17) "private_no_expire"
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_cache_limiter_error.phpt b/ext/session/tests/session_cache_limiter_error.phpt
new file mode 100644
index 000000000..98bbbac6d
--- /dev/null
+++ b/ext/session/tests/session_cache_limiter_error.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test session_cache_limiter() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_cache_limiter([string $cache_limiter])
+ * Description : Get and/or set the current cache limiter
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_limiter() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_cache_limiter($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_limiter() : error functionality ***
+
+-- Iteration 1 --
+string(7) "nocache"
+
+-- Iteration 2 --
+string(1) "0"
+
+-- Iteration 3 --
+string(1) "1"
+
+-- Iteration 4 --
+string(5) "12345"
+
+-- Iteration 5 --
+string(5) "-2345"
+
+-- Iteration 6 --
+string(4) "10.5"
+
+-- Iteration 7 --
+string(5) "-10.5"
+
+-- Iteration 8 --
+string(12) "123456789000"
+
+-- Iteration 9 --
+string(13) "1.23456789E-9"
+
+-- Iteration 10 --
+string(3) "0.5"
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(0) ""
+
+-- Iteration 13 --
+string(1) "1"
+
+-- Iteration 14 --
+string(0) ""
+
+-- Iteration 15 --
+string(1) "1"
+
+-- Iteration 16 --
+string(0) ""
+
+-- Iteration 17 --
+string(0) ""
+
+-- Iteration 18 --
+string(0) ""
+
+-- Iteration 19 --
+string(7) "Nothing"
+
+-- Iteration 20 --
+string(7) "Nothing"
+
+-- Iteration 21 --
+string(12) "Hello World!"
+
+-- Iteration 22 --
+string(12) "Hello World!"
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_cache_limiter_variation1.phpt b/ext/session/tests/session_cache_limiter_variation1.phpt
new file mode 100644
index 000000000..7c6e71eb8
--- /dev/null
+++ b/ext/session/tests/session_cache_limiter_variation1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test session_cache_limiter() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.cache_limiter=nocache
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_cache_limiter([string $cache_limiter])
+ * Description : Get and/or set the current cache limiter
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_limiter() : variation ***\n";
+
+var_dump(session_cache_limiter());
+var_dump(session_start());
+var_dump(session_cache_limiter());
+var_dump(session_cache_limiter("public"));
+var_dump(session_cache_limiter());
+var_dump(session_destroy());
+var_dump(session_cache_limiter());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_limiter() : variation ***
+string(7) "nocache"
+bool(true)
+string(7) "nocache"
+string(7) "nocache"
+string(6) "public"
+bool(true)
+string(6) "public"
+Done
+
diff --git a/ext/session/tests/session_cache_limiter_variation2.phpt b/ext/session/tests/session_cache_limiter_variation2.phpt
new file mode 100644
index 000000000..b6d97a3dd
--- /dev/null
+++ b/ext/session/tests/session_cache_limiter_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test session_cache_limiter() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_cache_limiter([string $cache_limiter])
+ * Description : Get and/or set the current cache limiter
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_limiter() : variation ***\n";
+
+ini_set("session.cache_limiter", "nocache");
+var_dump(session_cache_limiter());
+var_dump(session_start());
+var_dump(session_cache_limiter());
+var_dump(session_cache_limiter("public"));
+var_dump(session_cache_limiter());
+var_dump(session_destroy());
+var_dump(session_cache_limiter());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_limiter() : variation ***
+string(7) "nocache"
+bool(true)
+string(7) "nocache"
+string(7) "nocache"
+string(6) "public"
+bool(true)
+string(6) "public"
+Done
+
diff --git a/ext/session/tests/session_cache_limiter_variation3.phpt b/ext/session/tests/session_cache_limiter_variation3.phpt
new file mode 100644
index 000000000..7aab95b24
--- /dev/null
+++ b/ext/session/tests/session_cache_limiter_variation3.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test session_cache_limiter() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_cache_limiter([string $cache_limiter])
+ * Description : Get and/or set the current cache limiter
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_cache_limiter() : variation ***\n";
+
+var_dump(ini_get("session.cache_limiter"));
+var_dump(session_start());
+var_dump(ini_get("session.cache_limiter"));
+var_dump(session_cache_limiter("public"));
+var_dump(ini_get("session.cache_limiter"));
+var_dump(session_destroy());
+var_dump(ini_get("session.cache_limiter"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_cache_limiter() : variation ***
+string(7) "nocache"
+bool(true)
+string(7) "nocache"
+string(7) "nocache"
+string(6) "public"
+bool(true)
+string(6) "public"
+Done
+
diff --git a/ext/session/tests/session_commit_basic.phpt b/ext/session/tests/session_commit_basic.phpt
new file mode 100644
index 000000000..c20db1093
--- /dev/null
+++ b/ext/session/tests/session_commit_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test session_commit() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_commit(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_commit() : basic functionality ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_commit());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_commit() : basic functionality ***
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+array(0) {
+}
+bool(true)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_commit_error.phpt b/ext/session/tests/session_commit_error.phpt
new file mode 100644
index 000000000..b867572eb
--- /dev/null
+++ b/ext/session/tests/session_commit_error.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test session_commit() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_commit(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_commit() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_commit($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_commit() : error functionality ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+NULL
+
+-- Iteration 18 --
+NULL
+
+-- Iteration 19 --
+NULL
+
+-- Iteration 20 --
+NULL
+
+-- Iteration 21 --
+NULL
+
+-- Iteration 22 --
+NULL
+
+-- Iteration 23 --
+NULL
+
+-- Iteration 24 --
+NULL
+Done
+
diff --git a/ext/session/tests/session_commit_variation1.phpt b/ext/session/tests/session_commit_variation1.phpt
new file mode 100644
index 000000000..81240dac8
--- /dev/null
+++ b/ext/session/tests/session_commit_variation1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test session_commit() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_commit(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_commit() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_commit());
+var_dump(session_commit());
+var_dump(session_commit());
+var_dump(session_commit());
+var_dump(session_commit());
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_commit() : variation ***
+bool(true)
+NULL
+NULL
+NULL
+NULL
+NULL
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_commit_variation2.phpt b/ext/session/tests/session_commit_variation2.phpt
new file mode 100644
index 000000000..b38885a8d
--- /dev/null
+++ b/ext/session/tests/session_commit_variation2.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test session_commit() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_commit(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_commit() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_commit());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_commit());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_commit());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_commit() : variation ***
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_commit_variation3.phpt b/ext/session/tests/session_commit_variation3.phpt
new file mode 100644
index 000000000..4cee2f4d5
--- /dev/null
+++ b/ext/session/tests/session_commit_variation3.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.auto_start=1
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_commit(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_commit() : variation ***\n";
+
+var_dump($_SESSION);
+var_dump(session_commit());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_commit() : variation ***
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_commit_variation4.phpt b/ext/session/tests/session_commit_variation4.phpt
new file mode 100644
index 000000000..57f42539d
--- /dev/null
+++ b/ext/session/tests/session_commit_variation4.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test session_commit() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_commit(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_commit() : variation ***\n";
+
+var_dump(session_id("test"));
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_commit());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_commit());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_commit());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_commit() : variation ***
+string(0) ""
+bool(true)
+string(4) "test"
+NULL
+string(4) "test"
+bool(true)
+string(4) "test"
+NULL
+string(4) "test"
+bool(true)
+string(4) "test"
+NULL
+string(4) "test"
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_basic.phpt b/ext/session/tests/session_decode_basic.phpt
new file mode 100644
index 000000000..f8aa24305
--- /dev/null
+++ b/ext/session/tests/session_decode_basic.phpt
@@ -0,0 +1,273 @@
+--TEST--
+Test session_decode() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : basic functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+var_dump(session_start());
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $_SESSION["data"] = $input;
+ $encoded = session_encode();
+ var_dump(session_decode($encoded));
+ var_dump($_SESSION);
+ $iterator++;
+};
+
+var_dump(session_destroy());
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : basic functionality ***
+bool(true)
+
+-- Iteration 1 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(0)
+}
+
+-- Iteration 2 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(1)
+}
+
+-- Iteration 3 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(12345)
+}
+
+-- Iteration 4 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(-2345)
+}
+
+-- Iteration 5 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(10.5)
+}
+
+-- Iteration 6 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(-10.5)
+}
+
+-- Iteration 7 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(123456789000)
+}
+
+-- Iteration 8 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(1.23456789E-9)
+}
+
+-- Iteration 9 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(0.5)
+}
+
+-- Iteration 10 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 11 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 12 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(true)
+}
+
+-- Iteration 13 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(false)
+}
+
+-- Iteration 14 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(true)
+}
+
+-- Iteration 15 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(false)
+}
+
+-- Iteration 16 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(0) ""
+}
+
+-- Iteration 17 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(0) ""
+}
+
+-- Iteration 18 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(7) "Nothing"
+}
+
+-- Iteration 19 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(7) "Nothing"
+}
+
+-- Iteration 20 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(12) "Hello World!"
+}
+
+-- Iteration 21 --
+bool(true)
+array(1) {
+ ["data"]=>
+ object(classA)#2 (0) {
+ }
+}
+
+-- Iteration 22 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 23 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 24 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(0)
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_error.phpt b/ext/session/tests/session_decode_error.phpt
new file mode 100644
index 000000000..416d74116
--- /dev/null
+++ b/ext/session/tests/session_decode_error.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test session_decode() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+var_dump(session_start());
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_decode($input));
+ var_dump($_SESSION);
+ $iterator++;
+};
+
+var_dump(session_destroy());
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : error functionality ***
+bool(true)
+
+-- Iteration 1 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 3 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 4 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 5 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 6 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 7 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 8 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 9 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 10 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 11 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 12 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 13 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 14 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 15 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 16 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 17 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 18 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 19 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 20 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 21 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 22 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 23 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 24 --
+bool(true)
+array(0) {
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_error2.phpt b/ext/session/tests/session_decode_error2.phpt
new file mode 100644
index 000000000..4160f8785
--- /dev/null
+++ b/ext/session/tests/session_decode_error2.phpt
@@ -0,0 +1,615 @@
+--TEST--
+Test session_decode() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : error functionality ***\n";
+$data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;";
+
+var_dump(session_start());
+for($index = 0; $index < strlen($data); $index++) {
+ echo "\n-- Iteration $index --\n";
+ $encoded = substr($data, 0, $index);
+ var_dump(session_decode($encoded));
+ var_dump($_SESSION);
+};
+
+var_dump(session_destroy());
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : error functionality ***
+bool(true)
+
+-- Iteration 0 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 1 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 3 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 4 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 5 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 6 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 7 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 8 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 9 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 10 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 11 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 12 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 13 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 14 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 15 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 16 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 17 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 18 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 19 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 20 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 21 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 22 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 23 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 24 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 25 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 26 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 27 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 28 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 29 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 30 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 31 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 32 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 33 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+
+-- Iteration 34 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 35 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 36 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 37 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 38 --
+bool(true)
+array(1) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 39 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ NULL
+}
+
+-- Iteration 40 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ NULL
+}
+
+-- Iteration 41 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ NULL
+}
+
+-- Iteration 42 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ NULL
+}
+
+-- Iteration 43 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 44 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 45 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 46 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 47 --
+bool(true)
+array(2) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Iteration 48 --
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ NULL
+}
+
+-- Iteration 49 --
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ NULL
+}
+
+-- Iteration 50 --
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ NULL
+}
+
+-- Iteration 51 --
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ NULL
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_variation1.phpt b/ext/session/tests/session_decode_variation1.phpt
new file mode 100644
index 000000000..b2d06b1ab
--- /dev/null
+++ b/ext/session/tests/session_decode_variation1.phpt
@@ -0,0 +1,189 @@
+--TEST--
+Test session_decode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_decode("foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"));
+var_dump($_SESSION);
+var_dump(session_decode("foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"));
+var_dump($_SESSION);
+var_dump(session_decode("foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"));
+var_dump($_SESSION);
+var_dump(session_decode("foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"));
+var_dump($_SESSION);
+var_dump(session_decode("foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : variation ***
+bool(true)
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+array(3) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_variation2.phpt b/ext/session/tests/session_decode_variation2.phpt
new file mode 100644
index 000000000..1a9b68790
--- /dev/null
+++ b/ext/session/tests/session_decode_variation2.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test session_decode() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+$_SESSION["foo"] = 1234567890;
+$_SESSION["bar"] = "Hello World!";
+$_SESSION["guff"] = 123.456;
+var_dump($_SESSION);
+var_dump(session_decode("foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : variation ***
+bool(true)
+array(0) {
+}
+array(3) {
+ ["foo"]=>
+ int(1234567890)
+ ["bar"]=>
+ string(12) "Hello World!"
+ ["guff"]=>
+ float(123.456)
+}
+bool(true)
+array(4) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["bar"]=>
+ string(12) "Hello World!"
+ ["guff"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["blah"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt
new file mode 100644
index 000000000..b7e13cc40
--- /dev/null
+++ b/ext/session/tests/session_decode_variation3.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test session_decode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.serialize_handler=blah
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+$_SESSION["foo"] = 1234567890;
+$_SESSION["bar"] = "Blah!";
+$_SESSION["guff"] = 123.456;
+var_dump($_SESSION);
+$encoded = "A2Zvb2k6MTIzNDU2Nzg5MDs=";
+var_dump(session_decode(base64_decode($encoded)));
+var_dump($_SESSION);
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : variation ***
+
+Warning: session_start(): Unknown session.serialize_handler. Failed to decode session object. in %s on line %d
+bool(true)
+array(0) {
+}
+array(3) {
+ ["foo"]=>
+ int(1234567890)
+ ["bar"]=>
+ string(5) "Blah!"
+ ["guff"]=>
+ float(123.456)
+}
+
+Warning: session_decode(): Unknown session.serialize_handler. Failed to decode session object. in %s on line %d
+bool(true)
+array(3) {
+ ["foo"]=>
+ int(1234567890)
+ ["bar"]=>
+ string(5) "Blah!"
+ ["guff"]=>
+ float(123.456)
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_decode_variation4.phpt b/ext/session/tests/session_decode_variation4.phpt
new file mode 100644
index 000000000..81642754f
--- /dev/null
+++ b/ext/session/tests/session_decode_variation4.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test session_decode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+$_SESSION["foo"] = 1234567890;
+$_SESSION["bar"] = "Blah!";
+$_SESSION["guff"] = 123.456;
+var_dump($_SESSION);
+$encoded = "A2Zvb2k6MTIzNDU2Nzg5MDs=";
+var_dump(session_decode(base64_decode($encoded)));
+var_dump($_SESSION);
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : variation ***
+bool(true)
+array(0) {
+}
+array(3) {
+ ["foo"]=>
+ int(1234567890)
+ ["bar"]=>
+ string(5) "Blah!"
+ ["guff"]=>
+ float(123.456)
+}
+bool(true)
+array(3) {
+ ["foo"]=>
+ int(1234567890)
+ ["bar"]=>
+ string(5) "Blah!"
+ ["guff"]=>
+ float(123.456)
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_destroy_error.phpt b/ext/session/tests/session_destroy_error.phpt
new file mode 100644
index 000000000..c68d33ebd
--- /dev/null
+++ b/ext/session/tests/session_destroy_error.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test session_destroy() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_destroy(void)
+ * Description : Destroys all data registered to a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_destroy() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_destroy($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_destroy() : error functionality ***
+
+-- Iteration 1 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: Wrong parameter count for session_destroy() in %s on line %d
+NULL
+Done
+
diff --git a/ext/session/tests/session_destroy_variation1.phpt b/ext/session/tests/session_destroy_variation1.phpt
new file mode 100644
index 000000000..fdbdf08c5
--- /dev/null
+++ b/ext/session/tests/session_destroy_variation1.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test session_destroy() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_destroy(void)
+ * Description : Destroys all data registered to a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_destroy() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_destroy());
+var_dump(session_destroy());
+var_dump(session_destroy());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_destroy() : variation ***
+bool(true)
+bool(true)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_destroy_variation2.phpt b/ext/session/tests/session_destroy_variation2.phpt
new file mode 100644
index 000000000..c72c65bac
--- /dev/null
+++ b/ext/session/tests/session_destroy_variation2.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test session_destroy() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_destroy(void)
+ * Description : Destroys all data registered to a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_destroy() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_destroy() : variation ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_destroy_variation3.phpt b/ext/session/tests/session_destroy_variation3.phpt
new file mode 100644
index 000000000..b63c17e39
--- /dev/null
+++ b/ext/session/tests/session_destroy_variation3.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test session_destroy() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_destroy(void)
+ * Description : Destroys all data registered to a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_destroy() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_id());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_destroy() : variation ***
+bool(true)
+string(%d) "%s"
+bool(true)
+string(0) ""
+bool(true)
+string(%d) "%s"
+bool(true)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_encode_basic.phpt b/ext/session/tests/session_encode_basic.phpt
new file mode 100644
index 000000000..f74bddd9c
--- /dev/null
+++ b/ext/session/tests/session_encode_basic.phpt
@@ -0,0 +1,174 @@
+--TEST--
+Test session_encode() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : basic functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+var_dump(session_start());
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $_SESSION["data"] = $input;
+ var_dump(session_encode());
+ $iterator++;
+};
+
+var_dump(session_destroy());
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : basic functionality ***
+bool(true)
+
+-- Iteration 1 --
+string(9) "data|i:0;"
+
+-- Iteration 2 --
+string(9) "data|i:1;"
+
+-- Iteration 3 --
+string(13) "data|i:12345;"
+
+-- Iteration 4 --
+string(13) "data|i:-2345;"
+
+-- Iteration 5 --
+string(12) "data|d:10.5;"
+
+-- Iteration 6 --
+string(13) "data|d:-10.5;"
+
+-- Iteration 7 --
+string(20) "data|d:123456789000;"
+
+-- Iteration 8 --
+string(86) "data|d:1.2345678899999999145113427164344339914681114578343112953007221221923828125E-9;"
+
+-- Iteration 9 --
+string(11) "data|d:0.5;"
+
+-- Iteration 10 --
+string(7) "data|N;"
+
+-- Iteration 11 --
+string(7) "data|N;"
+
+-- Iteration 12 --
+string(9) "data|b:1;"
+
+-- Iteration 13 --
+string(9) "data|b:0;"
+
+-- Iteration 14 --
+string(9) "data|b:1;"
+
+-- Iteration 15 --
+string(9) "data|b:0;"
+
+-- Iteration 16 --
+string(12) "data|s:0:"";"
+
+-- Iteration 17 --
+string(12) "data|s:0:"";"
+
+-- Iteration 18 --
+string(19) "data|s:7:"Nothing";"
+
+-- Iteration 19 --
+string(19) "data|s:7:"Nothing";"
+
+-- Iteration 20 --
+string(25) "data|s:12:"Hello World!";"
+
+-- Iteration 21 --
+string(22) "data|O:6:"classA":0:{}"
+
+-- Iteration 22 --
+string(7) "data|N;"
+
+-- Iteration 23 --
+string(7) "data|N;"
+
+-- Iteration 24 --
+string(9) "data|i:0;"
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_encode_error.phpt b/ext/session/tests/session_encode_error.phpt
new file mode 100644
index 000000000..ce4fd383b
--- /dev/null
+++ b/ext/session/tests/session_encode_error.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test session_encode() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : basic functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+session_start();
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_encode($input));
+ $iterator++;
+};
+
+session_destroy();
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : basic functionality ***
+
+-- Iteration 1 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: Wrong parameter count for session_encode() in %s on line %d
+NULL
+Done
+
diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt
new file mode 100644
index 000000000..6a019b203
--- /dev/null
+++ b/ext/session/tests/session_encode_error2.phpt
@@ -0,0 +1,251 @@
+--TEST--
+Test session_encode() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_start());
+ $_SESSION[$input] = "Hello World!";
+ var_dump(session_encode());
+ var_dump(session_destroy());
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : error functionality ***
+
+-- Iteration 1 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 0. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 1. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 12345. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key -2345. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 10. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key -10. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key %s. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 0. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 0. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+string(21) "|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 11 --
+bool(true)
+string(21) "|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 1. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 0. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 1. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 0. in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+string(21) "|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+string(21) "|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+string(28) "Nothing|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+string(28) "Nothing|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+string(33) "Hello World!|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+Warning: Illegal offset type in %s on line 82
+bool(false)
+bool(true)
+
+-- Iteration 22 --
+bool(true)
+string(21) "|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 23 --
+bool(true)
+string(21) "|s:12:"Hello World!";"
+bool(true)
+
+-- Iteration 24 --
+bool(true)
+
+Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+
+Notice: session_encode(): Skipping numeric key %d. in %s on line %d
+bool(false)
+bool(true)
+Done
diff --git a/ext/session/tests/session_encode_variation1.phpt b/ext/session/tests/session_encode_variation1.phpt
new file mode 100644
index 000000000..9c9f64b43
--- /dev/null
+++ b/ext/session/tests/session_encode_variation1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_encode());
+var_dump(session_start());
+var_dump(session_encode());
+var_dump(session_write_close());
+var_dump(session_encode());
+var_dump(session_start());
+var_dump(session_encode());
+var_dump(session_destroy());
+var_dump(session_encode());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+
+Warning: session_encode(): Cannot encode non-existent session. in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+NULL
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+
+Warning: session_encode(): Cannot encode non-existent session. in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_encode_variation2.phpt b/ext/session/tests/session_encode_variation2.phpt
new file mode 100644
index 000000000..7ec8a63af
--- /dev/null
+++ b/ext/session/tests/session_encode_variation2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.auto_start=1
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_encode());
+var_dump(session_destroy());
+var_dump(session_encode());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+bool(false)
+bool(true)
+
+Warning: session_encode(): Cannot encode non-existent session. in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_encode_variation3.phpt b/ext/session/tests/session_encode_variation3.phpt
new file mode 100644
index 000000000..40bb44de5
--- /dev/null
+++ b/ext/session/tests/session_encode_variation3.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_start());
+
+$array = array(1,2,3);
+$_SESSION["foo"] = &$array;
+var_dump(session_encode());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+bool(true)
+string(34) "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}"
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_encode_variation4.phpt b/ext/session/tests/session_encode_variation4.phpt
new file mode 100644
index 000000000..d85b9a48a
--- /dev/null
+++ b/ext/session/tests/session_encode_variation4.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_start());
+
+$array = array(1,2,3);
+$_SESSION["foo"] = &$array;
+$_SESSION["guff"] = &$array;
+$_SESSION["blah"] = &$array;
+var_dump(session_encode());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+bool(true)
+string(52) "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;"
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_encode_variation5.phpt b/ext/session/tests/session_encode_variation5.phpt
new file mode 100644
index 000000000..fc408847b
--- /dev/null
+++ b/ext/session/tests/session_encode_variation5.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_start());
+
+$array = array(1,2,3);
+$array["foo"] = &$array;
+$array["blah"] = &$array;
+$_SESSION["data"] = &$array;
+var_dump(session_encode());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+bool(true)
+string(64) "data|a:5:{i:0;i:1;i:1;i:2;i:2;i:3;s:3:"foo";R:1;s:4:"blah";R:1;}"
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_encode_variation6.phpt b/ext/session/tests/session_encode_variation6.phpt
new file mode 100644
index 000000000..428047382
--- /dev/null
+++ b/ext/session/tests/session_encode_variation6.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_start());
+$_SESSION[] = 1234567890;
+var_dump(session_encode());
+var_dump(session_destroy());
+var_dump(session_start());
+$_SESSION[1234567890] = "Hello World!";
+var_dump(session_encode());
+var_dump(session_destroy());
+var_dump(session_start());
+$_SESSION[-1234567890] = 1234567890;
+var_dump(session_encode());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 0. in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+
+Notice: session_encode(): Skipping numeric key 1234567890. in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+
+Notice: session_encode(): Skipping numeric key -1234567890. in %s on line %d
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_encode_variation7.phpt b/ext/session/tests/session_encode_variation7.phpt
new file mode 100644
index 000000000..b3de3c68a
--- /dev/null
+++ b/ext/session/tests/session_encode_variation7.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.serialize_handler=php_binary
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_start());
+$_SESSION["foo"] = 1234567890;
+$encoded = session_encode();
+var_dump(base64_encode($encoded));
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+bool(true)
+string(24) "A2Zvb2k6MTIzNDU2Nzg5MDs="
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_encode_variation8.phpt b/ext/session/tests/session_encode_variation8.phpt
new file mode 100644
index 000000000..57c9e17bd
--- /dev/null
+++ b/ext/session/tests/session_encode_variation8.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test session_encode() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.serialize_handler=blah
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_encode(void)
+ * Description : Encodes the current session data as a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_encode() : variation ***\n";
+
+var_dump(session_start());
+$_SESSION["foo"] = 1234567890;
+$encoded = session_encode();
+var_dump(base64_encode($encoded));
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_encode() : variation ***
+
+Warning: session_start(): Unknown session.serialize_handler. Failed to decode session object. in %s on line %d
+bool(true)
+
+Warning: session_encode(): Unknown session.serialize_handler. Failed to encode session object. in %s on line %d
+string(0) ""
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_get_cookie_params_basic.phpt b/ext/session/tests/session_get_cookie_params_basic.phpt
new file mode 100644
index 000000000..5cadc7947
--- /dev/null
+++ b/ext/session/tests/session_get_cookie_params_basic.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test session_get_cookie_params() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : array session_get_cookie_params(void)
+ * Description : Get the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_get_cookie_params() : basic functionality ***\n";
+
+var_dump(session_get_cookie_params());
+var_dump(session_set_cookie_params(3600, "/path", "blah", FALSE, FALSE));
+var_dump(session_get_cookie_params());
+var_dump(session_set_cookie_params(1234567890, "/guff", "foo", TRUE, TRUE));
+var_dump(session_get_cookie_params());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_get_cookie_params() : basic functionality ***
+array(5) {
+ ["lifetime"]=>
+ int(0)
+ ["path"]=>
+ string(1) "/"
+ ["domain"]=>
+ string(0) ""
+ ["secure"]=>
+ bool(false)
+ ["httponly"]=>
+ bool(false)
+}
+NULL
+array(5) {
+ ["lifetime"]=>
+ int(3600)
+ ["path"]=>
+ string(5) "/path"
+ ["domain"]=>
+ string(4) "blah"
+ ["secure"]=>
+ bool(false)
+ ["httponly"]=>
+ bool(false)
+}
+NULL
+array(5) {
+ ["lifetime"]=>
+ int(1234567890)
+ ["path"]=>
+ string(5) "/guff"
+ ["domain"]=>
+ string(3) "foo"
+ ["secure"]=>
+ bool(true)
+ ["httponly"]=>
+ bool(true)
+}
+Done
+
diff --git a/ext/session/tests/session_get_cookie_params_error.phpt b/ext/session/tests/session_get_cookie_params_error.phpt
new file mode 100644
index 000000000..529ea6b11
--- /dev/null
+++ b/ext/session/tests/session_get_cookie_params_error.phpt
@@ -0,0 +1,217 @@
+--TEST--
+Test session_get_cookie_params() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : array session_get_cookie_params(void)
+ * Description : Get the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_get_cookie_params() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_get_cookie_params($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_get_cookie_params() : error functionality ***
+
+-- Iteration 1 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: Wrong parameter count for session_get_cookie_params() in %s on line %d
+NULL
+Done
+
diff --git a/ext/session/tests/session_get_cookie_params_variation1.phpt b/ext/session/tests/session_get_cookie_params_variation1.phpt
new file mode 100644
index 000000000..0ab4eec88
--- /dev/null
+++ b/ext/session/tests/session_get_cookie_params_variation1.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test session_get_cookie_params() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : array session_get_cookie_params(void)
+ * Description : Get the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_get_cookie_params() : variation ***\n";
+
+var_dump(session_get_cookie_params());
+ini_set("session.cookie_lifetime", 3600);
+var_dump(session_get_cookie_params());
+ini_set("session.cookie_path", "/path");
+var_dump(session_get_cookie_params());
+ini_set("session.cookie_domain", "foo");
+var_dump(session_get_cookie_params());
+ini_set("session.cookie_secure", TRUE);
+var_dump(session_get_cookie_params());
+ini_set("session.cookie_httponly", TRUE);
+var_dump(session_get_cookie_params());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_get_cookie_params() : variation ***
+array(5) {
+ ["lifetime"]=>
+ int(0)
+ ["path"]=>
+ string(1) "/"
+ ["domain"]=>
+ string(0) ""
+ ["secure"]=>
+ bool(false)
+ ["httponly"]=>
+ bool(false)
+}
+array(5) {
+ ["lifetime"]=>
+ int(3600)
+ ["path"]=>
+ string(1) "/"
+ ["domain"]=>
+ string(0) ""
+ ["secure"]=>
+ bool(false)
+ ["httponly"]=>
+ bool(false)
+}
+array(5) {
+ ["lifetime"]=>
+ int(3600)
+ ["path"]=>
+ string(5) "/path"
+ ["domain"]=>
+ string(0) ""
+ ["secure"]=>
+ bool(false)
+ ["httponly"]=>
+ bool(false)
+}
+array(5) {
+ ["lifetime"]=>
+ int(3600)
+ ["path"]=>
+ string(5) "/path"
+ ["domain"]=>
+ string(3) "foo"
+ ["secure"]=>
+ bool(false)
+ ["httponly"]=>
+ bool(false)
+}
+array(5) {
+ ["lifetime"]=>
+ int(3600)
+ ["path"]=>
+ string(5) "/path"
+ ["domain"]=>
+ string(3) "foo"
+ ["secure"]=>
+ bool(true)
+ ["httponly"]=>
+ bool(false)
+}
+array(5) {
+ ["lifetime"]=>
+ int(3600)
+ ["path"]=>
+ string(5) "/path"
+ ["domain"]=>
+ string(3) "foo"
+ ["secure"]=>
+ bool(true)
+ ["httponly"]=>
+ bool(true)
+}
+Done
+
diff --git a/ext/session/tests/session_id_basic.phpt b/ext/session/tests/session_id_basic.phpt
new file mode 100644
index 000000000..5cb13c25e
--- /dev/null
+++ b/ext/session/tests/session_id_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test session_id() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_id([string $id])
+ * Description : Get and/or set the current session id
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_id() : basic functionality ***\n";
+
+var_dump(session_id());
+var_dump(session_id("test"));
+var_dump(session_id());
+var_dump(session_id("1234567890"));
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_id());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_id() : basic functionality ***
+string(0) ""
+string(0) ""
+string(4) "test"
+string(4) "test"
+string(10) "1234567890"
+bool(true)
+string(10) "1234567890"
+bool(true)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_id_error.phpt b/ext/session/tests/session_id_error.phpt
new file mode 100644
index 000000000..07c4ed702
--- /dev/null
+++ b/ext/session/tests/session_id_error.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test session_id() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_id([string $id])
+ * Description : Get and/or set the current session id
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_id() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_id($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_id() : error functionality ***
+
+-- Iteration 1 --
+string(0) ""
+
+-- Iteration 2 --
+string(1) "0"
+
+-- Iteration 3 --
+string(1) "1"
+
+-- Iteration 4 --
+string(5) "12345"
+
+-- Iteration 5 --
+string(5) "-2345"
+
+-- Iteration 6 --
+string(4) "10.5"
+
+-- Iteration 7 --
+string(5) "-10.5"
+
+-- Iteration 8 --
+string(12) "123456789000"
+
+-- Iteration 9 --
+string(13) "1.23456789E-9"
+
+-- Iteration 10 --
+string(3) "0.5"
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(0) ""
+
+-- Iteration 13 --
+string(1) "1"
+
+-- Iteration 14 --
+string(0) ""
+
+-- Iteration 15 --
+string(1) "1"
+
+-- Iteration 16 --
+string(0) ""
+
+-- Iteration 17 --
+string(0) ""
+
+-- Iteration 18 --
+string(0) ""
+
+-- Iteration 19 --
+string(7) "Nothing"
+
+-- Iteration 20 --
+string(7) "Nothing"
+
+-- Iteration 21 --
+string(12) "Hello World!"
+
+-- Iteration 22 --
+string(12) "Hello World!"
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_id_error2.phpt b/ext/session/tests/session_id_error2.phpt
new file mode 100644
index 000000000..05284e797
--- /dev/null
+++ b/ext/session/tests/session_id_error2.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test session_id() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_id([string $id])
+ * Description : Get and/or set the current session id
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_id() : error functionality ***\n";
+
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id("test"));
+var_dump(session_id());
+var_dump(session_id("1234567890"));
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_id());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_id() : error functionality ***
+string(0) ""
+bool(true)
+string(%d) "%s"
+string(4) "test"
+string(4) "test"
+string(10) "1234567890"
+bool(true)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_id_error3.phpt b/ext/session/tests/session_id_error3.phpt
new file mode 100644
index 000000000..fc291389d
--- /dev/null
+++ b/ext/session/tests/session_id_error3.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test session_id() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_id([string $id])
+ * Description : Get and/or set the current session id
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_id() : error functionality ***\n";
+
+@session_start();
+var_dump(session_id());
+var_dump(session_id("!"));
+var_dump(session_id());
+@session_destroy();
+
+@session_start();
+var_dump(session_id());
+var_dump(session_id("?><"));
+var_dump(session_id());
+@session_destroy();
+
+@session_start();
+var_dump(session_id());
+var_dump(session_id("£$%^&*()"));
+var_dump(session_id());
+@session_destroy();
+
+@session_start();
+var_dump(session_id());
+var_dump(session_id("\r\n"));
+var_dump(session_id());
+@session_destroy();
+
+@session_start();
+var_dump(session_id());
+var_dump(session_id("\0"));
+var_dump(session_id());
+@session_destroy();
+
+@session_start();
+var_dump(session_id());
+var_dump(session_id("¬``@~:{>?><,./[]+--"));
+var_dump(session_id());
+@session_destroy();
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_id() : error functionality ***
+string(%d) "%s"
+string(%d) "%s"
+string(1) "!"
+string(%d) "%s"
+string(%d) "%s"
+string(3) "?><"
+string(%d) "%s"
+string(%d) "%s"
+string(8) "£$%^&*()"
+string(%d) "%s"
+string(%d) "%s"
+string(2) "
+"
+string(%d) "%s"
+string(%d) "%s"
+string(0) ""
+string(%d) "%s"
+string(%d) "%s"
+string(19) "¬``@~:{>?><,./[]+--"
+Done
+
diff --git a/ext/session/tests/session_id_error4.phpt b/ext/session/tests/session_id_error4.phpt
new file mode 100644
index 000000000..cc23578ae
--- /dev/null
+++ b/ext/session/tests/session_id_error4.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test session_id() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_id([string $id])
+ * Description : Get and/or set the current session id
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_id() : error functionality ***\n";
+
+var_dump(ini_set("session.hash_function", -1));
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_id() : error functionality ***
+string(1) "0"
+string(0) ""
+
+Fatal error: session_start(): Invalid session hash function in %s on line %d
+
diff --git a/ext/session/tests/session_id_variation1.phpt b/ext/session/tests/session_id_variation1.phpt
new file mode 100644
index 000000000..54d980f3a
--- /dev/null
+++ b/ext/session/tests/session_id_variation1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test session_id() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_id([string $id])
+ * Description : Get and/or set the current session id
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_id() : variation ***\n";
+
+var_dump(ini_set("session.hash_function", 0));
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+
+var_dump(ini_set("session.hash_function", 1));
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_id() : variation ***
+string(1) "0"
+string(0) ""
+bool(true)
+string(%d) "%s"
+bool(true)
+string(1) "0"
+string(0) ""
+bool(true)
+string(%d) "%s"
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_id_variation2.phpt b/ext/session/tests/session_id_variation2.phpt
new file mode 100644
index 000000000..7b09adafc
--- /dev/null
+++ b/ext/session/tests/session_id_variation2.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test session_id() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_id([string $id])
+ * Description : Get and/or set the current session id
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_id() : variation ***\n";
+
+$directory = dirname(__FILE__);
+$filename = ($directory."/entropy.txt");
+var_dump(ini_set("session.entropy_file", $filename));
+var_dump(file_put_contents($filename, "Hello World!"));
+var_dump(ini_set("session.entropy_length", filesize($filename)));
+
+var_dump(ini_set("session.hash_function", 0));
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+
+var_dump(ini_set("session.hash_function", 1));
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(unlink($filename));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_id() : variation ***
+string(0) ""
+int(12)
+string(1) "0"
+string(1) "0"
+string(0) ""
+bool(true)
+string(%d) "%s"
+bool(true)
+string(1) "0"
+string(0) ""
+bool(true)
+string(%d) "%s"
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_is_registered_basic.phpt b/ext/session/tests/session_is_registered_basic.phpt
new file mode 100644
index 000000000..080dd0bcc
--- /dev/null
+++ b/ext/session/tests/session_is_registered_basic.phpt
@@ -0,0 +1,269 @@
+--TEST--
+Test session_unregister() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_is_registered(string $name)
+ * Description : Find out whether a global variable is registered in a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_is_registered() : basic functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_start());
+ var_dump(session_is_registered($input));
+ var_dump($_SESSION);
+ var_dump(session_destroy());
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_is_registered() : basic functionality ***
+
+-- Iteration 1 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 11 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 22 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 23 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+
+-- Iteration 24 --
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_is_registered_variation1.phpt b/ext/session/tests/session_is_registered_variation1.phpt
new file mode 100644
index 000000000..f92de8297
--- /dev/null
+++ b/ext/session/tests/session_is_registered_variation1.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test session_unregister() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_is_registered(string $name)
+ * Description : Find out whether a global variable is registered in a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_is_registered() : variation ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_is_registered($inputs));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_is_registered() : variation ***
+bool(true)
+array(0) {
+}
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+array(0) {
+}
+bool(true)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_is_registered_variation2.phpt b/ext/session/tests/session_is_registered_variation2.phpt
new file mode 100644
index 000000000..582b947af
--- /dev/null
+++ b/ext/session/tests/session_is_registered_variation2.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test session_unregister() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_is_registered(string $name)
+ * Description : Find out whether a global variable is registered in a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_is_registered() : variation ***\n";
+
+var_dump(session_is_registered("foo"));
+var_dump(session_start());
+var_dump(session_is_registered("foo"));
+var_dump($_SESSION);
+$_SESSION["foo"] = "Hello World!";
+var_dump(session_is_registered("foo"));
+var_dump($_SESSION);
+var_dump(session_is_registered("foo"));
+var_dump(session_unregister("foo"));
+var_dump(session_is_registered("foo"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump(session_is_registered("foo"));
+var_dump($_SESSION);
+var_dump(session_is_registered("foo"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_is_registered() : variation ***
+bool(false)
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+array(1) {
+ ["foo"]=>
+ string(12) "Hello World!"
+}
+bool(true)
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+bool(false)
+array(0) {
+}
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_is_registered_variation3.phpt b/ext/session/tests/session_is_registered_variation3.phpt
new file mode 100644
index 000000000..10f7ffe49
--- /dev/null
+++ b/ext/session/tests/session_is_registered_variation3.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test session_unregister() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_is_registered(string $name)
+ * Description : Find out whether a global variable is registered in a session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_is_registered() : variation ***\n";
+
+var_dump(session_is_registered("foo"));
+var_dump(session_start());
+var_dump(session_is_registered("foo"));
+var_dump($_SESSION);
+$blah = "Hello World!";
+var_dump(session_is_registered("foo"));
+$_SESSION["foo"] = &$blah;
+var_dump($_SESSION);
+var_dump(session_is_registered("foo"));
+var_dump(session_unregister("foo"));
+var_dump(session_is_registered("foo"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump(session_is_registered("foo"));
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_is_registered() : variation ***
+bool(false)
+bool(true)
+bool(false)
+array(0) {
+}
+bool(false)
+array(1) {
+ ["foo"]=>
+ &string(12) "Hello World!"
+}
+bool(true)
+bool(true)
+bool(false)
+array(0) {
+}
+bool(true)
+bool(false)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_module_name_basic.phpt b/ext/session/tests/session_module_name_basic.phpt
new file mode 100644
index 000000000..2daf6fc62
--- /dev/null
+++ b/ext/session/tests/session_module_name_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test session_module_name() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_module_name([string $module])
+ * Description : Get and/or set the current session module
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_module_name() : basic functionality ***\n";
+var_dump(session_module_name("files"));
+var_dump(session_module_name());
+var_dump(session_start());
+var_dump(session_module_name());
+var_dump(session_destroy());
+var_dump(session_module_name());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_module_name() : basic functionality ***
+string(%d) "%s"
+string(5) "files"
+bool(true)
+string(5) "files"
+bool(true)
+string(5) "files"
+Done
diff --git a/ext/session/tests/session_module_name_error.phpt b/ext/session/tests/session_module_name_error.phpt
new file mode 100644
index 000000000..84cfde499
--- /dev/null
+++ b/ext/session/tests/session_module_name_error.phpt
@@ -0,0 +1,216 @@
+--TEST--
+Test session_module_name() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_module_name([string $module])
+ * Description : Get and/or set the current session module
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_module_name() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_module_name($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_module_name() : error functionality ***
+
+-- Iteration 1 --
+
+Warning: session_module_name(): Cannot find named PHP session module (0) in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: session_module_name(): Cannot find named PHP session module (1) in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: session_module_name(): Cannot find named PHP session module (12345) in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: session_module_name(): Cannot find named PHP session module (-2345) in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: session_module_name(): Cannot find named PHP session module (10.5) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: session_module_name(): Cannot find named PHP session module (-10.5) in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: session_module_name(): Cannot find named PHP session module (123456789000) in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: session_module_name(): Cannot find named PHP session module (1.23456789E-9) in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: session_module_name(): Cannot find named PHP session module (0.5) in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: session_module_name(): Cannot find named PHP session module (1) in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: session_module_name(): Cannot find named PHP session module (1) in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: session_module_name(): Cannot find named PHP session module (Nothing) in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: session_module_name(): Cannot find named PHP session module (Nothing) in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: session_module_name(): Cannot find named PHP session module (Hello World!) in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: session_module_name(): Cannot find named PHP session module (Hello World!) in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: session_module_name(): Cannot find named PHP session module (Resource id #%d) in %s on line %d
+bool(false)
+Done
diff --git a/ext/session/tests/session_module_name_variation1.phpt b/ext/session/tests/session_module_name_variation1.phpt
new file mode 100644
index 000000000..2034b7eff
--- /dev/null
+++ b/ext/session/tests/session_module_name_variation1.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test session_module_name() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_module_name([string $module])
+ * Description : Get and/or set the current session module
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_module_name() : variation ***\n";
+var_dump(session_module_name("blah"));
+var_dump(session_start());
+var_dump(session_module_name());
+var_dump(session_destroy());
+var_dump(session_module_name());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_module_name() : variation ***
+
+Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
+bool(false)
+bool(true)
+string(%d) "%s"
+bool(true)
+string(%d) "%s"
+Done
diff --git a/ext/session/tests/session_module_name_variation2.phpt b/ext/session/tests/session_module_name_variation2.phpt
new file mode 100644
index 000000000..aa7b33c76
--- /dev/null
+++ b/ext/session/tests/session_module_name_variation2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test session_module_name() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_module_name([string $module])
+ * Description : Get and/or set the current session module
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_module_name() : variation ***\n";
+
+function open($save_path, $session_name) { }
+function close() { }
+function read($id) { }
+function write($id, $session_data) { }
+function destroy($id) { }
+function gc($maxlifetime) { }
+
+var_dump(session_module_name("files"));
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+var_dump(session_module_name());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_module_name() : variation ***
+string(%d) "%s"
+string(4) "user"
diff --git a/ext/session/tests/session_module_name_variation3.phpt b/ext/session/tests/session_module_name_variation3.phpt
new file mode 100644
index 000000000..dc1c6ba5e
--- /dev/null
+++ b/ext/session/tests/session_module_name_variation3.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test session_module_name() function : variation
+--INI--
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_module_name([string $module])
+ * Description : Get and/or set the current session module
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_module_name() : variation ***\n";
+function open($save_path, $session_name) {
+ throw new Exception("Stop...!");
+}
+
+function close() { }
+function read($id) { }
+function write($id, $session_data) { }
+function destroy($id) { }
+function gc($maxlifetime) { }
+
+var_dump(session_module_name("files"));
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+var_dump(session_module_name());
+var_dump(session_start());
+var_dump(session_module_name());
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_module_name() : variation ***
+string(%d) "%s"
+string(4) "user"
+
+Fatal error: Uncaught exception 'Exception' with message 'Stop...!' in %s:%d
+Stack trace:
+#0 [internal function]: open('', 'PHPSESSID')
+#1 %s(%d): session_start()
+#2 {main}
+ thrown in %s on line %d
diff --git a/ext/session/tests/session_module_name_variation4.phpt b/ext/session/tests/session_module_name_variation4.phpt
new file mode 100644
index 000000000..0748b3db2
--- /dev/null
+++ b/ext/session/tests/session_module_name_variation4.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test session_module_name() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.gc_probability=1
+session.gc_divisor=1
+session.gc_maxlifetime=0
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_module_name([string $module])
+ * Description : Get and/or set the current session module
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_module_name() : variation ***\n";
+
+require_once "save_handler.inc";
+$path = dirname(__FILE__);
+session_save_path($path);
+session_module_name("files");
+
+session_start();
+$_SESSION["Blah"] = "Hello World!";
+$_SESSION["Foo"] = FALSE;
+$_SESSION["Guff"] = 1234567890;
+var_dump($_SESSION);
+
+var_dump(session_write_close());
+session_start();
+var_dump($_SESSION);
+var_dump(session_destroy());
+session_start();
+var_dump($_SESSION);
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_module_name() : variation ***
+
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+NULL
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+bool(true)
+array(0) {
+}
+bool(true)
+
diff --git a/ext/session/tests/session_name_basic.phpt b/ext/session/tests/session_name_basic.phpt
new file mode 100644
index 000000000..959f40666
--- /dev/null
+++ b/ext/session/tests/session_name_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test session_name() function : error functionality
+--INI--
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_name([string $name])
+ * Description : Get and/or set the current session name
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_name() : error functionality ***\n";
+
+var_dump(session_name());
+var_dump(session_name("blah"));
+var_dump(session_start());
+var_dump(session_name());
+var_dump(session_destroy());
+var_dump(session_name());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_name() : error functionality ***
+string(9) "PHPSESSID"
+string(9) "PHPSESSID"
+bool(true)
+string(4) "blah"
+bool(true)
+string(4) "blah"
+Done
+
diff --git a/ext/session/tests/session_name_error.phpt b/ext/session/tests/session_name_error.phpt
new file mode 100644
index 000000000..a2dc01b51
--- /dev/null
+++ b/ext/session/tests/session_name_error.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test session_name() function : error functionality
+--INI--
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_name([string $name])
+ * Description : Get and/or set the current session name
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_name() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_name($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_name() : error functionality ***
+
+-- Iteration 1 --
+string(9) "PHPSESSID"
+
+-- Iteration 2 --
+string(1) "0"
+
+-- Iteration 3 --
+string(1) "1"
+
+-- Iteration 4 --
+string(5) "12345"
+
+-- Iteration 5 --
+string(5) "-2345"
+
+-- Iteration 6 --
+string(4) "10.5"
+
+-- Iteration 7 --
+string(5) "-10.5"
+
+-- Iteration 8 --
+string(12) "123456789000"
+
+-- Iteration 9 --
+string(13) "1.23456789E-9"
+
+-- Iteration 10 --
+string(3) "0.5"
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(0) ""
+
+-- Iteration 13 --
+string(1) "1"
+
+-- Iteration 14 --
+string(0) ""
+
+-- Iteration 15 --
+string(1) "1"
+
+-- Iteration 16 --
+string(0) ""
+
+-- Iteration 17 --
+string(0) ""
+
+-- Iteration 18 --
+string(0) ""
+
+-- Iteration 19 --
+string(7) "Nothing"
+
+-- Iteration 20 --
+string(7) "Nothing"
+
+-- Iteration 21 --
+string(12) "Hello World!"
+
+-- Iteration 22 --
+string(12) "Hello World!"
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_name_variation1.phpt b/ext/session/tests/session_name_variation1.phpt
new file mode 100644
index 000000000..16d6ad462
--- /dev/null
+++ b/ext/session/tests/session_name_variation1.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test session_name() function : variation
+--INI--
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_name([string $name])
+ * Description : Get and/or set the current session name
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_name() : variation ***\n";
+
+var_dump(session_name("\0"));
+var_dump(session_start());
+var_dump(session_name());
+var_dump(session_destroy());
+var_dump(session_name());
+
+var_dump(session_name("\t"));
+var_dump(session_start());
+var_dump(session_name());
+var_dump(session_destroy());
+var_dump(session_name());
+
+var_dump(session_name(""));
+var_dump(session_start());
+var_dump(session_name());
+var_dump(session_destroy());
+var_dump(session_name());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_name() : variation ***
+string(9) "PHPSESSID"
+bool(true)
+string(0) ""
+bool(true)
+string(0) ""
+string(0) ""
+bool(true)
+string(1) " "
+bool(true)
+string(1) " "
+string(1) " "
+bool(true)
+string(0) ""
+bool(true)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_name_variation2.phpt b/ext/session/tests/session_name_variation2.phpt
new file mode 100644
index 000000000..84bfeba74
--- /dev/null
+++ b/ext/session/tests/session_name_variation2.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test session_name() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.name=blah
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_name([string $name])
+ * Description : Get and/or set the current session name
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_name() : variation ***\n";
+
+var_dump(session_name());
+var_dump(session_name("blah"));
+var_dump(session_start());
+var_dump(session_name());
+var_dump(session_destroy());
+var_dump(session_name());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_name() : variation ***
+string(4) "blah"
+string(4) "blah"
+bool(true)
+string(4) "blah"
+bool(true)
+string(4) "blah"
+Done
+
diff --git a/ext/session/tests/session_regenerate_id_basic.phpt b/ext/session/tests/session_regenerate_id_basic.phpt
new file mode 100644
index 000000000..910620a66
--- /dev/null
+++ b/ext/session/tests/session_regenerate_id_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test session_regenerate_id() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_regenerate_id([bool $delete_old_session])
+ * Description : Update the current session id with a newly generated one
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_regenerate_id() : basic functionality ***\n";
+
+var_dump(session_id());
+var_dump(session_regenerate_id());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_regenerate_id());
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_regenerate_id());
+var_dump(session_id());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_regenerate_id() : basic functionality ***
+string(0) ""
+bool(false)
+string(0) ""
+bool(true)
+bool(true)
+string(%d) "%s"
+bool(true)
+bool(false)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_regenerate_id_error.phpt b/ext/session/tests/session_regenerate_id_error.phpt
new file mode 100644
index 000000000..9e119f17f
--- /dev/null
+++ b/ext/session/tests/session_regenerate_id_error.phpt
@@ -0,0 +1,174 @@
+--TEST--
+Test session_regenerate_id() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_regenerate_id([bool $delete_old_session])
+ * Description : Update the current session id with a newly generated one
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_regenerate_id() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_regenerate_id($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_regenerate_id() : error functionality ***
+
+-- 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 --
+
+Warning: session_regenerate_id() expects parameter 1 to be boolean, object given in %s on line %d
+NULL
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+
+Warning: session_regenerate_id() expects parameter 1 to be boolean, resource given in %s on line %d
+NULL
+Done
+
diff --git a/ext/session/tests/session_regenerate_id_variation1.phpt b/ext/session/tests/session_regenerate_id_variation1.phpt
new file mode 100644
index 000000000..95d4a77c8
--- /dev/null
+++ b/ext/session/tests/session_regenerate_id_variation1.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test session_regenerate_id() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_regenerate_id([bool $delete_old_session])
+ * Description : Update the current session id with a newly generated one
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_regenerate_id() : variation ***\n";
+
+var_dump(session_id());
+var_dump(session_regenerate_id(TRUE));
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_regenerate_id(TRUE));
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_regenerate_id(TRUE));
+var_dump(session_id());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_regenerate_id() : variation ***
+string(0) ""
+bool(false)
+string(0) ""
+bool(true)
+bool(true)
+string(%d) "%s"
+bool(true)
+bool(false)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_register_basic.phpt b/ext/session/tests/session_register_basic.phpt
new file mode 100644
index 000000000..75ae97286
--- /dev/null
+++ b/ext/session/tests/session_register_basic.phpt
@@ -0,0 +1,317 @@
+--TEST--
+Test session_register() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_register(mixed $name [,mixed $...])
+ * Description : Register one or more global variables with the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_register() : basic functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_start());
+ var_dump(session_register($input));
+ var_dump($_SESSION);
+ var_dump(session_destroy());
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_register() : basic functionality ***
+
+-- Iteration 1 --
+bool(true)
+bool(true)
+array(1) {
+ ["0"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+bool(true)
+array(1) {
+ ["1"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+bool(true)
+array(1) {
+ ["12345"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+bool(true)
+array(1) {
+ ["-2345"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+bool(true)
+array(1) {
+ ["10.5"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+bool(true)
+array(1) {
+ ["-10.5"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+bool(true)
+array(1) {
+ ["123456789000"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+bool(true)
+array(1) {
+ ["1.23456789E-9"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+bool(true)
+array(1) {
+ ["0.5"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 11 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+bool(true)
+array(1) {
+ ["1"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+bool(true)
+array(1) {
+ ["1"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+bool(true)
+array(1) {
+ ["Nothing"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+bool(true)
+array(1) {
+ ["Nothing"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+bool(true)
+array(1) {
+ ["Hello World!"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+bool(true)
+array(1) {
+ ["Hello World!"]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 22 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 23 --
+bool(true)
+bool(true)
+array(1) {
+ [""]=>
+ NULL
+}
+bool(true)
+
+-- Iteration 24 --
+bool(true)
+bool(true)
+array(1) {
+ ["Resource id #%d"]=>
+ NULL
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_register_variation1.phpt b/ext/session/tests/session_register_variation1.phpt
new file mode 100644
index 000000000..4f40a095b
--- /dev/null
+++ b/ext/session/tests/session_register_variation1.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test session_register() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_register(mixed $name [,mixed $...])
+ * Description : Register one or more global variables with the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_register() : variation ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_register($inputs));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_register() : variation ***
+bool(true)
+array(0) {
+}
+bool(true)
+array(13) {
+ ["0"]=>
+ NULL
+ ["1"]=>
+ NULL
+ ["12345"]=>
+ NULL
+ ["-2345"]=>
+ NULL
+ ["10.5"]=>
+ NULL
+ ["-10.5"]=>
+ NULL
+ ["123456789000"]=>
+ NULL
+ ["1.23456789E-9"]=>
+ NULL
+ ["0.5"]=>
+ NULL
+ [""]=>
+ NULL
+ ["Nothing"]=>
+ NULL
+ ["Hello World!"]=>
+ NULL
+ ["Resource id #%d"]=>
+ NULL
+}
+bool(true)
+array(13) {
+ ["0"]=>
+ NULL
+ ["1"]=>
+ NULL
+ ["12345"]=>
+ NULL
+ ["-2345"]=>
+ NULL
+ ["10.5"]=>
+ NULL
+ ["-10.5"]=>
+ NULL
+ ["123456789000"]=>
+ NULL
+ ["1.23456789E-9"]=>
+ NULL
+ ["0.5"]=>
+ NULL
+ [""]=>
+ NULL
+ ["Nothing"]=>
+ NULL
+ ["Hello World!"]=>
+ NULL
+ ["Resource id #%d"]=>
+ NULL
+}
+Done
+
diff --git a/ext/session/tests/session_register_variation2.phpt b/ext/session/tests/session_register_variation2.phpt
new file mode 100644
index 000000000..11189c597
--- /dev/null
+++ b/ext/session/tests/session_register_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test session_register() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_register(mixed $name [,mixed $...])
+ * Description : Register one or more global variables with the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_register() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_register());
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_register() : variation ***
+bool(true)
+array(0) {
+}
+bool(false)
+array(0) {
+}
+bool(true)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_register_variation3.phpt b/ext/session/tests/session_register_variation3.phpt
new file mode 100644
index 000000000..7051dea93
--- /dev/null
+++ b/ext/session/tests/session_register_variation3.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test session_register() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_register(mixed $name [,mixed $...])
+ * Description : Register one or more global variables with the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_register() : variation ***\n";
+
+$blah = "Hello World!";
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_register("blah"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_register() : variation ***
+bool(true)
+array(0) {
+}
+bool(true)
+array(1) {
+ ["blah"]=>
+ NULL
+}
+bool(true)
+array(1) {
+ ["blah"]=>
+ NULL
+}
+Done
+
diff --git a/ext/session/tests/session_register_variation4.phpt b/ext/session/tests/session_register_variation4.phpt
new file mode 100644
index 000000000..384133ee6
--- /dev/null
+++ b/ext/session/tests/session_register_variation4.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test session_register() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_register(mixed $name [,mixed $...])
+ * Description : Register one or more global variables with the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_register() : variation ***\n";
+
+$blah = "Hello World!";
+$foo = &$blah;
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_register("foo"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_register() : variation ***
+bool(true)
+array(0) {
+}
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+bool(true)
+array(1) {
+ ["foo"]=>
+ NULL
+}
+Done
+
diff --git a/ext/session/tests/session_save_path_basic.phpt b/ext/session/tests/session_save_path_basic.phpt
new file mode 100644
index 000000000..2895f46c0
--- /dev/null
+++ b/ext/session/tests/session_save_path_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test session_save_path() function : basic functionality
+--INI--
+session.gc_probability=0
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_save_path([string $path])
+ * Description : Get and/or set the current session save path
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_save_path() : error functionality ***\n";
+
+$directory = dirname(__FILE__);
+var_dump(session_save_path());
+var_dump(session_save_path($directory));
+var_dump(session_save_path());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_save_path() : error functionality ***
+string(0) ""
+string(0) ""
+string(%d) "%s"
+Done
+
diff --git a/ext/session/tests/session_save_path_error.phpt b/ext/session/tests/session_save_path_error.phpt
new file mode 100644
index 000000000..b58e73133
--- /dev/null
+++ b/ext/session/tests/session_save_path_error.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test session_save_path() function : error functionality
+--INI--
+session.gc_probability=0
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_save_path([string $path])
+ * Description : Get and/or set the current session save path
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_save_path() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+session_start();
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_save_path($input));
+ $iterator++;
+};
+
+session_destroy();
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_save_path() : error functionality ***
+
+-- Iteration 1 --
+string(0) ""
+
+-- Iteration 2 --
+string(1) "0"
+
+-- Iteration 3 --
+string(1) "1"
+
+-- Iteration 4 --
+string(5) "12345"
+
+-- Iteration 5 --
+string(5) "-2345"
+
+-- Iteration 6 --
+string(4) "10.5"
+
+-- Iteration 7 --
+string(5) "-10.5"
+
+-- Iteration 8 --
+string(12) "123456789000"
+
+-- Iteration 9 --
+string(13) "1.23456789E-9"
+
+-- Iteration 10 --
+string(3) "0.5"
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(0) ""
+
+-- Iteration 13 --
+string(1) "1"
+
+-- Iteration 14 --
+string(0) ""
+
+-- Iteration 15 --
+string(1) "1"
+
+-- Iteration 16 --
+string(0) ""
+
+-- Iteration 17 --
+string(0) ""
+
+-- Iteration 18 --
+string(0) ""
+
+-- Iteration 19 --
+string(7) "Nothing"
+
+-- Iteration 20 --
+string(7) "Nothing"
+
+-- Iteration 21 --
+string(12) "Hello World!"
+
+-- Iteration 22 --
+string(12) "Hello World!"
+
+-- Iteration 23 --
+string(0) ""
+
+-- Iteration 24 --
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_save_path_variation1.phpt b/ext/session/tests/session_save_path_variation1.phpt
new file mode 100644
index 000000000..d5f64d985
--- /dev/null
+++ b/ext/session/tests/session_save_path_variation1.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test session_save_path() function : variation
+--INI--
+session.gc_probability=0
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_save_path([string $path])
+ * Description : Get and/or set the current session save path
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_save_path() : variation ***\n";
+
+$directory = dirname(__FILE__);
+var_dump(session_save_path());
+var_dump(session_start());
+var_dump(session_save_path());
+var_dump(session_save_path($directory));
+var_dump(session_save_path());
+var_dump(session_destroy());
+var_dump(session_save_path());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_save_path() : variation ***
+string(0) ""
+bool(true)
+string(0) ""
+string(0) ""
+string(%d) "%s"
+bool(true)
+string(%d) "%s"
+Done
+
diff --git a/ext/session/tests/session_save_path_variation2.phpt b/ext/session/tests/session_save_path_variation2.phpt
new file mode 100644
index 000000000..6b0848031
--- /dev/null
+++ b/ext/session/tests/session_save_path_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test session_save_path() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.save_handler=files
+session.gc_probability=0
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_save_path([string $path])
+ * Description : Get and/or set the current session save path
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_save_path() : variation ***\n";
+
+ini_set("session.save_path", "/blah");
+var_dump(ini_get("session.save_path"));
+var_dump(session_start());
+var_dump(ini_get("session.save_path"));
+var_dump(session_destroy());
+var_dump(ini_get("session.save_path"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_save_path() : variation ***
+string(5) "/blah"
+
+Warning: session_start(): open(%s, O_RDWR) failed: No such file or directory (2) in %s on line %d
+bool(true)
+string(5) "/blah"
+bool(true)
+string(5) "/blah"
+Done
diff --git a/ext/session/tests/session_save_path_variation3.phpt b/ext/session/tests/session_save_path_variation3.phpt
new file mode 100644
index 000000000..b064f3018
--- /dev/null
+++ b/ext/session/tests/session_save_path_variation3.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test session_save_path() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.save_handler=files
+session.gc_probability=0
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_save_path([string $path])
+ * Description : Get and/or set the current session save path
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_save_path() : variation ***\n";
+
+ini_set("session.save_path", "/blah");
+var_dump(session_save_path());
+var_dump(session_start());
+var_dump(session_save_path());
+var_dump(session_destroy());
+var_dump(session_save_path());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_save_path() : variation ***
+string(5) "/blah"
+
+Warning: session_start(): open(%s, O_RDWR) failed: No such file or directory (2) in %s on line %d
+bool(true)
+string(5) "/blah"
+bool(true)
+string(5) "/blah"
+Done
diff --git a/ext/session/tests/session_save_path_variation4.phpt b/ext/session/tests/session_save_path_variation4.phpt
new file mode 100644
index 000000000..453645d31
--- /dev/null
+++ b/ext/session/tests/session_save_path_variation4.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test session_save_path() function : variation
+--SKIPIF--
+<?php include('skipif.inc');
+if(substr(PHP_OS, 0, 3) != "WIN")
+ die("skip Only for Windows");
+?>
+--INI--
+open_basedir=.
+session.save_handler=files
+session.save_path=
+session.name=PHPSESSID
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_save_path([string $path])
+ * Description : Get and/or set the current session save path
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_save_path() : variation ***\n";
+$directory = dirname(__FILE__);
+$sessions = ($directory."/sessions");
+
+chdir($directory);
+
+// Delete the existing directory
+if (file_exists($sessions) === TRUE) {
+ @rmdir($sessions);
+}
+
+var_dump(mkdir($sessions));
+var_dump(chdir($sessions));
+ini_set("session.save_path", $directory);
+var_dump(session_save_path());
+var_dump(session_start());
+var_dump(session_save_path());
+var_dump(session_destroy());
+var_dump(session_save_path());
+var_dump(rmdir($sessions));
+
+echo "Done";
+ob_end_flush();
+?>
+--CLEAN--
+$directory = dirname(__FILE__);
+$sessions = ($directory."/sessions");
+var_dump(rmdir($sessions));
+--EXPECTF--
+*** Testing session_save_path() : variation ***
+bool(true)
+bool(true)
+
+Warning: ini_set(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
+string(0) ""
+
+Warning: session_start(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
+
+Fatal error: session_start(): Failed to initialize storage module: files (path: ) in %s on line %d
+
diff --git a/ext/session/tests/session_save_path_variation5.phpt b/ext/session/tests/session_save_path_variation5.phpt
new file mode 100644
index 000000000..4f1f98892
--- /dev/null
+++ b/ext/session/tests/session_save_path_variation5.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test session_save_path() function : variation
+--SKIPIF--
+<?php include('skipif.inc');
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die("skip Not for Windows");
+?>
+--INI--
+open_basedir=.
+session.save_handler=files
+session.save_path=
+session.name=PHPSESSID
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_save_path([string $path])
+ * Description : Get and/or set the current session save path
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_save_path() : variation ***\n";
+$directory = dirname(__FILE__);
+$sessions = ($directory."/sessions");
+
+chdir($directory);
+
+// Delete the existing directory
+if (file_exists($sessions) === TRUE) {
+ @rmdir($sessions);
+}
+
+var_dump(mkdir($sessions));
+var_dump(chdir($sessions));
+ini_set("session.save_path", $directory);
+var_dump(session_save_path());
+var_dump(session_start());
+var_dump(session_save_path());
+var_dump(session_destroy());
+var_dump(session_save_path());
+var_dump(rmdir($sessions));
+
+echo "Done";
+ob_end_flush();
+?>
+--CLEAN--
+$directory = dirname(__FILE__);
+$sessions = ($directory."/sessions");
+var_dump(rmdir($sessions));
+--EXPECTF--
+*** Testing session_save_path() : variation ***
+bool(true)
+bool(true)
+
+Warning: ini_set(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
+string(0) ""
+bool(true)
+string(0) ""
+bool(true)
+string(0) ""
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_set_cookie_params_basic.phpt b/ext/session/tests/session_set_cookie_params_basic.phpt
new file mode 100644
index 000000000..5055d1c69
--- /dev/null
+++ b/ext/session/tests/session_set_cookie_params_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test session_set_cookie_params() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
+ * Description : Set the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_cookie_params() : basic functionality ***\n";
+
+var_dump(session_set_cookie_params(3600));
+var_dump(session_start());
+var_dump(session_set_cookie_params(1800));
+var_dump(session_destroy());
+var_dump(session_set_cookie_params(1234567890));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_cookie_params() : basic functionality ***
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+Done
+
diff --git a/ext/session/tests/session_set_cookie_params_error.phpt b/ext/session/tests/session_set_cookie_params_error.phpt
new file mode 100644
index 000000000..389387f6a
--- /dev/null
+++ b/ext/session/tests/session_set_cookie_params_error.phpt
@@ -0,0 +1,298 @@
+--TEST--
+Test session_set_cookie_params() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
+ * Description : Set the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_cookie_params() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_set_cookie_params($input));
+ var_dump(session_set_cookie_params(1234567890, $input));
+ var_dump(session_set_cookie_params(1234567890, "blah", $input));
+ var_dump(session_set_cookie_params(1234567890, "blah", "foo", $input));
+ var_dump(session_set_cookie_params(1234567890, "blah", "foo", TRUE, $input));
+ var_dump(session_set_cookie_params(1234567890, "blah", "foo", TRUE, FALSE));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_cookie_params() : error functionality ***
+
+-- Iteration 1 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 2 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 3 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 4 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 5 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 6 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 7 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 8 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 9 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 10 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 11 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 12 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 13 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 14 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 15 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 16 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 17 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 18 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 19 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 20 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 21 --
+NULL
+NULL
+NULL
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+NULL
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+NULL
+NULL
+
+-- Iteration 22 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 23 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+-- Iteration 24 --
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+Done
+
diff --git a/ext/session/tests/session_set_cookie_params_variation1.phpt b/ext/session/tests/session_set_cookie_params_variation1.phpt
new file mode 100644
index 000000000..02b901f3c
--- /dev/null
+++ b/ext/session/tests/session_set_cookie_params_variation1.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test session_set_cookie_params() function : variation
+--INI--
+session.cookie_lifetime=3600
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
+ * Description : Set the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_cookie_params() : variation ***\n";
+
+var_dump(ini_get("session.cookie_lifetime"));
+var_dump(session_set_cookie_params(3600));
+var_dump(ini_get("session.cookie_lifetime"));
+var_dump(session_start());
+var_dump(ini_get("session.cookie_lifetime"));
+var_dump(session_set_cookie_params(1800));
+var_dump(ini_get("session.cookie_lifetime"));
+var_dump(session_destroy());
+var_dump(ini_get("session.cookie_lifetime"));
+var_dump(session_set_cookie_params(1234567890));
+var_dump(ini_get("session.cookie_lifetime"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_cookie_params() : variation ***
+string(4) "3600"
+NULL
+string(4) "3600"
+bool(true)
+string(4) "3600"
+NULL
+string(4) "1800"
+bool(true)
+string(4) "1800"
+NULL
+string(10) "1234567890"
+Done
+
diff --git a/ext/session/tests/session_set_cookie_params_variation2.phpt b/ext/session/tests/session_set_cookie_params_variation2.phpt
new file mode 100644
index 000000000..5d7a01096
--- /dev/null
+++ b/ext/session/tests/session_set_cookie_params_variation2.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test session_set_cookie_params() function : variation
+--INI--
+session.cookie_path=/path
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
+ * Description : Set the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_cookie_params() : variation ***\n";
+
+var_dump(ini_get("session.cookie_path"));
+var_dump(session_set_cookie_params(3600, "/foo"));
+var_dump(ini_get("session.cookie_path"));
+var_dump(session_start());
+var_dump(ini_get("session.cookie_path"));
+var_dump(session_set_cookie_params(3600, "/blah"));
+var_dump(ini_get("session.cookie_path"));
+var_dump(session_destroy());
+var_dump(ini_get("session.cookie_path"));
+var_dump(session_set_cookie_params(3600, "/guff"));
+var_dump(ini_get("session.cookie_path"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_cookie_params() : variation ***
+string(5) "/path"
+NULL
+string(4) "/foo"
+bool(true)
+string(4) "/foo"
+NULL
+string(5) "/blah"
+bool(true)
+string(5) "/blah"
+NULL
+string(5) "/guff"
+Done
+
diff --git a/ext/session/tests/session_set_cookie_params_variation3.phpt b/ext/session/tests/session_set_cookie_params_variation3.phpt
new file mode 100644
index 000000000..5e8f0ff57
--- /dev/null
+++ b/ext/session/tests/session_set_cookie_params_variation3.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test session_set_cookie_params() function : variation
+--INI--
+session.cookie_domain=foo
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
+ * Description : Set the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_cookie_params() : variation ***\n";
+
+var_dump(ini_get("session.cookie_domain"));
+var_dump(session_set_cookie_params(3600, "/path", "blah"));
+var_dump(ini_get("session.cookie_domain"));
+var_dump(session_start());
+var_dump(ini_get("session.cookie_domain"));
+var_dump(session_set_cookie_params(3600, "/path", "guff"));
+var_dump(ini_get("session.cookie_domain"));
+var_dump(session_destroy());
+var_dump(ini_get("session.cookie_domain"));
+var_dump(session_set_cookie_params(3600, "/path", "foo"));
+var_dump(ini_get("session.cookie_domain"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_cookie_params() : variation ***
+string(3) "foo"
+NULL
+string(4) "blah"
+bool(true)
+string(4) "blah"
+NULL
+string(4) "guff"
+bool(true)
+string(4) "guff"
+NULL
+string(3) "foo"
+Done
+
diff --git a/ext/session/tests/session_set_cookie_params_variation4.phpt b/ext/session/tests/session_set_cookie_params_variation4.phpt
new file mode 100644
index 000000000..7b825968f
--- /dev/null
+++ b/ext/session/tests/session_set_cookie_params_variation4.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test session_set_cookie_params() function : variation
+--INI--
+session.cookie_secure=TRUE
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
+ * Description : Set the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_cookie_params() : variation ***\n";
+
+var_dump(ini_get("session.cookie_secure"));
+var_dump(session_set_cookie_params(3600, "/path", "blah", FALSE));
+var_dump(ini_get("session.cookie_secure"));
+var_dump(session_start());
+var_dump(ini_get("session.cookie_secure"));
+var_dump(session_set_cookie_params(3600, "/path", "blah", TRUE));
+var_dump(ini_get("session.cookie_secure"));
+var_dump(session_destroy());
+var_dump(ini_get("session.cookie_secure"));
+var_dump(session_set_cookie_params(3600, "/path", "blah", FALSE));
+var_dump(ini_get("session.cookie_secure"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_cookie_params() : variation ***
+string(1) "1"
+NULL
+string(1) "0"
+bool(true)
+string(1) "0"
+NULL
+string(1) "1"
+bool(true)
+string(1) "1"
+NULL
+string(1) "0"
+Done
+
diff --git a/ext/session/tests/session_set_cookie_params_variation5.phpt b/ext/session/tests/session_set_cookie_params_variation5.phpt
new file mode 100644
index 000000000..29559f7fd
--- /dev/null
+++ b/ext/session/tests/session_set_cookie_params_variation5.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test session_set_cookie_params() function : variation
+--INI--
+session.cookie_httponly=TRUE
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
+ * Description : Set the session cookie parameters
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_cookie_params() : variation ***\n";
+
+var_dump(ini_get("session.cookie_httponly"));
+var_dump(session_set_cookie_params(3600, "/path", "blah", FALSE, FALSE));
+var_dump(ini_get("session.cookie_httponly"));
+var_dump(session_start());
+var_dump(ini_get("session.cookie_httponly"));
+var_dump(session_set_cookie_params(3600, "/path", "blah", FALSE, TRUE));
+var_dump(ini_get("session.cookie_httponly"));
+var_dump(session_destroy());
+var_dump(ini_get("session.cookie_httponly"));
+var_dump(session_set_cookie_params(3600, "/path", "blah", FALSE, FALSE));
+var_dump(ini_get("session.cookie_httponly"));
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_cookie_params() : variation ***
+string(1) "1"
+NULL
+string(1) "0"
+bool(true)
+string(1) "0"
+NULL
+string(1) "1"
+bool(true)
+string(1) "1"
+NULL
+string(1) "0"
+Done
+
diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt
new file mode 100644
index 000000000..3897ba9a9
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_basic.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test session_set_save_handler() function : basic functionality
+--INI--
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : basic functionality ***\n";
+
+require_once "save_handler.inc";
+var_dump(session_module_name());
+var_dump(session_module_name(FALSE));
+var_dump(session_module_name("blah"));
+var_dump(session_module_name("foo"));
+
+$path = dirname(__FILE__);
+session_save_path($path);
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+
+session_start();
+$_SESSION["Blah"] = "Hello World!";
+$_SESSION["Foo"] = FALSE;
+$_SESSION["Guff"] = 1234567890;
+var_dump($_SESSION);
+
+session_write_close();
+session_unset();
+var_dump($_SESSION);
+
+echo "Starting session again..!\n";
+session_id($session_id);
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+session_start();
+var_dump($_SESSION);
+session_write_close();
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : basic functionality ***
+
+string(%d) "%s"
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+
+Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
+bool(false)
+
+Warning: session_module_name(): Cannot find named PHP session module (foo) in %s on line %d
+bool(false)
+Open [%s,PHPSESSID]
+Read [%s,%s]
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
+Close [%s,PHPSESSID]
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+Starting session again..!
+Open [%s,PHPSESSID]
+Read [%s,%s]
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
+Close [%s,PHPSESSID]
diff --git a/ext/session/tests/session_set_save_handler_error.phpt b/ext/session/tests/session_set_save_handler_error.phpt
new file mode 100644
index 000000000..bf9d25de5
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_error.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test session_set_save_handler() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_set_save_handler($input, NULL, NULL, NULL, NULL, NULL));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : error functionality ***
+
+-- Iteration 1 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: session_set_save_handler(): Argument 1 is not a valid callback in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_set_save_handler_error2.phpt b/ext/session/tests/session_set_save_handler_error2.phpt
new file mode 100644
index 000000000..03ba3b04d
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_error2.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test session_set_save_handler() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : error functionality ***\n";
+
+function open($save_path, $session_name) { return true; }
+function close() { return true; }
+function read($id) { return false; }
+function write($id, $session_data) { }
+function destroy($id) { return true; }
+function gc($maxlifetime) { return true; }
+
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+
+session_start();
+$_SESSION["Blah"] = "Hello World!";
+$_SESSION["Foo"] = FALSE;
+$_SESSION["Guff"] = 1234567890;
+var_dump($_SESSION);
+
+session_write_close();
+var_dump($_SESSION);
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+session_start();
+var_dump($_SESSION);
+session_destroy();
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : error functionality ***
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+array(0) {
+}
+
diff --git a/ext/session/tests/session_set_save_handler_error3.phpt b/ext/session/tests/session_set_save_handler_error3.phpt
new file mode 100644
index 000000000..446ef7b75
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_error3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test session_set_save_handler() function : error functionality
+--INI--
+session.save_path=
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : error functionality ***\n";
+function open($save_path, $session_name) {
+ throw new Exception("Do something bad..!");
+}
+
+function close() { return true; }
+function read($id) { return false; }
+function write($id, $session_data) { }
+function destroy($id) { return true; }
+function gc($maxlifetime) { return true; }
+
+session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
+session_start();
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : error functionality ***
+
+Fatal error: Uncaught exception 'Exception' with message 'Do something bad..!' in %s:%d
+Stack trace:
+#0 [internal function]: open('', 'PHPSESSID')
+#1 %s(%d): session_start()
+#2 {main}
+ thrown in %s on line %d
+
diff --git a/ext/session/tests/session_set_save_handler_error4.phpt b/ext/session/tests/session_set_save_handler_error4.phpt
new file mode 100644
index 000000000..4debde5b0
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_error4.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test session_set_save_handler() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : error functionality ***\n";
+
+function callback() { }
+
+session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
+session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback");
+session_set_save_handler("callback", "callback", "echo", "callback", "callback", "callback");
+session_set_save_handler("callback", "callback", "callback", "echo", "callback", "callback");
+session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback");
+session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo");
+session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
+session_start();
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : error functionality ***
+
+Warning: session_set_save_handler(): Argument 2 is not a valid callback in %s on line %d
+
+Warning: session_set_save_handler(): Argument 3 is not a valid callback in %s on line %d
+
+Warning: session_set_save_handler(): Argument 4 is not a valid callback in %s on line %d
+
+Warning: session_set_save_handler(): Argument 5 is not a valid callback in %s on line %d
+
+Warning: session_set_save_handler(): Argument 6 is not a valid callback in %s on line %d
+
diff --git a/ext/session/tests/session_set_save_handler_variation1.phpt b/ext/session/tests/session_set_save_handler_variation1.phpt
new file mode 100644
index 000000000..fe1d2b0b5
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_variation1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test session_set_save_handler() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : variation ***\n";
+
+var_dump(session_module_name());
+var_dump(session_module_name(FALSE));
+var_dump(session_module_name());
+var_dump(session_module_name("blah"));
+var_dump(session_module_name());
+var_dump(session_module_name("files"));
+var_dump(session_module_name());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : variation ***
+string(%d) "%s"
+
+Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
+bool(false)
+string(%d) "%s"
+
+Warning: session_module_name(): Cannot find named PHP session module (blah) in %s on line %d
+bool(false)
+string(%d) "%s"
+string(%d) "%s"
+string(5) "files"
diff --git a/ext/session/tests/session_set_save_handler_variation2.phpt b/ext/session/tests/session_set_save_handler_variation2.phpt
new file mode 100644
index 000000000..1c019bb5a
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_variation2.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test session_set_save_handler() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : variation ***\n";
+
+require_once "save_handler.inc";
+$path = dirname(__FILE__);
+session_save_path($path);
+var_dump(session_start());
+var_dump(session_set_save_handler("open", "close", "read", "write", "destroy", "gc"));
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : variation ***
+
+bool(true)
+bool(false)
+bool(true)
+
diff --git a/ext/session/tests/session_set_save_handler_variation3.phpt b/ext/session/tests/session_set_save_handler_variation3.phpt
new file mode 100644
index 000000000..774d0db48
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_variation3.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test session_set_save_handler() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.auto_start=1
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : variation ***\n";
+
+require_once "save_handler.inc";
+$path = dirname(__FILE__);
+session_save_path($path);
+var_dump(session_set_save_handler("open", "close", "read", "write", "destroy", "gc"));
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : variation ***
+
+bool(false)
+bool(true)
+
diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt
new file mode 100644
index 000000000..3485f2373
--- /dev/null
+++ b/ext/session/tests/session_set_save_handler_variation4.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test session_set_save_handler() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.gc_probability=1
+session.gc_divisor=1
+session.gc_maxlifetime=0
+session.save_path=
+session.name=PHPSESSID
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
+ * Description : Sets user-level session storage functions
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_set_save_handler() : variation ***\n";
+
+function noisy_gc($maxlifetime) {
+ echo("GC [".$maxlifetime."]\n");
+ gc($maxlifetime);
+}
+
+require_once "save_handler.inc";
+$path = dirname(__FILE__);
+session_save_path($path);
+session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc");
+
+session_start();
+$_SESSION["Blah"] = "Hello World!";
+$_SESSION["Foo"] = FALSE;
+$_SESSION["Guff"] = 1234567890;
+var_dump($_SESSION);
+$session_id = session_id();
+var_dump(session_write_close());
+
+session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc");
+session_id($session_id);
+session_start();
+var_dump($_SESSION);
+var_dump(session_destroy());
+
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_set_save_handler() : variation ***
+
+Open [%s,PHPSESSID]
+Read [%s,%s]
+GC [0]
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
+Close [%s,PHPSESSID]
+NULL
+Open [%s,PHPSESSID]
+Read [%s,%s]
+GC [0]
+array(3) {
+ ["Blah"]=>
+ string(12) "Hello World!"
+ ["Foo"]=>
+ bool(false)
+ ["Guff"]=>
+ int(1234567890)
+}
+Destroy [%s,%s]
+
+Warning: unlink(%s): No such file or directory in %s on line %d
+Close [%s,PHPSESSID]
+bool(true)
+
diff --git a/ext/session/tests/session_start_error.phpt b/ext/session/tests/session_start_error.phpt
new file mode 100644
index 000000000..8cbf42c86
--- /dev/null
+++ b/ext/session/tests/session_start_error.phpt
@@ -0,0 +1,195 @@
+--TEST--
+Test session_start() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_start($input));
+ var_dump(session_destroy());
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : error functionality ***
+
+-- Iteration 1 --
+bool(true)
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+bool(true)
+
+-- Iteration 11 --
+bool(true)
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+bool(true)
+
+-- Iteration 22 --
+bool(true)
+bool(true)
+
+-- Iteration 23 --
+bool(true)
+bool(true)
+
+-- Iteration 24 --
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_start_variation1.phpt b/ext/session/tests/session_start_variation1.phpt
new file mode 100644
index 000000000..1c8f3eb3b
--- /dev/null
+++ b/ext/session/tests/session_start_variation1.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_start());
+var_dump(session_start());
+var_dump(session_start());
+var_dump(session_start());
+
+session_destroy();
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+bool(true)
+
+Notice: A session had already been started - ignoring session_start() in %s on line %d
+bool(true)
+
+Notice: A session had already been started - ignoring session_start() in %s on line %d
+bool(true)
+
+Notice: A session had already been started - ignoring session_start() in %s on line %d
+bool(true)
+
+Notice: A session had already been started - ignoring session_start() in %s on line %d
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_start_variation2.phpt b/ext/session/tests/session_start_variation2.phpt
new file mode 100644
index 000000000..6c9b29e3e
--- /dev/null
+++ b/ext/session/tests/session_start_variation2.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_start_variation3.phpt b/ext/session/tests/session_start_variation3.phpt
new file mode 100644
index 000000000..e87f84bce
--- /dev/null
+++ b/ext/session/tests/session_start_variation3.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_write_close());
+var_dump(session_start());
+var_dump(session_write_close());
+var_dump(session_start());
+var_dump(session_write_close());
+var_dump(session_start());
+var_dump(session_write_close());
+var_dump(session_start());
+var_dump(session_write_close());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+
+Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_start_variation4.phpt b/ext/session/tests/session_start_variation4.phpt
new file mode 100644
index 000000000..42895493a
--- /dev/null
+++ b/ext/session/tests/session_start_variation4.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+$_SESSION['blah'] = 'foo';
+var_dump($_SESSION);
+session_start();
+var_dump($_SESSION);
+
+session_destroy();
+echo "Done";
+ob_end_flush();
+
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+array(1) {
+ ["blah"]=>
+ string(3) "foo"
+}
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_start_variation5.phpt b/ext/session/tests/session_start_variation5.phpt
new file mode 100644
index 000000000..4dcafac33
--- /dev/null
+++ b/ext/session/tests/session_start_variation5.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+session_start();
+
+$_SESSION['colour'] = 'green';
+$_SESSION['animal'] = 'cat';
+$_SESSION['person'] = 'julia';
+$_SESSION['age'] = 6;
+
+var_dump($_SESSION);
+var_dump(session_write_close());
+var_dump($_SESSION);
+
+session_start();
+session_destroy();
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+array(4) {
+ ["colour"]=>
+ string(5) "green"
+ ["animal"]=>
+ string(3) "cat"
+ ["person"]=>
+ string(5) "julia"
+ ["age"]=>
+ int(6)
+}
+NULL
+array(4) {
+ ["colour"]=>
+ string(5) "green"
+ ["animal"]=>
+ string(3) "cat"
+ ["person"]=>
+ string(5) "julia"
+ ["age"]=>
+ int(6)
+}
+Done
+
diff --git a/ext/session/tests/session_start_variation6.phpt b/ext/session/tests/session_start_variation6.phpt
new file mode 100644
index 000000000..378554bbe
--- /dev/null
+++ b/ext/session/tests/session_start_variation6.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+session_start();
+
+$_SESSION['colour'] = 'green';
+$_SESSION['animal'] = 'cat';
+$_SESSION['person'] = 'julia';
+$_SESSION['age'] = 6;
+
+var_dump($_SESSION);
+var_dump(session_write_close());
+var_dump($_SESSION);
+session_start();
+var_dump($_SESSION);
+
+session_destroy();
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+array(4) {
+ ["colour"]=>
+ string(5) "green"
+ ["animal"]=>
+ string(3) "cat"
+ ["person"]=>
+ string(5) "julia"
+ ["age"]=>
+ int(6)
+}
+NULL
+array(4) {
+ ["colour"]=>
+ string(5) "green"
+ ["animal"]=>
+ string(3) "cat"
+ ["person"]=>
+ string(5) "julia"
+ ["age"]=>
+ int(6)
+}
+array(4) {
+ ["colour"]=>
+ string(5) "green"
+ ["animal"]=>
+ string(3) "cat"
+ ["person"]=>
+ string(5) "julia"
+ ["age"]=>
+ int(6)
+}
+Done
+
diff --git a/ext/session/tests/session_start_variation7.phpt b/ext/session/tests/session_start_variation7.phpt
new file mode 100644
index 000000000..be079f335
--- /dev/null
+++ b/ext/session/tests/session_start_variation7.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+session_start();
+
+$_SESSION['colour'] = 'green';
+$_SESSION['animal'] = 'cat';
+$_SESSION['person'] = 'julia';
+$_SESSION['age'] = 6;
+
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+session_start();
+var_dump($_SESSION);
+
+session_destroy();
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+array(4) {
+ ["colour"]=>
+ string(5) "green"
+ ["animal"]=>
+ string(3) "cat"
+ ["person"]=>
+ string(5) "julia"
+ ["age"]=>
+ int(6)
+}
+bool(true)
+array(4) {
+ ["colour"]=>
+ string(5) "green"
+ ["animal"]=>
+ string(3) "cat"
+ ["person"]=>
+ string(5) "julia"
+ ["age"]=>
+ int(6)
+}
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_start_variation8.phpt b/ext/session/tests/session_start_variation8.phpt
new file mode 100644
index 000000000..936547527
--- /dev/null
+++ b/ext/session/tests/session_start_variation8.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_id());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+string(0) ""
+bool(true)
+string(%d) "%s"
+bool(true)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_start_variation9.phpt b/ext/session/tests/session_start_variation9.phpt
new file mode 100644
index 000000000..21523e065
--- /dev/null
+++ b/ext/session/tests/session_start_variation9.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.auto_start=1
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_start(void)
+ * Description : Initialize session data
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_start() : variation ***\n";
+
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_destroy());
+var_dump(session_id());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_start() : variation ***
+string(%d) "%s"
+
+Notice: A session had already been started - ignoring session_start() in %s on line %d
+bool(true)
+string(%d) "%s"
+bool(true)
+string(0) ""
+Done
+
diff --git a/ext/session/tests/session_unregister_basic.phpt b/ext/session/tests/session_unregister_basic.phpt
new file mode 100644
index 000000000..8ce512693
--- /dev/null
+++ b/ext/session/tests/session_unregister_basic.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test session_unregister() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_unregister(string $name)
+ * Description : Unregister a global variable from the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_unregister() : basic functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+var_dump(session_start());
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_unregister($input));
+ $iterator++;
+};
+
+var_dump(session_destroy());
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_unregister() : basic functionality ***
+bool(true)
+
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+bool(true)
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(true)
+
+-- Iteration 23 --
+bool(true)
+
+-- Iteration 24 --
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_unregister_variation1.phpt b/ext/session/tests/session_unregister_variation1.phpt
new file mode 100644
index 000000000..f6de13ed9
--- /dev/null
+++ b/ext/session/tests/session_unregister_variation1.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test session_unregister() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_unregister(string $name)
+ * Description : Unregister a global variable from the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_unregister() : variation ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_register($inputs));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_unregister() : variation ***
+bool(true)
+array(0) {
+}
+bool(true)
+array(13) {
+ ["0"]=>
+ NULL
+ ["1"]=>
+ NULL
+ ["12345"]=>
+ NULL
+ ["-2345"]=>
+ NULL
+ ["10.5"]=>
+ NULL
+ ["-10.5"]=>
+ NULL
+ ["123456789000"]=>
+ NULL
+ ["1.23456789E-9"]=>
+ NULL
+ ["0.5"]=>
+ NULL
+ [""]=>
+ NULL
+ ["Nothing"]=>
+ NULL
+ ["Hello World!"]=>
+ NULL
+ ["Resource id #%d"]=>
+ NULL
+}
+bool(true)
+array(13) {
+ ["0"]=>
+ NULL
+ ["1"]=>
+ NULL
+ ["12345"]=>
+ NULL
+ ["-2345"]=>
+ NULL
+ ["10.5"]=>
+ NULL
+ ["-10.5"]=>
+ NULL
+ ["123456789000"]=>
+ NULL
+ ["1.23456789E-9"]=>
+ NULL
+ ["0.5"]=>
+ NULL
+ [""]=>
+ NULL
+ ["Nothing"]=>
+ NULL
+ ["Hello World!"]=>
+ NULL
+ ["Resource id #%d"]=>
+ NULL
+}
+Done
+
diff --git a/ext/session/tests/session_unregister_variation2.phpt b/ext/session/tests/session_unregister_variation2.phpt
new file mode 100644
index 000000000..cd5778877
--- /dev/null
+++ b/ext/session/tests/session_unregister_variation2.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test session_unregister() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_unregister(string $name)
+ * Description : Unregister a global variable from the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_unregister() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+$_SESSION["foo"] = "Hello World!";
+var_dump($_SESSION);
+var_dump(session_unregister("foo"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_unregister() : variation ***
+bool(true)
+array(0) {
+}
+array(1) {
+ ["foo"]=>
+ string(12) "Hello World!"
+}
+bool(true)
+array(0) {
+}
+bool(true)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_unregister_variation3.phpt b/ext/session/tests/session_unregister_variation3.phpt
new file mode 100644
index 000000000..97609266d
--- /dev/null
+++ b/ext/session/tests/session_unregister_variation3.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test session_unregister() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_unregister(string $name)
+ * Description : Unregister a global variable from the current session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_unregister() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+$blah = "Hello World!";
+$_SESSION["foo"] = &$blah;
+var_dump($_SESSION);
+var_dump(session_unregister("foo"));
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_unregister() : variation ***
+bool(true)
+array(0) {
+}
+array(1) {
+ ["foo"]=>
+ &string(12) "Hello World!"
+}
+bool(true)
+array(0) {
+}
+bool(true)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_unset_basic.phpt b/ext/session/tests/session_unset_basic.phpt
new file mode 100644
index 000000000..21b12c4dd
--- /dev/null
+++ b/ext/session/tests/session_unset_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test session_unset() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_unset(void)
+ * Description : Free all session variables
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_unset() : basic functionality ***\n";
+
+var_dump(session_start());
+$_SESSION["foo"] = "Hello World!";
+var_dump($_SESSION);
+var_dump(session_unset());
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_unset() : basic functionality ***
+bool(true)
+array(1) {
+ ["foo"]=>
+ string(12) "Hello World!"
+}
+NULL
+array(0) {
+}
+bool(true)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_unset_error.phpt b/ext/session/tests/session_unset_error.phpt
new file mode 100644
index 000000000..947834550
--- /dev/null
+++ b/ext/session/tests/session_unset_error.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test session_unset() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_unset(void)
+ * Description : Free all session variables
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_unset() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_unset($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_unset() : error functionality ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_unset_variation1.phpt b/ext/session/tests/session_unset_variation1.phpt
new file mode 100644
index 000000000..17ab283a1
--- /dev/null
+++ b/ext/session/tests/session_unset_variation1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test session_unset() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : void session_unset(void)
+ * Description : Free all session variables
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_unset() : variation ***\n";
+
+var_dump(session_unset());
+var_dump(session_start());
+var_dump(session_unset());
+$_SESSION["foo"] = "Hello World!";
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump(session_unset());
+var_dump($_SESSION);
+var_dump(session_unset());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_unset() : variation ***
+bool(false)
+bool(true)
+NULL
+array(1) {
+ ["foo"]=>
+ string(12) "Hello World!"
+}
+bool(true)
+bool(false)
+array(1) {
+ ["foo"]=>
+ string(12) "Hello World!"
+}
+bool(false)
+Done
+
diff --git a/ext/session/tests/session_write_close_basic.phpt b/ext/session/tests/session_write_close_basic.phpt
new file mode 100644
index 000000000..0841afed9
--- /dev/null
+++ b/ext/session/tests/session_write_close_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test session_write_close() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_write_close(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_write_close() : basic functionality ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_write_close());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_destroy());
+var_dump($_SESSION);
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_write_close() : basic functionality ***
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+array(0) {
+}
+bool(true)
+array(0) {
+}
+Done
+
diff --git a/ext/session/tests/session_write_close_error.phpt b/ext/session/tests/session_write_close_error.phpt
new file mode 100644
index 000000000..cbdb55f26
--- /dev/null
+++ b/ext/session/tests/session_write_close_error.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test session_write_close() function : error functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_write_close(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_write_close() : error functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer 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 strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(session_write_close($input));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_write_close() : error functionality ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+NULL
+
+-- Iteration 18 --
+NULL
+
+-- Iteration 19 --
+NULL
+
+-- Iteration 20 --
+NULL
+
+-- Iteration 21 --
+NULL
+
+-- Iteration 22 --
+NULL
+
+-- Iteration 23 --
+NULL
+
+-- Iteration 24 --
+NULL
+Done
+
diff --git a/ext/session/tests/session_write_close_variation1.phpt b/ext/session/tests/session_write_close_variation1.phpt
new file mode 100644
index 000000000..595796dbe
--- /dev/null
+++ b/ext/session/tests/session_write_close_variation1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test session_write_close() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_write_close(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_write_close() : variation ***\n";
+
+var_dump(session_start());
+var_dump(session_write_close());
+var_dump(session_write_close());
+var_dump(session_write_close());
+var_dump(session_write_close());
+var_dump(session_write_close());
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_write_close() : variation ***
+bool(true)
+NULL
+NULL
+NULL
+NULL
+NULL
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_write_close_variation2.phpt b/ext/session/tests/session_write_close_variation2.phpt
new file mode 100644
index 000000000..40871c5cd
--- /dev/null
+++ b/ext/session/tests/session_write_close_variation2.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test session_write_close() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_write_close(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_write_close() : variation ***\n";
+
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_write_close());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_write_close());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump($_SESSION);
+var_dump(session_write_close());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_write_close() : variation ***
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_write_close_variation3.phpt b/ext/session/tests/session_write_close_variation3.phpt
new file mode 100644
index 000000000..0f8061662
--- /dev/null
+++ b/ext/session/tests/session_write_close_variation3.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test session_start() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--INI--
+session.auto_start=1
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_write_close(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_write_close() : variation ***\n";
+
+var_dump($_SESSION);
+var_dump(session_write_close());
+var_dump($_SESSION);
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_write_close() : variation ***
+array(0) {
+}
+NULL
+array(0) {
+}
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_write_close_variation4.phpt b/ext/session/tests/session_write_close_variation4.phpt
new file mode 100644
index 000000000..249c1555c
--- /dev/null
+++ b/ext/session/tests/session_write_close_variation4.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test session_write_close() function : variation
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : bool session_write_close(void)
+ * Description : Write session data and end session
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_write_close() : variation ***\n";
+
+var_dump(session_id("test"));
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_write_close());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_write_close());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_id());
+var_dump(session_write_close());
+var_dump(session_id());
+var_dump(session_start());
+var_dump(session_destroy());
+
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_write_close() : variation ***
+string(0) ""
+bool(true)
+string(4) "test"
+NULL
+string(4) "test"
+bool(true)
+string(4) "test"
+NULL
+string(4) "test"
+bool(true)
+string(4) "test"
+NULL
+string(4) "test"
+bool(true)
+bool(true)
+Done
+
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
index 73c9da6bc..53b27d5c3 100644
--- a/ext/shmop/php_shmop.h
+++ b/ext/shmop/php_shmop.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index c3e60199f..85bd89968 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP version 4 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
| Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
*/
-/* $Id: shmop.c,v 1.31.2.2.2.5 2007/02/24 16:36:56 iliaa Exp $ */
+/* $Id: shmop.c,v 1.31.2.2.2.6 2007/12/31 07:20:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/simplexml/php_simplexml.h b/ext/simplexml/php_simplexml.h
index 52411cb19..34d371c35 100644
--- a/ext/simplexml/php_simplexml.h
+++ b/ext/simplexml/php_simplexml.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_simplexml.h,v 1.20.2.2.2.3 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_simplexml.h,v 1.20.2.2.2.4 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_SIMPLEXML_H
#define PHP_SIMPLEXML_H
diff --git a/ext/simplexml/php_simplexml_exports.h b/ext/simplexml/php_simplexml_exports.h
index 20766b910..9f01afb31 100755
--- a/ext/simplexml/php_simplexml_exports.h
+++ b/ext/simplexml/php_simplexml_exports.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_simplexml_exports.h,v 1.3.2.3.2.1 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_simplexml_exports.h,v 1.3.2.3.2.2 2007/12/31 07:20:10 sebastian Exp $ */
#ifndef PHP_SIMPLEXML_EXPORTS_H
#define PHP_SIMPLEXML_EXPORTS_H
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index a4c7b138e..42020aa9e 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.151.2.22.2.35 2007/07/31 15:40:49 rrichards Exp $ */
+/* $Id: simplexml.c,v 1.151.2.22.2.39 2008/03/20 16:48:45 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -422,19 +422,12 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC)
convert_to_string(value);
/* break missing intentionally */
case IS_STRING:
- if (node->type == XML_ATTRIBUTE_NODE) {
- buffer = xmlEncodeEntitiesReentrant(node->doc, (xmlChar *)Z_STRVAL_P(value));
- buffer_len = xmlStrlen(buffer);
- } else {
- buffer = (xmlChar *)Z_STRVAL_P(value);
- buffer_len = Z_STRLEN_P(value);
- }
+ buffer = xmlEncodeEntitiesReentrant(node->doc, (xmlChar *)Z_STRVAL_P(value));
+ buffer_len = xmlStrlen(buffer);
/* check for NULL buffer in case of memory error in xmlEncodeEntitiesReentrant */
if (buffer) {
xmlNodeSetContentLen(node, buffer, buffer_len);
- if (node->type == XML_ATTRIBUTE_NODE) {
- xmlFree(buffer);
- }
+ xmlFree(buffer);
}
if (value == &value_copy) {
zval_dtor(value);
@@ -1635,6 +1628,13 @@ SXE_METHOD(addAttribute)
localname = xmlSplitQName2((xmlChar *)qname, &prefix);
if (localname == NULL) {
+ if (nsuri_len > 0) {
+ if (prefix != NULL) {
+ xmlFree(prefix);
+ }
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute requires prefix for namespace");
+ return;
+ }
localname = xmlStrdup((xmlChar *)qname);
}
@@ -1733,6 +1733,11 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC)
}
}
+ if (readobj == writeobj) {
+ INIT_PZVAL(writeobj);
+ zval_dtor(readobj);
+ }
+
rv = cast_object(writeobj, type, (char *)contents TSRMLS_CC);
if (contents) {
@@ -2440,7 +2445,7 @@ PHP_MINFO_FUNCTION(simplexml)
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.35 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.39 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
diff --git a/ext/simplexml/tests/bug42369.phpt b/ext/simplexml/tests/bug42369.phpt
new file mode 100644
index 000000000..e5df81460
--- /dev/null
+++ b/ext/simplexml/tests/bug42369.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #42369 (Implicit conversion to string leaks memory)
+--SKIPIF--
+<?php if (!extension_loaded('simplexml')) echo 'skip simplexml extension is not loaded'; >
+--FILE--
+<?php
+ $xml = '<?xml version="1.0" encoding="utf-8"?>';
+ $x = simplexml_load_string($xml . "<q><x>foo</x></q>");
+
+ echo 'explicit conversion' . PHP_EOL;
+ for ($i = 0; $i < 100000; $i++) {
+ md5(strval($x->x));
+ }
+
+ echo 'no conversion' . PHP_EOL;
+ for ($i = 0; $i < 100000; $i++) {
+ md5($x->x);
+ }
+
+ echo 'done' . PHP_EOL;
+?>
+--EXPECT--
+explicit conversion
+no conversion
+done \ No newline at end of file
diff --git a/ext/simplexml/tests/bug43221.phpt b/ext/simplexml/tests/bug43221.phpt
new file mode 100644
index 000000000..6973d091c
--- /dev/null
+++ b/ext/simplexml/tests/bug43221.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #43221 (SimpleXML adding default namespace in addAttribute)
+--FILE--
+<?php
+$xml = simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><root />');
+$n = $xml->addChild("node", "value");
+$n->addAttribute("a", "b");
+$n->addAttribute("c", "d", "http://bar.com");
+$n->addAttribute("foo:e", "f", "http://bar.com");
+print_r($xml->asXml());
+?>
+--EXPECTF--
+Warning: SimpleXMLElement::addAttribute(): Attribute requires prefix for namespace in %sbug43221.php on line %d
+<?xml version="1.0" encoding="utf-8"?>
+<root><node xmlns:foo="http://bar.com" a="b" foo:e="f">value</node></root> \ No newline at end of file
diff --git a/ext/simplexml/tests/bug44478.phpt b/ext/simplexml/tests/bug44478.phpt
new file mode 100644
index 000000000..5c21d75c8
--- /dev/null
+++ b/ext/simplexml/tests/bug44478.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #44478 (Inconsistent behaviour when assigning new nodes)
+--FILE--
+<?php
+$xml_element = new simpleXMLElement('<root></root>');
+$xml_element->node1 = 'a &#38; b';
+print $xml_element->node1."\n";
+$xml_element->node1 = 'a &#38; b';
+print $xml_element->node1."\n";
+$xml_element->addChild('node2','a &#38; b');
+print $xml_element->node2."\n";
+$xml_element->node2 = 'a & b';
+print $xml_element->node2."\n";
+
+print $xml_element->asXML();
+
+?>
+--EXPECTF--
+a &#38; b
+a &#38; b
+a & b
+a & b
+<?xml version="1.0"?>
+<root><node1>a &amp;#38; b</node1><node2>a &amp; b</node2></root>
diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h
index 68ac1fd05..b4a4757f0 100644
--- a/ext/snmp/php_snmp.h
+++ b/ext/snmp/php_snmp.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_snmp.h,v 1.25.2.1.2.2 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_snmp.h,v 1.25.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_SNMP_H
#define PHP_SNMP_H
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 302f009ab..7bbe8f0cb 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: snmp.c,v 1.106.2.2.2.5 2007/07/09 13:42:05 jani Exp $ */
+/* $Id: snmp.c,v 1.106.2.2.2.6 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index d7a8b347c..eac079ac4 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.103.2.21.2.38 2007/10/17 12:08:45 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.21.2.39 2007/12/31 07:20:11 sebastian Exp $ */
#include <time.h>
diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
index f894ffa68..48ae6992d 100644
--- a/ext/soap/php_encoding.h
+++ b/ext/soap/php_encoding.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.h,v 1.38.2.3.2.4 2007/04/02 13:43:08 dmitry Exp $ */
+/* $Id: php_encoding.h,v 1.38.2.3.2.5 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_ENCODING_H
#define PHP_ENCODING_H
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 2776a8e26..19aaa53a5 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.77.2.11.2.13 2007/10/17 11:17:46 dmitry Exp $ */
+/* $Id: php_http.c,v 1.77.2.11.2.15 2008/04/08 14:11:49 jorton Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -33,7 +33,7 @@ static int get_http_headers(php_stream *socketd,char **response, int *out_size T
static int stream_alive(php_stream *stream TSRMLS_DC)
{
- long socket;
+ int socket;
char buf;
/* maybe better to use:
diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
index f4125b85a..5dec5a344 100644
--- a/ext/soap/php_http.h
+++ b/ext/soap/php_http.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.h,v 1.16.2.1.2.1 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_http.h,v 1.16.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_HTTP_H
#define PHP_HTTP_H
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
index de7dbd14c..18e9698c4 100644
--- a/ext/soap/php_packet_soap.c
+++ b/ext/soap/php_packet_soap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_packet_soap.c,v 1.42.2.1.2.4 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_packet_soap.c,v 1.42.2.1.2.5 2007/12/31 07:20:11 sebastian Exp $ */
#include "php_soap.h"
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
index 47167fb61..2a9712eb2 100644
--- a/ext/soap/php_packet_soap.h
+++ b/ext/soap/php_packet_soap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_packet_soap.h,v 1.10.2.1.2.1 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_packet_soap.h,v 1.10.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_PACKET_SOAP_H
#define PHP_PACKET_SOAP_H
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index fb60b08ac..55bc9e66b 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_schema.c,v 1.58.2.6.2.6 2007/08/31 10:48:45 dmitry Exp $ */
+/* $Id: php_schema.c,v 1.58.2.6.2.7 2007/12/31 07:20:11 sebastian Exp $ */
#include "php_soap.h"
#include "libxml/uri.h"
diff --git a/ext/soap/php_schema.h b/ext/soap/php_schema.h
index 6acf476ee..17cab24c7 100644
--- a/ext/soap/php_schema.h
+++ b/ext/soap/php_schema.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_schema.h,v 1.13.2.2.2.1 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_schema.h,v 1.13.2.2.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_SCHEMA_H
#define PHP_SCHEMA_H
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index ba53cdc6e..8e2475898 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_sdl.c,v 1.88.2.12.2.9 2007/05/21 13:13:50 dmitry Exp $ */
+/* $Id: php_sdl.c,v 1.88.2.12.2.10 2007/12/31 07:20:11 sebastian Exp $ */
#include "php_soap.h"
#include "ext/libxml/php_libxml.h"
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index d8e098368..8a9eb7c57 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_sdl.h,v 1.37.2.3.2.2 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_sdl.h,v 1.37.2.3.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_SDL_H
#define PHP_SDL_H
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 9229dcef1..95758a612 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_soap.h,v 1.38.2.6.2.6 2007/09/05 11:20:45 dmitry Exp $ */
+/* $Id: php_soap.h,v 1.38.2.6.2.8 2008/01/09 16:45:28 dmitry Exp $ */
#ifndef PHP_SOAP_H
#define PHP_SOAP_H
@@ -160,7 +160,9 @@ ZEND_BEGIN_MODULE_GLOBALS(soap)
zend_bool use_soap_error_handler;
char* error_code;
zval* error_object;
- long cache;
+ char cache;
+ char cache_mode;
+ char cache_enabled;
char* cache_dir;
long cache_ttl;
long cache_limit;
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
index 1912e36b0..4da4738f0 100644
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_xml.c,v 1.25.2.1.2.2 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_xml.c,v 1.25.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#include "php_soap.h"
#include "libxml/parser.h"
diff --git a/ext/soap/php_xml.h b/ext/soap/php_xml.h
index 4a1da587b..24e4480c4 100644
--- a/ext/soap/php_xml.h
+++ b/ext/soap/php_xml.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_xml.h,v 1.17.2.1.2.2 2007/01/01 09:36:06 sebastian Exp $ */
+/* $Id: php_xml.h,v 1.17.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_SOAP_XML_H
#define PHP_SOAP_XML_H
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index d11e8e7e4..a20c7860e 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.156.2.28.2.33 2007/11/01 15:41:13 dmitry Exp $ */
+/* $Id: soap.c,v 1.156.2.28.2.39 2008/03/04 12:23:10 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -384,41 +384,47 @@ ZEND_GET_MODULE(soap)
ZEND_INI_MH(OnUpdateCacheEnabled)
{
- long *p;
+ if (OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
+ return FAILURE;
+ }
+ if (SOAP_GLOBAL(cache_enabled)) {
+ SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
+ } else {
+ SOAP_GLOBAL(cache) = 0;
+ }
+ return SUCCESS;
+}
+
+ZEND_INI_MH(OnUpdateCacheMode)
+{
+ char *p;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
- char *base;
-
- base = (char *) ts_resource(*((int *) mh_arg2));
+ char *base = (char *) ts_resource(*((int *) mh_arg2));
#endif
- p = (long*) (base+(size_t) mh_arg1);
+ p = (char*) (base+(size_t) mh_arg1);
+
+ *p = (char)atoi(new_value);
- if (new_value_length==2 && strcasecmp("on", new_value)==0) {
- *p = 1;
- }
- else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
- *p = 1;
- }
- else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
- *p = 1;
- }
- else {
- *p = (long) (atoi(new_value) != 0);
+ if (SOAP_GLOBAL(cache_enabled)) {
+ SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
+ } else {
+ SOAP_GLOBAL(cache) = 0;
}
return SUCCESS;
}
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateCacheEnabled,
- cache, zend_soap_globals, soap_globals)
+ cache_enabled, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_dir", "/tmp", PHP_INI_ALL, OnUpdateString,
cache_dir, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_ttl", "86400", PHP_INI_ALL, OnUpdateLong,
cache_ttl, zend_soap_globals, soap_globals)
-STD_PHP_INI_ENTRY("soap.wsdl_cache", "1", PHP_INI_ALL, OnUpdateLong,
- cache, zend_soap_globals, soap_globals)
+STD_PHP_INI_ENTRY("soap.wsdl_cache", "1", PHP_INI_ALL, OnUpdateCacheMode,
+ cache_mode, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_limit", "5", PHP_INI_ALL, OnUpdateLong,
cache_limit, zend_soap_globals, soap_globals)
PHP_INI_END()
@@ -505,6 +511,7 @@ PHP_RINIT_FUNCTION(soap)
SOAP_GLOBAL(encoding) = NULL;
SOAP_GLOBAL(class_map) = NULL;
SOAP_GLOBAL(features) = 0;
+ SOAP_GLOBAL(ref_map) = NULL;
return SUCCESS;
}
@@ -2001,6 +2008,8 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
char cont_len[30];
int size;
xmlDocPtr doc_return;
+ zval **agent_name;
+ int use_http_error_status = 1;
soap_version = SOAP_GLOBAL(soap_version);
@@ -2008,11 +2017,21 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
xmlDocDumpMemory(doc_return, &buf, &size);
+ zend_is_auto_global("_SERVER", sizeof("_SERVER") - 1 TSRMLS_CC);
+ if (PG(http_globals)[TRACK_VARS_SERVER] &&
+ zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &agent_name) == SUCCESS &&
+ Z_TYPE_PP(agent_name) == IS_STRING) {
+ if (strncmp(Z_STRVAL_PP(agent_name), "Shockwave Flash", sizeof("Shockwave Flash")-1) == 0) {
+ use_http_error_status = 0;
+ }
+ }
/*
Want to return HTTP 500 but apache wants to over write
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);
+ if (use_http_error_status) {
+ sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 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 {
@@ -4486,6 +4505,7 @@ static sdlFunctionPtr get_doc_function(sdlPtr sdl, xmlNodePtr params)
break;
}
zend_hash_move_forward((*tmp)->requestParameters);
+ node = node->next;
}
if (ok /*&& node == NULL*/) {
return (*tmp);
diff --git a/ext/soap/tests/any.phpt b/ext/soap/tests/any.phpt
index 3805f3f3a..369e6a221 100755
--- a/ext/soap/tests/any.phpt
+++ b/ext/soap/tests/any.phpt
@@ -4,6 +4,7 @@ SOAP handling of <any>
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/bugs/bug27722.phpt b/ext/soap/tests/bugs/bug27722.phpt
index c06fd5e75..4720bd890 100644
--- a/ext/soap/tests/bugs/bug27722.phpt
+++ b/ext/soap/tests/bugs/bug27722.phpt
@@ -4,6 +4,8 @@ Bug #27722 (Segfault on schema without targetNamespace)
<?php require_once('skipif.inc'); ?>
--GET--
wsdl
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$x = new SoapClient(dirname(__FILE__)."/bug27722.wsdl");
diff --git a/ext/soap/tests/bugs/bug27742.phpt b/ext/soap/tests/bugs/bug27742.phpt
index 1e24fbc2f..66cdf6533 100644
--- a/ext/soap/tests/bugs/bug27742.phpt
+++ b/ext/soap/tests/bugs/bug27742.phpt
@@ -4,6 +4,8 @@ Bug #27742 (WDSL SOAP Parsing Schema bug)
<?php require_once('skipif.inc'); ?>
--GET--
wsdl
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$x = new SoapClient(dirname(__FILE__)."/bug27742.wsdl");
diff --git a/ext/soap/tests/bugs/bug28985.phpt b/ext/soap/tests/bugs/bug28985.phpt
index 795fc3c92..3e1126983 100644
--- a/ext/soap/tests/bugs/bug28985.phpt
+++ b/ext/soap/tests/bugs/bug28985.phpt
@@ -2,6 +2,8 @@
Bug #28985 (__getTypes() returning nothing on complex WSDL)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SOAPClient(dirname(__FILE__).'/bug28985.wsdl', array('trace'=>1));
diff --git a/ext/soap/tests/bugs/bug29061.phpt b/ext/soap/tests/bugs/bug29061.phpt
index 2fe1ebdd0..abede320a 100644
--- a/ext/soap/tests/bugs/bug29061.phpt
+++ b/ext/soap/tests/bugs/bug29061.phpt
@@ -2,6 +2,8 @@
Bug #29061 (soap extension segfaults)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/bug29061.wsdl", array("exceptions"=>0));
diff --git a/ext/soap/tests/bugs/bug29109.phpt b/ext/soap/tests/bugs/bug29109.phpt
index 9b63278dc..a69674ece 100644
--- a/ext/soap/tests/bugs/bug29109.phpt
+++ b/ext/soap/tests/bugs/bug29109.phpt
@@ -2,6 +2,8 @@
Bug #29109 (Uncaught SoapFault exception: [WSDL] Out of memory)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/bug29109.wsdl");
diff --git a/ext/soap/tests/bugs/bug29236.phpt b/ext/soap/tests/bugs/bug29236.phpt
index 674235f8e..d8003e2b6 100644
--- a/ext/soap/tests/bugs/bug29236.phpt
+++ b/ext/soap/tests/bugs/bug29236.phpt
@@ -2,6 +2,8 @@
Bug #29236 (memory error when wsdl-cache is enabled)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=1
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/bug29236.wsdl");
diff --git a/ext/soap/tests/bugs/bug29795.phpt b/ext/soap/tests/bugs/bug29795.phpt
index a99f06c60..db7e6e49f 100644
--- a/ext/soap/tests/bugs/bug29795.phpt
+++ b/ext/soap/tests/bugs/bug29795.phpt
@@ -2,6 +2,8 @@
Bug #29795 (SegFault with Soap and Amazon's Web Services)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=1
--FILE--
<?php
class LocalSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bugs/bug29839.phpt b/ext/soap/tests/bugs/bug29839.phpt
index f14866954..26d63c817 100644
--- a/ext/soap/tests/bugs/bug29839.phpt
+++ b/ext/soap/tests/bugs/bug29839.phpt
@@ -2,6 +2,8 @@
Bug #29839 (incorrect convert (xml:lang to lang))
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
diff --git a/ext/soap/tests/bugs/bug29844.phpt b/ext/soap/tests/bugs/bug29844.phpt
index 86a7cc4d4..d65327a45 100644
--- a/ext/soap/tests/bugs/bug29844.phpt
+++ b/ext/soap/tests/bugs/bug29844.phpt
@@ -2,6 +2,8 @@
Bug #29844 (SOAP doesn't return the result of a valid SOAP request)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
diff --git a/ext/soap/tests/bugs/bug30045.phpt b/ext/soap/tests/bugs/bug30045.phpt
index e51921e99..ab142efe6 100644
--- a/ext/soap/tests/bugs/bug30045.phpt
+++ b/ext/soap/tests/bugs/bug30045.phpt
@@ -5,6 +5,8 @@ Bug #30045 (Cannot pass big integers (> 2147483647) in SOAP requests)
if (!extension_loaded('soap')) die('skip soap extension not available');
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
?>
+--INI--
+soap.wsdl_cache_enabled=1
--FILE--
<?php
diff --git a/ext/soap/tests/bugs/bug32776.phpt b/ext/soap/tests/bugs/bug32776.phpt
index 6736fb4be..10941e670 100644
--- a/ext/soap/tests/bugs/bug32776.phpt
+++ b/ext/soap/tests/bugs/bug32776.phpt
@@ -2,6 +2,8 @@
Bug #32776 (SOAP doesn't support one-way operations)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
diff --git a/ext/soap/tests/bugs/bug34453.phpt b/ext/soap/tests/bugs/bug34453.phpt
index 8e2501761..f186f69d4 100755
--- a/ext/soap/tests/bugs/bug34453.phpt
+++ b/ext/soap/tests/bugs/bug34453.phpt
@@ -2,6 +2,8 @@
Bug #29839 (incorrect convert (xml:lang to lang))
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
diff --git a/ext/soap/tests/bugs/bug35273.phpt b/ext/soap/tests/bugs/bug35273.phpt
index cd238bad1..cc313e1c6 100755
--- a/ext/soap/tests/bugs/bug35273.phpt
+++ b/ext/soap/tests/bugs/bug35273.phpt
@@ -2,6 +2,8 @@
Bug #35273 (Error in mapping soap - java types)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bugs/bug37083.phpt b/ext/soap/tests/bugs/bug37083.phpt
index 471b5e49a..8737a22df 100755
--- a/ext/soap/tests/bugs/bug37083.phpt
+++ b/ext/soap/tests/bugs/bug37083.phpt
@@ -3,7 +3,7 @@ Bug #37083 (Frequent crashs in SOAP extension with new WSDL caching code in mult
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
-soap.wsdl_cache_enabled=3
+soap.wsdl_cache=3
--FILE--
<?php
class TestSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bugs/bug38004.phpt b/ext/soap/tests/bugs/bug38004.phpt
index 508ccf19d..295d335bf 100755
--- a/ext/soap/tests/bugs/bug38004.phpt
+++ b/ext/soap/tests/bugs/bug38004.phpt
@@ -2,6 +2,8 @@
Bug #38004 (Parameters in SoapServer are decoded twice)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param) {
diff --git a/ext/soap/tests/bugs/bug38005.phpt b/ext/soap/tests/bugs/bug38005.phpt
index 5e9e8b81c..2095d0de6 100755
--- a/ext/soap/tests/bugs/bug38005.phpt
+++ b/ext/soap/tests/bugs/bug38005.phpt
@@ -2,6 +2,8 @@
Bug #38005 (SoapFault faultstring doesn't follow encoding rules)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param) {
diff --git a/ext/soap/tests/bugs/bug38055.phpt b/ext/soap/tests/bugs/bug38055.phpt
index cec990c86..870490671 100755
--- a/ext/soap/tests/bugs/bug38055.phpt
+++ b/ext/soap/tests/bugs/bug38055.phpt
@@ -2,6 +2,8 @@
Bug #38055 (Wrong interpretation of boolean parameters)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param) {
diff --git a/ext/soap/tests/bugs/bug38067.phpt b/ext/soap/tests/bugs/bug38067.phpt
index accea047f..3ab191127 100755
--- a/ext/soap/tests/bugs/bug38067.phpt
+++ b/ext/soap/tests/bugs/bug38067.phpt
@@ -2,6 +2,8 @@
Bug #38067 (Parameters are not decoded from utf-8 when using encoding option)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param) {
diff --git a/ext/soap/tests/bugs/bug39815.phpt b/ext/soap/tests/bugs/bug39815.phpt
index 1bc49b1f9..25715bf22 100755
--- a/ext/soap/tests/bugs/bug39815.phpt
+++ b/ext/soap/tests/bugs/bug39815.phpt
@@ -9,6 +9,7 @@ if (!@setlocale(LC_ALL, 'en_US', 'en_US.ISO8859-1')) die('skip en_US locale not
?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
function test(){
diff --git a/ext/soap/tests/bugs/bug42692.phpt b/ext/soap/tests/bugs/bug42692.phpt
new file mode 100755
index 000000000..6511556b5
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42692.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #42692 (Procedure 'int1' not present with doc/lit SoapServer)
+--FILE--
+<?php
+ini_set('soap.wsdl_cache_enabled','0');
+
+function checkAuth($peid,$auth) {
+ return $peid;
+}
+
+class TestSoap extends SoapClient {
+
+ function __construct($wsdl, $options) {
+ parent::__construct($wsdl, $options);
+ $this->server = new SoapServer($wsdl, $options);
+ $this->server->addFunction("checkAuth");
+ }
+
+ function __doRequest($request, $location, $action, $version) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+ }
+}
+
+$client = new TestSoap(dirname(__FILE__) . "/bug42692.wsdl", array("trace"=>1));
+try {
+ $result = $client->checkAuth(1,"two");
+ echo "Auth for 1 is $result\n";
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Auth for 1 is 1
diff --git a/ext/soap/tests/bugs/bug42692.wsdl b/ext/soap/tests/bugs/bug42692.wsdl
new file mode 100755
index 000000000..c8928e30d
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42692.wsdl
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name="netDB"
+ targetNamespace="urn:netDB"
+ xmlns:typens="urn:netDB"
+ 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/">
+ <message name="checkAuthIN">
+ <part name="peid" type="xsd:integer" />
+ <part name="auth" type="xsd:string" />
+ </message>
+ <message name="checkAuthOUT">
+ <part name="peidx" type="xsd:integer" />
+ </message>
+ <portType name="netDB">
+ <operation name="checkAuth">
+ <input message="typens:checkAuthIN" />
+ <output message="typens:checkAuthOUT" />
+ </operation>
+ </portType>
+ <binding name="netDB" type="typens:netDB">
+ <soap:binding type="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="checkAuth">
+ <soap:operation soapAction="urn:checkAuth" />
+ <input>
+ <soap:body use="encoded" namespace="urn:netDB" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+ </input>
+ <output>
+ <soap:body use="encoded" namespace="urn:netDB" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+ </output>
+ </operation>
+ </binding>
+ <service name="netDB">
+ <port name="netDBPort" binding="typens:netDB">
+ <soap:address location="http://netdb.alphawest.com.au/xml/soap/server.php"/>
+ </port>
+ </service>
+</definitions>
diff --git a/ext/soap/tests/classmap001.phpt b/ext/soap/tests/classmap001.phpt
index 6ac81aae3..247a1ded7 100644
--- a/ext/soap/tests/classmap001.phpt
+++ b/ext/soap/tests/classmap001.phpt
@@ -2,6 +2,8 @@
SOAP Classmap 1: SoapServer support for classmap
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/soap/tests/classmap002.phpt b/ext/soap/tests/classmap002.phpt
index e6f5af991..69675a5a2 100644
--- a/ext/soap/tests/classmap002.phpt
+++ b/ext/soap/tests/classmap002.phpt
@@ -2,6 +2,8 @@
SOAP Classmap 2: SoapClient support for classmap
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_001w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_001w.phpt
index 49bcc131e..6c7351864 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_001w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_002w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_002w.phpt
index 4741ab758..e320d9ab7 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_002w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 002 (php/wsdl): echoString(empty)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_003w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_003w.phpt
index cf1592ab5..2b8fb5ae2 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_003w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 003 (php/wsdl): echoString(NULL)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_004w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_004w.phpt
index c1410058c..c13609063 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_004w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 004 (php/wsdl): echoString(entities)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt
index 7dd127cfb..5746503dc 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 005 (php/wsdl): echoString(utf-8)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_006w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_006w.phpt
index e93325a53..c1e06fa51 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_006w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_006w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 006 (php/wsdl): echoStringArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_007w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_007w.phpt
index db79df02d..4ce57b6b9 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_007w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_007w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 007 (php/wsdl): echoStringArray(one)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_008w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_008w.phpt
index d545ec1ab..d10752b0f 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_008w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_008w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 008 (php/wsdl): echoStringArray(empty)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_009w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_009w.phpt
index bfe211438..3a0d18e37 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_009w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_009w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 009 (php/wsdl): echoStringArray(NULL)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_010w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_010w.phpt
index 045a4db43..41f45d043 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_010w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_010w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 010 (php/wsdl): echoInteger
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_011w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_011w.phpt
index 2596182ff..c56f2a4f6 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_011w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_011w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 011 (php/wsdl): echoIntegerArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt
index a48ac7b23..f4e8b3f3c 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 base 012 (php/wsdl): echoFloat
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt
index 8481de447..31f2a9a32 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 base 013 (php/wsdl): echoFloatArray
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt
index 104f244e3..d70ee79de 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 base 014 (php/wsdl): echoStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt
index 51d344f24..e8cb17d56 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 base 015 (php/wsdl): echoStructArray
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_016w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_016w.phpt
index 9b7f95e35..f71d65f46 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_016w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_016w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 016 (php/wsdl): echoVoid
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_017w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_017w.phpt
index c2e836d74..a6f77e323 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_017w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_017w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 017 (php/wsdl): echoBase64
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_018w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_018w.phpt
index e7dce5430..4dcf3e55e 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_018w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_018w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 018 (php/wsdl): echoHexBinary
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_019w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_019w.phpt
index 5cc7c47ee..8ae7e7e0e 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_019w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_019w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 019 (php/wsdl): echoDecimal
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_020w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_020w.phpt
index ac8222157..c3b85352f 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_020w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_020w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 020 (php/wsdl): echoDate
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_021w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_021w.phpt
index 03f8ad5e8..54f825435 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_021w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_021w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 021 (php/wsdl): echoBoolean
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_022w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_022w.phpt
index a516b9dcc..88722dcc6 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_022w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_022w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 022 (php/wsdl): echoBoolean
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_023w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_023w.phpt
index 90d831cb1..f8a6b8766 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_023w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_023w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 023 (php/wsdl): echoBoolean
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_024w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_024w.phpt
index 99dab0b4f..4fefba432 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_024w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_024w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 024 (php/wsdl): echoBoolean
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_base.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/round2_base.inc b/ext/soap/tests/interop/Round2/Base/round2_base.inc
index 29879547d..48eaf40f8 100644
--- a/ext/soap/tests/interop/Round2/Base/round2_base.inc
+++ b/ext/soap/tests/interop/Round2/Base/round2_base.inc
@@ -74,6 +74,7 @@ class SOAP_Interop_Base {
}
+ini_set("soap.wsdl_cache_enabled",0);
$server = new SoapServer(dirname(__FILE__)."/round2_base.wsdl");
$server->setClass("SOAP_Interop_Base");
$server->handle($HTTP_RAW_POST_DATA);
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt
index b47df6a68..8f9f82248 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 groupB 001 (php/wsdl): echoStructAsSimpleTypes
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_groupB.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt
index 610d866be..d04a3aa4c 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 groupB 002 (php/wsdl): echoSimpleTypesAsStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round2_groupB.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_003w.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_003w.phpt
index a0c1b21ee..cc5af03e9 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_003w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 003 (php/wsdl): echo2DStringArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$param = array(
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt
index 4393ad9bb..8dd3ae706 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 groupB 004 (php/wsdl): echoNestedStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$param = (object)array(
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt
index f38866b37..7f76ff38a 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round2 groupB 005 (php/wsdl): echoNestedArray
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$param = (object)array(
diff --git a/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc b/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
index a40f09cc4..77b81271c 100644
--- a/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
+++ b/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
@@ -31,6 +31,7 @@ class SOAP_Interop_GroupB {
}
}
+ini_set("soap.wsdl_cache_enabled",0);
$server = new SoapServer(dirname(__FILE__)."/round2_groupB.wsdl");
$server->setClass("SOAP_Interop_GroupB");
$server->handle($HTTP_RAW_POST_DATA);
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_001w.phpt
index 1fef6bae4..632d0a24f 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_001w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD Compound1 001 (php/wsdl): echoPerson
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class Person {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_002w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_002w.phpt
index a2b08d801..2d8f91b42 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_002w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Compound1 002 (php/wsdl): echoDocument
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_compound1.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_003w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_003w.phpt
index a961d118e..a5f818ce9 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_003w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Compound1 003 (php/wsdl): echoDocument
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_compound1.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound2_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound2_001w.phpt
index 6534047ad..b5c00bd96 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound2_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound2_001w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD Compound2 001 (php/wsdl): echoEmployee
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class Person {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_001w.phpt
index bacad8691..f3f2ca244 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_002w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_002w.phpt
index 17301bf7b..03c6b98d3 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_002w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit 002 (php/wsdl): echoStringArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_003w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_003w.phpt
index 8529cbd73..32879310f 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_003w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_003w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD Doc Lit 003 (php/wsdl): echoStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_004w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_004w.phpt
index 7193bf85a..cf7098072 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_004w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit 004 (php/wsdl): echoVoid
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_001w.phpt
index 3b1f17633..7c4403d00 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit Parameters 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_doclitparams.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_002w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_002w.phpt
index d44409bf6..a73efd2c7 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_002w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit Parameters 002 (php/wsdl): echoStringArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_doclitparams.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_003w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_003w.phpt
index 0531daf40..118ea91cf 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_003w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_003w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD Doc Lit Parameters 003 (php/wsdl): echoStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_004w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_004w.phpt
index 7ee4aa29a..b3857d338 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_004w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit Parameters 004 (php/wsdl): echoVoid
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_doclitparams.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_emptysa_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_emptysa_001w.phpt
index 9c2e756fb..e79a9549f 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_emptysa_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_emptysa_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD EmptySA 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_emptysa.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import1_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import1_001w.phpt
index 181fc8ad7..eefac74c7 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import1_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import1_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Import1 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_import1.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import2_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import2_001w.phpt
index 06e403679..00b21a58e 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import2_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import2_001w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD Import2 001 (php/wsdl): echoStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_001w.phpt
index 2f7721ab1..d111ad852 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_001w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD Import3 001 (php/wsdl): echoStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_002w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_002w.phpt
index 29fb6f3e5..47a5a6c01 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_002w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_002w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD Import3 002 (php/wsdl): echoStructArray
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_001w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_001w.phpt
index 26612d0c5..af546c325 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD RPC Encoded 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_002w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_002w.phpt
index 5a97eb2fd..4e61a9280 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_002w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD RPC Encoded 002 (php/wsdl): echoStringArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_003w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_003w.phpt
index f8d6cef1d..02f6c907f 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_003w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_003w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round3 GroupD RPC Encoded 003 (php/wsdl): echoStruct
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_004w.phpt b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_004w.phpt
index 47849f9e0..272a40957 100644
--- a/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_004w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD RPC Encoded 004 (php/wsdl): echoVoid
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupD_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_001w.phpt b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_001w.phpt
index caa7a9f83..48d7615a2 100644
--- a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupE List 001 (php/wsdl): echoLinkedList
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPList {
diff --git a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_002w.phpt b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_002w.phpt
index 850052cc1..fe4a6781e 100644
--- a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_002w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupE List 002 (php/wsdl): echoLinkedList
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPList {
diff --git a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_003w.phpt b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_003w.phpt
index db874c48d..803de6335 100644
--- a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_003w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupE List 003 (php/wsdl): echoLinkedList
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPList {
diff --git a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt
index 100492275..03981417f 100644
--- a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupE List 004 (php/wsdl): echoLinkedList
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPList {
diff --git a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_005w.phpt b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_005w.phpt
index 922d7ea2e..a0c068ce0 100644
--- a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_005w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_005w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupE List 005 (php/wsdl): echoLinkedList (cyclic)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPList {
diff --git a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_006w.phpt b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_006w.phpt
index f51c4afa1..590b6ee3b 100644
--- a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_006w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_006w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupE List 006 (php/wsdl): echoLinkedList (cyclic)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPList {
diff --git a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_ext_001w.phpt b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_ext_001w.phpt
index e9c52e2a7..847bfe08a 100644
--- a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_ext_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_ext_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupF Extensibility 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupF_ext.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_extreq_001w.phpt b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_extreq_001w.phpt
index ed6f860f4..29680c654 100644
--- a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_extreq_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_extreq_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupF Extensibility Required 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupF_extreq.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_001w.phpt b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_001w.phpt
index cd54939c2..578bfadb4 100644
--- a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_001w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupF Headers 001 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round3_groupF_headers.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_002w.phpt b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_002w.phpt
index 5edc550fe..4cee3e1bb 100644
--- a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_002w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupF Headers 002 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/xsd","Header1", array("int"=>34,"string"=>"arg"));
diff --git a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_003w.phpt b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_003w.phpt
index ef7002c63..6a4db2c4e 100644
--- a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_003w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupF Headers 003 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/xsd","Header2", array("int"=>34,"string"=>"arg"));
diff --git a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_004w.phpt b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_004w.phpt
index 60b027ff1..3abe1604c 100644
--- a/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_004w.phpt
+++ b/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupF Headers 004 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = array(
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_001w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_001w.phpt
index 25ddc3af7..dccf40d51 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_001w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_001w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex Doc Lit 001 (php/wsdl): echoSOAPStructFault
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_002w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_002w.phpt
index cbb58ae72..6f3fe53cb 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_002w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_002w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex Doc Lit 002 (php/wsdl): echoBaseStructFault
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_003w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_003w.phpt
index 621574c3d..4b67bc873 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_003w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_003w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex Doc Lit 003 (php/wsdl): echoExtendedStructFau
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_004w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_004w.phpt
index 5309fab21..4838d974c 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_004w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_004w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex Doc Lit 004 (php/wsdl): echoMultipleFaults1(1
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_005w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_005w.phpt
index 24498004f..923f04db4 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_005w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_005w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex Doc Lit 005 (php/wsdl): echoMultipleFaults1(2
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_006w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_006w.phpt
index fd799b666..549218745 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_006w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_006w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex Doc Lit 006 (php/wsdl): echoMultipleFaults1(3
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_007w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_007w.phpt
index 73da00e8e..f79027870 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_007w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_007w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 007 (php/wsdl): echoMultipleFaults2(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_008w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_008w.phpt
index 3fa3e6d77..95c79ed19 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_008w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_008w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 008 (php/wsdl): echoMultipleFaults2(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_009w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_009w.phpt
index 340c25a8c..c33bc217c 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_009w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_009w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 009 (php/wsdl): echoMultipleFaults2(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_010w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_010w.phpt
index c89ac264d..0d6c8c5cb 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_010w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_010w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 010 (php/wsdl): echoMultipleFaults2(4)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_001w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_001w.phpt
index 29998414f..3c3a620cb 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_001w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_001w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 001 (php/wsdl): echoSOAPStructFault
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_002w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_002w.phpt
index a91410586..a4f11975f 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_002w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_002w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 002 (php/wsdl): echoBaseStructFault
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class BaseStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_003w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_003w.phpt
index baf1f13db..7b33e7adb 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_003w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_003w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 003 (php/wsdl): echoExtendedStructFau
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class BaseStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_004w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_004w.phpt
index eb0fc3e73..3e04b180a 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_004w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_004w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 004 (php/wsdl): echoMultipleFaults1(1
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_005w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_005w.phpt
index 45c89a654..7e935dcd1 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_005w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_005w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 005 (php/wsdl): echoMultipleFaults1(2
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_006w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_006w.phpt
index b7e3debaa..9d147c8e8 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_006w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_006w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 006 (php/wsdl): echoMultipleFaults1(3
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_007w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_007w.phpt
index 7b74828d4..3a938c112 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_007w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_007w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 007 (php/wsdl): echoMultipleFaults2(1
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class BaseStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_008w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_008w.phpt
index 6dda13aaa..72fc9468f 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_008w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_008w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 008 (php/wsdl): echoMultipleFaults2(2
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class BaseStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_009w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_009w.phpt
index 1b512166c..429575d9d 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_009w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_009w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 009 (php/wsdl): echoMultipleFaults2(3
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class BaseStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_010w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_010w.phpt
index 7f8ebbe2e..2036992df 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_010w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_010w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Complex RPC Enc 010 (php/wsdl): echoMultipleFaults2(4
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class BaseStruct {
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_001w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_001w.phpt
index ee719f17c..80caaee58 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_001w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 001 (php/wsdl): echoEmptyFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_002w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_002w.phpt
index 7ea0f6f13..943936434 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_002w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 002 (php/wsdl): echoStringFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_003w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_003w.phpt
index 937e49f3a..af589610f 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_003w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 003 (php/wsdl): echoIntArrayFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_004w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_004w.phpt
index 1d2068ada..2f51b54f2 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_004w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_004w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 004 (php/wsdl): echoMultipleFaults1(1)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_005w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_005w.phpt
index 9179233f2..c2fcf8127 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_005w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_005w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 005 (php/wsdl): echoMultipleFaults1(2)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_006w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_006w.phpt
index 7d85cafd8..a25d0563d 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_006w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_006w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 006 (php/wsdl): echoMultipleFaults1(3)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_007w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_007w.phpt
index 023f4d595..55dff3a03 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_007w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_007w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 007 (php/wsdl): echoMultipleFaults1(4)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_008w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_008w.phpt
index b34ed31a8..f4132565e 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_008w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_008w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 008 (php/wsdl): echoMultipleFaults2(1)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_009w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_009w.phpt
index f184f51c7..93d80f5e5 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_009w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_009w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 009 (php/wsdl): echoMultipleFaults2(2)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_010w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_010w.phpt
index dc8416c5b..815cd0070 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_010w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_010w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 010 (php/wsdl): echoMultipleFaults2(3)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_011w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_011w.phpt
index 0992c3574..d73b8f4ad 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_011w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_011w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple Doc Lit 011 (php/wsdl): echoMultipleFaults2(4)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_012w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_012w.phpt
index 86a86f4d9..2cacbec5e 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_012w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_012w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 012 (php/wsdl): echoMultipleFaults3(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_013w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_013w.phpt
index 7718a4722..894546bd2 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_013w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_013w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 013 (php/wsdl): echoMultipleFaults3(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_014w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_014w.phpt
index d35a075f5..982d654cc 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_014w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_014w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 014 (php/wsdl): echoMultipleFaults3(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_015w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_015w.phpt
index 2a652e719..08250b0dd 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_015w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_015w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 015 (php/wsdl): echoMultipleFaults4(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_016w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_016w.phpt
index 81eb3e98e..75f612aa7 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_016w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_016w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 016 (php/wsdl): echoMultipleFaults4(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_017w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_017w.phpt
index 08ca44adc..dcb257b32 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_017w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_017w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 017 (php/wsdl): echoMultipleFaults4(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_001w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_001w.phpt
index 8b9a7d0c3..741b319b1 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_001w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 001 (php/wsdl): echoEmptyFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_002w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_002w.phpt
index 922c7cc9c..a86d9693d 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_002w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 002 (php/wsdl): echoStringFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_003w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_003w.phpt
index 87dd01fa8..ee1287c64 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_003w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 003 (php/wsdl): echoIntArrayFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt
index abe697f27..b68f97dab 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 004 (php/wsdl): echoMultipleFaults1(1)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_005w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_005w.phpt
index b4da77e7a..08cf59efd 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_005w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_005w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 005 (php/wsdl): echoMultipleFaults1(2)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_006w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_006w.phpt
index f49d6fdef..ea555ce00 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_006w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_006w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 006 (php/wsdl): echoMultipleFaults1(3)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_007w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_007w.phpt
index 8decba9bf..62747e96e 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_007w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_007w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 007 (php/wsdl): echoMultipleFaults1(4)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_008w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_008w.phpt
index 7b743bddf..24299a614 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_008w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_008w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 008 (php/wsdl): echoMultipleFaults2(1)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_009w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_009w.phpt
index 792542a63..eb3babd94 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_009w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_009w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 009 (php/wsdl): echoMultipleFaults2(2)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_010w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_010w.phpt
index 784648cda..be57a233b 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_010w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_010w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 010 (php/wsdl): echoMultipleFaults2(3)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_011w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_011w.phpt
index 892638022..00552ab52 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_011w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_011w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupH Simple RPC Enc 011 (php/wsdl): echoMultipleFaults2(4)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_012w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_012w.phpt
index 5a229348f..05a7cfafe 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_012w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_012w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 012 (php/wsdl): echoMultipleFaults3(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_013w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_013w.phpt
index 77b87e64f..a28203231 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_013w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_013w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 013 (php/wsdl): echoMultipleFaults3(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_014w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_014w.phpt
index 12e1491ab..aec5a3900 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_014w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_014w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 014 (php/wsdl): echoMultipleFaults3(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_015w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_015w.phpt
index 5b79e1d0a..2027f23a6 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_015w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_015w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 015 (php/wsdl): echoMultipleFaults4(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_016w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_016w.phpt
index 0d8a9520d..89bc04c91 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_016w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_016w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 016 (php/wsdl): echoMultipleFaults4(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_017w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_017w.phpt
index 69471fdde..ad8c875a5 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_017w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_017w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 017 (php/wsdl): echoMultipleFaults4(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_001w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_001w.phpt
index b89bdec4e..9c82d2f60 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_001w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH SoapFault 001 (php/wsdl): echoVersionMismatchFault(SOAP 1.1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_soapfault.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_002w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_002w.phpt
index 697b514d9..49e78bea3 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_002w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH SoapFault 002 (php/wsdl): echoVersionMismatchFault(SOAP 1.2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupH_soapfault.wsdl",array("trace"=>1,"exceptions"=>0,"soap_version"=>SOAP_1_2));
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_003w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_003w.phpt
index 586cc69e2..800283833 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_003w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_003w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH SoapFault 003 (php/wsdl): echoVersionMismatchFault(unknown version)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$HTTP_RAW_POST_DATA = <<<EOF
diff --git a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_004w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_004w.phpt
index bf8f4f243..117a51e8c 100644
--- a/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_004w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH SoapFault 004 (php/wsdl): echoMustUnderstandFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/wsdl", "UnknownHeaderRequest", "Hello World", 1);
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_001w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_001w.phpt
index a6ede9bbb..476b54157 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_001w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 001 (php/wsdl): echoVoid
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_002w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_002w.phpt
index d72497175..a1921d15d 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_002w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 002 (php/wsdl): echoInteger
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_003w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_003w.phpt
index d12ecd4d0..01916d2cf 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_003w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_003w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 003 (php/wsdl): echoFloat
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_004w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_004w.phpt
index db71f87e1..528b5d176 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_004w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 004 (php/wsdl): echoString
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_005w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_005w.phpt
index e741e000a..d51596c1a 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_005w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_005w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 005 (php/wsdl): echoString(empty)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_006w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_006w.phpt
index 566461451..0935a07e1 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_006w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_006w.phpt
Binary files differ
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_007w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_007w.phpt
index 917419eea..a6f52c943 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_007w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_007w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 007 (php/wsdl): echoDate
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_008w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_008w.phpt
index f8e65cf00..8da2ec096 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_008w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_008w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 008 (php/wsdl): echoComplexType
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_009w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_009w.phpt
index 7388a874c..5a66f12ad 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_009w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_009w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 009 (php/wsdl): echoComplexType(minOccur=0)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_010w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_010w.phpt
index 9a8ea0365..34ea9be96 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_010w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_010w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 010 (php/wsdl): echoIntegerMultiOccurs
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_011w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_011w.phpt
index f0d3c8712..d2051a777 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_011w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_011w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 011 (php/wsdl): echoFloatMultiOccurs
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_012w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_012w.phpt
index 231583dd2..7775a06dc 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_012w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_012w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 012 (php/wsdl): echoStringMultiOccurs
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_013w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_013w.phpt
index 199f91f4f..9f413218c 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_013w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_013w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 013 (php/wsdl): echoStringMultiOccurs(nil)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_014w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_014w.phpt
index 97e816419..dc443c3c3 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_014w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_014w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 014 (php/wsdl): echoComplexTypeMultiOccurs(1)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_015w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_015w.phpt
index 87542911d..0e8d9e2c0 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_015w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_015w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 015 (php/wsdl): echoComplexTypeMultiOccurs(nil)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_016w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_016w.phpt
index 5cffa8c08..796747b5c 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_016w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_016w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 016 (php/wsdl): echoDecimal
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_017w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_017w.phpt
index 843f73dad..5dd607d47 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_017w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_017w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 017 (php/wsdl): echoBoolean
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_018w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_018w.phpt
index 6a02c0483..57b2c631c 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_018w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_018w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 018 (php/wsdl): echoHexBinary
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_019w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_019w.phpt
index 5c605bcc8..a3a17e053 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_019w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_019w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 019 (php/wsdl): echoComplexTypeAsSimpleTypes
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_020w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_020w.phpt
index 3faaaf111..7b55ca5fa 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_020w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_020w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 020 (php/wsdl): echoComplexTypeAsSimpleTypes(minO
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_021w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_021w.phpt
index 98da2702d..824d35b88 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_021w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_021w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 021 (php/wsdl): echoSimpleTypesAsComplexType
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_022w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_022w.phpt
index 4f294c54e..8e0bd3e17 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_022w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_022w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 022 (php/wsdl): echoSimpleTypesAsComplexType(minO
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_023w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_023w.phpt
index 0d6832eec..652843bf0 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_023w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_023w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 023 (php/wsdl): echoNestedComplexType
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_024w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_024w.phpt
index faf8041c0..07bd60f4c 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_024w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_024w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 024 (php/wsdl): echoNestedComplexType(minOccurs=0
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexTypeComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_025w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_025w.phpt
index a9813aa7b..169085666 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_025w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_025w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 025 (php/wsdl): echoNestedMultiOccurs
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPMultiOccursComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_026w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_026w.phpt
index 6d1c06238..53fb9777a 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_026w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_026w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 026 (php/wsdl): echoChoice
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_027w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_027w.phpt
index 575e7bed3..974e5791a 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_027w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_027w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 027 (php/wsdl): echoEnum
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_028w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_028w.phpt
index 723870dd8..21c16a0a6 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_028w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_028w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 028 (php/wsdl): echoAnyType
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_029w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_029w.phpt
index 926edd16f..a7db2ed9f 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_029w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_029w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 029 (php/wsdl): echoAnyElement
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(dirname(__FILE__)."/round4_groupI_xsd.wsdl",array("trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_030w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_030w.phpt
index 5081cddbb..aeb3369ef 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_030w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_030w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 030 (php/wsdl): echoVoidSoapHeader(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/","echoMeStringRequest", array("varString"=>"Hello World"), 1);
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_031w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_031w.phpt
index c09f2b28b..412fdcf1d 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_031w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_031w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 031 (php/wsdl): echoVoidSoapHeader(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/","echoMeStringRequest", array(), 1);
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_032w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_032w.phpt
index 5068b5f3a..e27b50038 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_032w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_032w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 032 (php/wsdl): echoVoidSoapHeader(3)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/","echoMeComplexTypeRequest", array("varInt"=>34,"varString"=>"arg","varFloat"=>12.345), 1);
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_033w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_033w.phpt
index dc03cda72..a88be26e6 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_033w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_033w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 033 (php/wsdl): echoVoidSoapHeader(4)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/","echoMeComplexTypeRequest", array("varInt"=>34,"varFloat"=>12.345), 1);
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_034w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_034w.phpt
index e90fe5c9d..08dab5c3d 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_034w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_034w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 034 (php/wsdl): echoVoidSoapHeader(5)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/","echoMeStringRequest", array("varString"=>"Hello World"), 1, SOAP_ACTOR_NEXT);
diff --git a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt
index 19c0e23f9..1126062bd 100644
--- a/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt
+++ b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt
@@ -4,6 +4,7 @@ SOAP Interop Round4 GroupI XSD 035 (php/wsdl): echoVoidSoapHeader(6)
<?php require_once('skipif.inc'); ?>
--INI--
precision=14
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$hdr = new SoapHeader("http://soapinterop.org/","echoMeComplexTypeRequest", array("varInt"=>34,"varString"=>"arg","varFloat"=>12.345), 1, SOAP_ACTOR_NEXT);
diff --git a/ext/soap/tests/server011.phpt b/ext/soap/tests/server011.phpt
index fb9aabe89..5b76a8129 100644
--- a/ext/soap/tests/server011.phpt
+++ b/ext/soap/tests/server011.phpt
@@ -4,6 +4,8 @@ SOAP Server 11: bind
<?php require_once('skipif.inc'); ?>
--GET--
wsdl
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
function Add($x,$y) {
diff --git a/ext/soap/tests/server021.phpt b/ext/soap/tests/server021.phpt
index d9913060b..245c46443 100644
--- a/ext/soap/tests/server021.phpt
+++ b/ext/soap/tests/server021.phpt
@@ -9,7 +9,7 @@ class Foo {
if ($name == "test") {
return "Hello World";
} else {
- return SoapFault("Server","Function $name doesn't exist");
+ return new SoapFault("Server","Function $name doesn't exist");
}
}
}
diff --git a/ext/soap/tests/server025.phpt b/ext/soap/tests/server025.phpt
index 975ad0065..ed56750a0 100755
--- a/ext/soap/tests/server025.phpt
+++ b/ext/soap/tests/server025.phpt
@@ -2,6 +2,8 @@
SOAP Server 25: One-way SOAP headers encoding using WSDL
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestHeader1 extends SoapHeader {
diff --git a/ext/soap/tests/soap12/soap12-test.inc b/ext/soap/tests/soap12/soap12-test.inc
index 576fb2e42..7b2e2efea 100644
--- a/ext/soap/tests/soap12/soap12-test.inc
+++ b/ext/soap/tests/soap12/soap12-test.inc
@@ -122,6 +122,7 @@ class Soap12test {
}
+ini_set("soap.wsdl_cache_enabled",0);
$server = new soapserver(dirname(__FILE__)."/soap12-test.wsdl", array('soap_version'=>SOAP_1_2,'actor'=>"http://example.org/ts-tests/C"));
$server->setClass("Soap12test");
diff --git a/ext/soap/tests/typemap001.phpt b/ext/soap/tests/typemap001.phpt
index c3b5b8444..9a75bef07 100755
--- a/ext/soap/tests/typemap001.phpt
+++ b/ext/soap/tests/typemap001.phpt
@@ -2,6 +2,8 @@
SOAP typemap 1: SoapServer support for typemap's from_xml()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/soap/tests/typemap002.phpt b/ext/soap/tests/typemap002.phpt
index 478e1ee4e..ceb00f1a1 100755
--- a/ext/soap/tests/typemap002.phpt
+++ b/ext/soap/tests/typemap002.phpt
@@ -2,6 +2,8 @@
SOAP typemap 2: SoapServer support for typemap's to_xml()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/soap/tests/typemap003.phpt b/ext/soap/tests/typemap003.phpt
index 17bd6c16e..cfe1a6d44 100755
--- a/ext/soap/tests/typemap003.phpt
+++ b/ext/soap/tests/typemap003.phpt
@@ -2,6 +2,8 @@
SOAP Typemap 3: SoapClient support for typemap's from_xml()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
diff --git a/ext/soap/tests/typemap004.phpt b/ext/soap/tests/typemap004.phpt
index f94af4990..768cdcacd 100755
--- a/ext/soap/tests/typemap004.phpt
+++ b/ext/soap/tests/typemap004.phpt
@@ -2,6 +2,8 @@
SOAP Typemap 4: SoapClient support for typemap's to_xml()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
diff --git a/ext/soap/tests/typemap005.phpt b/ext/soap/tests/typemap005.phpt
index 6e3001d0b..1a08d1145 100755
--- a/ext/soap/tests/typemap005.phpt
+++ b/ext/soap/tests/typemap005.phpt
@@ -2,6 +2,8 @@
SOAP typemap 5: SoapServer support for typemap's from_xml() (without WSDL)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/soap/tests/typemap006.phpt b/ext/soap/tests/typemap006.phpt
index 7b1fc4df2..7ecf410ad 100755
--- a/ext/soap/tests/typemap006.phpt
+++ b/ext/soap/tests/typemap006.phpt
@@ -2,6 +2,8 @@
SOAP typemap 6: SoapServer support for typemap's to_xml() (without WSDL, using SoapVar)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/soap/tests/typemap007.phpt b/ext/soap/tests/typemap007.phpt
index 8e2880b58..e8523287f 100755
--- a/ext/soap/tests/typemap007.phpt
+++ b/ext/soap/tests/typemap007.phpt
@@ -2,6 +2,8 @@
SOAP Typemap 7: SoapClient support for typemap's from_xml() (without WSDL)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
diff --git a/ext/soap/tests/typemap008.phpt b/ext/soap/tests/typemap008.phpt
index aaaa715d6..eebefeeca 100755
--- a/ext/soap/tests/typemap008.phpt
+++ b/ext/soap/tests/typemap008.phpt
@@ -2,6 +2,8 @@
SOAP Typemap 8: SoapClient support for typemap's to_xml() (without WSDL, using SoapVar)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
diff --git a/ext/soap/tests/typemap009.phpt b/ext/soap/tests/typemap009.phpt
index 208fb43db..ec5c38da2 100755
--- a/ext/soap/tests/typemap009.phpt
+++ b/ext/soap/tests/typemap009.phpt
@@ -2,6 +2,8 @@
SOAP typemap 9: SoapServer support for typemap's from_xml() (SoapFault)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/soap/tests/typemap010.phpt b/ext/soap/tests/typemap010.phpt
index b6ec26803..4eba6345c 100755
--- a/ext/soap/tests/typemap010.phpt
+++ b/ext/soap/tests/typemap010.phpt
@@ -2,6 +2,8 @@
SOAP typemap 10: SoapServer support for typemap's to_xml() (SoapFault)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/soap/tests/typemap011.phpt b/ext/soap/tests/typemap011.phpt
index 52acde28d..65a0666f2 100755
--- a/ext/soap/tests/typemap011.phpt
+++ b/ext/soap/tests/typemap011.phpt
@@ -2,6 +2,8 @@
SOAP Typemap 11: SoapClient support for typemap's from_xml() (SoapFault)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
diff --git a/ext/soap/tests/typemap012.phpt b/ext/soap/tests/typemap012.phpt
index aa06215fe..9855f8059 100755
--- a/ext/soap/tests/typemap012.phpt
+++ b/ext/soap/tests/typemap012.phpt
@@ -2,6 +2,8 @@
SOAP Typemap 12: SoapClient support for typemap's to_xml() (SoapFault)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestSoapClient extends SoapClient{
diff --git a/ext/soap/tests/typemap013.phpt b/ext/soap/tests/typemap013.phpt
index 9ad02cb5e..d873eb4d1 100755
--- a/ext/soap/tests/typemap013.phpt
+++ b/ext/soap/tests/typemap013.phpt
@@ -2,6 +2,8 @@
SOAP typemap 13: SoapServer support for typemap's to_xml() with default ns
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index 9a060c70d..01e1a2d8d 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -22,7 +22,7 @@
#ifndef PHP_SOCKETS_H
#define PHP_SOCKETS_H
-/* $Id: php_sockets.h,v 1.36.2.1.2.4 2007/07/22 23:01:20 jani Exp $ */
+/* $Id: php_sockets.h,v 1.36.2.1.2.5 2007/12/31 07:20:11 sebastian Exp $ */
#if HAVE_SOCKETS
diff --git a/ext/sockets/php_sockets_win.c b/ext/sockets/php_sockets_win.c
index 44f8011a9..f1a7e2a69 100644
--- a/ext/sockets/php_sockets_win.c
+++ b/ext/sockets/php_sockets_win.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sockets_win.c,v 1.12.2.1.2.2 2007/07/22 23:01:20 jani Exp $ */
+/* $Id: php_sockets_win.c,v 1.12.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef PHP_WIN32
diff --git a/ext/sockets/php_sockets_win.h b/ext/sockets/php_sockets_win.h
index 75269c408..b5638de13 100644
--- a/ext/sockets/php_sockets_win.h
+++ b/ext/sockets/php_sockets_win.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sockets_win.h,v 1.12.2.1.2.2 2007/07/22 23:01:20 jani Exp $ */
+/* $Id: php_sockets_win.h,v 1.12.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef PHP_WIN32
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 3ae93adcc..b73a25a7b 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.171.2.9.2.14 2007/09/26 10:55:07 tony2001 Exp $ */
+/* $Id: sockets.c,v 1.171.2.9.2.17 2008/02/21 02:39:43 felipe Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -584,7 +584,10 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) /
zval **dest_element;
php_socket *php_sock;
HashTable *new_hash;
+ char *key;
int num = 0;
+ ulong num_key;
+ uint key_len;
if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0;
@@ -599,7 +602,14 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) /
if (PHP_SAFE_FD_ISSET(php_sock->bsd_socket, fds)) {
/* Add fd to new array */
- zend_hash_next_index_insert(new_hash, (void *)element, sizeof(zval *), (void **)&dest_element);
+ switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(sock_array), &key, &key_len, &num_key, 0, NULL)) {
+ case HASH_KEY_IS_STRING:
+ zend_hash_add(new_hash, key, key_len, (void *)element, sizeof(zval *), (void **)&dest_element);
+ break;
+ case HASH_KEY_IS_LONG:
+ zend_hash_index_update(new_hash, num_key, (void *)element, sizeof(zval *), (void **)&dest_element);
+ break;
+ }
if (dest_element) zval_add_ref(dest_element);
}
num++;
diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h
index 4ffd17af6..fd40f8605 100644
--- a/ext/sockets/unix_socket_constants.h
+++ b/ext/sockets/unix_socket_constants.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: unix_socket_constants.h,v 1.5.2.1.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: unix_socket_constants.h,v 1.5.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
/* This file is to be included by sockets.c */
diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h
index bcb648704..5528d24c8 100644
--- a/ext/sockets/win32_socket_constants.h
+++ b/ext/sockets/win32_socket_constants.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: win32_socket_constants.h,v 1.5.2.1.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: win32_socket_constants.h,v 1.5.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
/* This file is to be included by sockets.c */
diff --git a/ext/spl/examples/findfile.inc b/ext/spl/examples/findfile.inc
index 05d525a3f..02ab79243 100755
--- a/ext/spl/examples/findfile.inc
+++ b/ext/spl/examples/findfile.inc
@@ -33,7 +33,7 @@ class FindFile extends FilterIterator
function __construct($path, $file)
{
$this->file = $file;
- $list = split(';', $path);
+ $list = split(PATH_SEPARATOR, $path);
if (count($list) <= 1) {
parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
} else {
diff --git a/ext/spl/examples/tree.php b/ext/spl/examples/tree.php
index 6005263cc..7c630e823 100755
--- a/ext/spl/examples/tree.php
+++ b/ext/spl/examples/tree.php
@@ -37,4 +37,4 @@ foreach(new DirectoryGraphIterator($argv[1]) as $file)
echo $file . "\n";
}
-?> \ No newline at end of file
+?>
diff --git a/ext/spl/internal/splobjectstorage.inc b/ext/spl/internal/splobjectstorage.inc
index b01a85096..a6adafb67 100755
--- a/ext/spl/internal/splobjectstorage.inc
+++ b/ext/spl/internal/splobjectstorage.inc
@@ -13,7 +13,7 @@
* @brief Object storage
* @author Marcus Boerger
* @version 1.0
- * @since PHP 6.0
+ * @since PHP 5.1.2
*
* This container allows to store objects uniquly without the need to compare
* them one by one. This is only possible internally. The code represenation
@@ -115,4 +115,4 @@ class SplObjectStorage implements Iterator, Countable
}
}
-?> \ No newline at end of file
+?>
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 3f1ed7995..e4a09684a 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_spl.c,v 1.52.2.28.2.17 2007/05/19 18:40:27 iliaa Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.18 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
index 7c44f5855..09bd521f1 100755
--- a/ext/spl/php_spl.h
+++ b/ext/spl/php_spl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
index bb6af7e05..43c29e987 100755
--- a/ext/spl/spl.php
+++ b/ext/spl/spl.php
@@ -13,25 +13,25 @@
*
* SPL - Standard PHP Library
*
- * SPL is a collection of interfaces and classes that are meant to solve
- * standard problems and implements some efficient data access interfaces
- * and classes. You'll find the classes documented using php code in the
- * file spl.php or in corresponding .inc files in subdirectories examples
- * and internal. Based on the internal implementations or the files in the
+ * SPL is a collection of interfaces and classes that are meant to solve
+ * standard problems and implements some efficient data access interfaces
+ * and classes. You'll find the classes documented using php code in the
+ * file spl.php or in corresponding .inc files in subdirectories examples
+ * and internal. Based on the internal implementations or the files in the
* examples subdirectory there are also some .php files to experiment with.
- *
- * The .inc files are not included automatically because they are sooner or
- * later integrated into the extension. That means that you either need to
- * put the code of examples/autoload.inc into your autoprepend file or that
+ *
+ * The .inc files are not included automatically because they are sooner or
+ * later integrated into the extension. That means that you either need to
+ * put the code of examples/autoload.inc into your autoprepend file or that
* you have to point your ini setting auto_prepend_file to that file.
- *
+ *
* Below is a list of interfaces/classes already availabel natively through
* the SPL extension grouped by category.
- *
+ *
* 1) Iterators
- *
+ *
* SPL offers some advanced iterator algorithms:
- *
+ *
* - interface RecursiveIterator extends Iterator
* - interface OuterIterator extends Iterator
* - class RecursiveIteratorIterator implements OuterIterator
@@ -48,32 +48,32 @@
* - class AppendIterator implements OuterIterator
* - class RegexIterator extends FilterIterator
* - class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
- *
+ *
* 2) Directories and Files
- *
+ *
* SPL offers two advanced directory and file handling classes:
- *
+ *
* - class SplFileInfo
* - class DirectoryIterator extends SplFileInfo implements Iterator
* - class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
* - class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator
- *
+ *
* 3) XML
- *
+ *
* SPL offers an advanced XML handling class:
- *
+ *
* - class SimpleXMLIterator extends simplexml_element implements RecursiveIterator
- *
+ *
* 4) Array Overloading
- *
+ *
* SPL offers advanced Array overloading:
- *
+ *
* - class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
* - class ArrayIterator implements Iterator, ArrayAccess, Countable, SeekableIterator
* - class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
- *
+ *
* As the above suggest an ArrayObject creates an ArrayIterator when it comes to
- * iteration (e.g. ArrayObject instance used inside foreach).
+ * iteration (e.g. ArrayObject instance used inside foreach).
*
* 5) Counting
*
@@ -81,7 +81,7 @@
*
* 6) Exception%s
*
- * SPL provides a set of standard Exception classes each meant to indicate a
+ * SPL provides a set of standard Exception classes each meant to indicate a
* certain problem type.
*
* - class LogicException extends Exception
@@ -107,10 +107,10 @@
*
* 8) @ref Examples
*
- * The classes and interfaces in this group are contained as PHP code in the
+ * The classes and interfaces in this group are contained as PHP code in the
* examples subdirectory of ext/SPL. Sooner or later they will be moved to
* c-code.
- *
+ *
* 9) Some articles about SPL:
* - <a href="http://www.phpro.org/tutorials/Introduction-to-SPL.html">Introduction to Standard PHP Library (SPL)</a>
* - <a href="http://www.sitepoint.com/article/php5-standard-library/1">Introducing PHP 5's Standard Library</a>
@@ -131,7 +131,7 @@
* - Debug session 2 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pdf">[pdf]</a>, <a href="http://taks.somabo.de/200411_php_conference_frankfrurt_iterator_debug_session.swf">[swf]</a>
* - Debug session 3 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pdf">[pdf]</a>
*
- * You can download this documentation as a chm file
+ * You can download this documentation as a chm file
* <a href="http://php.net/~helly/php/ext/spl/spl.chm">here</a>.
*
* (c) Marcus Boerger, 2003 - 2007
@@ -139,19 +139,19 @@
/** @defgroup ZendEngine Zend engine classes
*
- * The classes and interfaces in this group are contained in the c-code of
+ * The classes and interfaces in this group are contained in the c-code of
* PHP's Zend engine.
*/
/** @defgroup SPL Internal classes
*
- * The classes and interfaces in this group are contained in the c-code of
+ * The classes and interfaces in this group are contained in the c-code of
* ext/SPL.
*/
/** @defgroup Examples Example classes
*
- * The classes and interfaces in this group are contained as PHP code in the
+ * The classes and interfaces in this group are contained as PHP code in the
* examples subdirectory of ext/SPL. Sooner or later they will be moved to
* c-code.
*/
@@ -173,13 +173,13 @@ function spl_autoload(string $class_name, string $file_extensions = NULL) {/**/}
*/
function spl_autoload_call(string $class_name) {/**/};
-/** @ingroup SPL
+/** @ingroup SPL
* @brief Register and return default file extensions for spl_autoload
* @since PHP 5.1
*
- * @param file_extensions optional comma separated list of extensions to use in
+ * @param file_extensions optional comma separated list of extensions to use in
* default autoload function. If not given just return the current list.
- * @return comma separated list of file extensions to use in default autoload
+ * @return comma separated list of file extensions to use in default autoload
* function.
*/
function spl_autoload_extensions($file_extensions) {/**/};
@@ -196,7 +196,7 @@ function spl_autoload_functions() {/**/};
* @brief Register given function as autoload implementation
* @since PHP 5.1
*
- * @param autoload_function name of function or array of object/class and
+ * @param autoload_function name of function or array of object/class and
* function name to register as autoload function.
* @param throw whether to throw or issue an error on failure.
*/
@@ -206,7 +206,7 @@ function spl_autoload_register(string $autoload_function = "spl_autoload", $thro
* @brief Unregister given function as autoload implementation
* @since PHP 5.1
*
- * @param autoload_function name of function or array of object/class and
+ * @param autoload_function name of function or array of object/class and
* function name to unregister as autoload function.
*/
function spl_autoload_unregister(string $autoload_function = "spl_autoload") {/**/};
@@ -214,7 +214,7 @@ function spl_autoload_unregister(string $autoload_function = "spl_autoload") {/*
/** @ingroup SPL
* @brief Return an array of classes and interfaces in SPL
*
- * @return array containing the names of all clsses and interfaces defined in
+ * @return array containing the names of all clsses and interfaces defined in
* extension SPL
*/
function spl_classes() {/**/};
@@ -244,26 +244,26 @@ function iterator_to_array(Traversable $it, $use_keys = true) {/**/};
class Exception
{
/** The exception message */
- protected $message;
-
- /** The string represenations as generated during construction */
- private $string;
-
- /** The code passed to the constructor */
- protected $code;
-
- /** The file name where the exception was instantiated */
- protected $file;
-
- /** The line number where the exception was instantiated */
- protected $line;
-
- /** The stack trace */
- private $trace;
+ protected $message;
+
+ /** The string represenations as generated during construction */
+ private $string;
+
+ /** The code passed to the constructor */
+ protected $code;
+
+ /** The file name where the exception was instantiated */
+ protected $file;
+
+ /** The line number where the exception was instantiated */
+ protected $line;
+
+ /** The stack trace */
+ private $trace;
/** Prevent clone
*/
- final private function __clone() {}
+ final private function __clone() {}
/** Construct an exception
*
@@ -279,55 +279,55 @@ class Exception
$this->line = __LINE__; // of throw clause
$this->trace = debug_backtrace();
$this->string = StringFormat($this);
- }
+ }
/** @return the message passed to the constructor
*/
- final public function getMessage()
- {
- return $this->message;
- }
+ final public function getMessage()
+ {
+ return $this->message;
+ }
/** @return the code passed to the constructor
*/
- final public function getCode()
- {
- return $this->code;
- }
+ final public function getCode()
+ {
+ return $this->code;
+ }
/** @return the name of the file where the exception was thrown
*/
- final public function getFile()
- {
- return $this->file;
- }
+ final public function getFile()
+ {
+ return $this->file;
+ }
/** @return the line number where the exception was thrown
*/
- final public function getLine()
- {
- return $this->line;
- }
+ final public function getLine()
+ {
+ return $this->line;
+ }
/** @return the stack trace as array
*/
- final public function getTrace()
- {
- return $this->trace;
- }
+ final public function getTrace()
+ {
+ return $this->trace;
+ }
/** @return the stack trace as string
*/
- final public function getTraceAsString()
- {
- }
+ final public function getTraceAsString()
+ {
+ }
/** @return string represenation of exception
*/
- public function __toString()
- {
- return $this->string;
- }
+ public function __toString()
+ {
+ return $this->string;
+ }
}
/** @ingroup SPL
@@ -360,7 +360,7 @@ class BadMethodCallException extends BadFunctionCallException
* @brief Exception that denotes a value not in the valid domain was used.
* @since PHP 5.1
*
- * This kind of exception should be used to inform about domain erors in
+ * This kind of exception should be used to inform about domain erors in
* mathematical sense.
*
* @see RangeException
@@ -383,7 +383,7 @@ class InvalidArgumentException extends LogicException
* @brief Exception thrown when a parameter exceeds the allowed length.
* @since PHP 5.1
*
- * This can be used for strings length, array size, file size, number of
+ * This can be used for strings length, array size, file size, number of
* elements read from an Iterator and so on.
*/
class LengthException extends LogicException
@@ -403,7 +403,7 @@ class OutOfRangeException extends LogicException
}
/** @ingroup SPL
- * @brief Exception thrown for errors that are only detectable at runtime.
+ * @brief Exception thrown for errors that are only detectable at runtime.
* @since PHP 5.1
*/
class RuntimeException extends Exception
@@ -457,7 +457,7 @@ class UnderflowException extends RuntimeException
*
* Typically this happens when a function calls another function and espects
* the return value to be of a certain type or value not including arithmetic
- * or buffer related errors.
+ * or buffer related errors.
*
* @see InvalidArgumentException
*/
@@ -496,14 +496,14 @@ interface ArrayAccess
* @since PHP 5.0
*
* Abstract base interface that cannot be implemented alone. Instead it
- * must be implemented by either IteratorAggregate or Iterator.
+ * must be implemented by either IteratorAggregate or Iterator.
*
- * @note Internal classes that implement this interface can be used in a
+ * @note Internal classes that implement this interface can be used in a
* foreach construct and do not need to implement IteratorAggregate or
* Iterator.
*
* @note This is an engine internal interface which cannot be implemented
- * in PHP scripts. Either IteratorAggregate or Iterator must be used
+ * in PHP scripts. Either IteratorAggregate or Iterator must be used
* instead.
*/
interface Traversable
@@ -515,7 +515,7 @@ interface Traversable
* @since PHP 5.0
*
* @note This is an engine internal interface.
- */
+ */
interface IteratorAggregate extends Traversable
{
/** @return an Iterator for the implementing object.
@@ -527,7 +527,7 @@ interface IteratorAggregate extends Traversable
* @brief Basic iterator
* @since PHP 5.0
*
- * Interface for external iterators or objects that can be iterated
+ * Interface for external iterators or objects that can be iterated
* themselves internally.
*
* @note This is an engine internal interface.
@@ -569,8 +569,8 @@ interface Countable
/** @ingroup ZendEngine
* @brief Interface for customized serializing
* @since 5.1
- *
- * Classes that implement this interface no longer support __sleep() and
+ *
+ * Classes that implement this interface no longer support __sleep() and
* __wakeup(). The method serialized is called whenever an instance needs to
* be serialized. This does not invoke __destruct() or has any other side
* effect unless programmed inside the method. When the data is unserialized
@@ -584,10 +584,10 @@ interface Serializable
* @return string representation of the instance
*/
function serialize();
-
+
/**
* @note This is a constructor
- *
+ *
* @param $serialized data read from stream to construct the instance
*/
function unserialize($serialized);
@@ -598,7 +598,7 @@ interface Serializable
* @since PHP 5.0
* @version 1.2
*
- * This array wrapper allows to recursively iterate over Arrays and public
+ * This array wrapper allows to recursively iterate over Arrays and public
* Object properties.
*
* @see ArrayIterator
@@ -621,14 +621,14 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
function __construct($array, $flags = 0, $iterator_class = "ArrayIterator") {/**/}
/** Set behavior flags.
- *
+ *
* @param $flags bitmask as follows:
* 0 set: properties of the object have their normal functionality
* when accessed as list (var_dump, foreach, etc.)
* 1 set: array indices can be accessed as properties in read/write
*/
function setFlags($flags) {/**/}
-
+
/** @return current flags
*/
function getFlags() {/**/}
@@ -636,27 +636,27 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
/** Sort the entries by values.
*/
function asort() {/**/}
-
+
/** Sort the entries by key.
*/
function ksort() {/**/}
-
+
/** Sort the entries by values using user defined function.
*/
function uasort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by key using user defined function.
*/
function uksort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by values using "natural order" algorithm.
*/
function natsort() {/**/}
-
+
/** Sort the entries by values using case insensitive "natural order" algorithm.
*/
function natcasesort() {/**/}
-
+
/** @param $array new array or object
*/
function exchangeArray($array) {/**/}
@@ -668,44 +668,44 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
/** @param $index offset to inspect
* @return whetehr offset $index esists
- */
+ */
function offsetExists($index) {/**/}
/** @param $index offset to return value for
* @return value at offset $index
- */
+ */
function offsetGet($index) {/**/}
/** @param $index index to set
* @param $newval new value to store at offset $index
- */
+ */
function offsetSet($index, $newval) {/**/}
/** @param $index offset to unset
- */
+ */
function offsetUnset($index) {/**/}
/** @param $value is appended as last element
- * @warning this method cannot be called when the ArrayObject refers to
+ * @warning this method cannot be called when the ArrayObject refers to
* an object.
- */
+ */
function append($value) {/**/}
/** @return a \b copy of the array
- * @note when the ArrayObject refers to an object then this method
+ * @note when the ArrayObject refers to an object then this method
* returns an array of the public properties.
- */
+ */
function getArrayCopy() {/**/}
/** @return the number of elements in the array or the number of public
* properties in the object.
*/
function count() {/**/}
-
+
/* @param $iterator_class new class used in getIterator()
*/
function setIteratorClass($itertor_class) {/**/}
-
+
/* @return class used in getIterator()
*/
function getIteratorClass() {/**/}
@@ -719,9 +719,9 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
* This iterator allows to unset and modify values and keys while iterating
* over Arrays and Objects.
*
- * When you want to iterate over the same array multiple times you need to
- * instanciate ArrayObject and let it create ArrayIterator instances that
- * refer to it either by using foreach or by calling its getIterator()
+ * When you want to iterate over the same array multiple times you need to
+ * instanciate ArrayObject and let it create ArrayIterator instances that
+ * refer to it either by using foreach or by calling its getIterator()
* method manually.
*/
class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
@@ -741,7 +741,7 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
function __construct($array, $flags = 0) {/**/}
/** Set behavior flags.
- *
+ *
* @param $flags bitmask as follows:
* 0 set: properties of the object have their normal functionality
* when accessed as list (var_dump, foreach, etc.)
@@ -757,56 +757,56 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
/** Sort the entries by values.
*/
function asort() {/**/}
-
+
/** Sort the entries by key.
*/
function ksort() {/**/}
-
+
/** Sort the entries by values using user defined function.
*/
function uasort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by key using user defined function.
*/
function uksort(mixed cmp_function) {/**/}
-
+
/** Sort the entries by values using "natural order" algorithm.
*/
function natsort() {/**/}
-
+
/** Sort the entries by values using case insensitive "natural order" algorithm.
*/
function natcasesort() {/**/}
-
+
/** @param $index offset to inspect
* @return whetehr offset $index esists
- */
+ */
function offsetExists($index) {/**/}
/** @param $index offset to return value for
* @return value at offset $index
- */
+ */
function offsetGet($index) {/**/}
/** @param $index index to set
* @param $newval new value to store at offset $index
- */
+ */
function offsetSet($index, $newval) {/**/}
/** @param $index offset to unset
- */
+ */
function offsetUnset($index) {/**/}
/** @param $value is appended as last element
- * @warning this method cannot be called when the ArrayIterator refers to
+ * @warning this method cannot be called when the ArrayIterator refers to
* an object.
- */
+ */
function append($value) {/**/}
/** @return a \b copy of the array
- * @note when the ArrayIterator refers to an object then this method
+ * @note when the ArrayIterator refers to an object then this method
* returns an array of the public properties.
- */
+ */
function getArrayCopy() {/**/}
/** @param $position offset to seek to
@@ -821,16 +821,16 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
/** @copydoc Iterator::rewind */
function rewind() {/**/}
-
+
/** @copydoc Iterator::valid */
function valid() {/**/}
-
+
/** @copydoc Iterator::current */
function current() {/**/}
-
+
/** @copydoc Iterator::key */
function key() {/**/}
-
+
/** @copydoc Iterator::next */
function next() {/**/}
}
@@ -839,7 +839,7 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
* @brief File info class
* @since PHP 5.1.3
*/
-class SplFileInfo
+class SplFileInfo
{
/** Construct a file info object
*
@@ -849,11 +849,11 @@ class SplFileInfo
/** @return the path part only.
*/
- function getPath() {/**/}
+ function getPath() {/**/}
/** @return the filename only.
*/
- function getFilename() {/**/}
+ function getFilename() {/**/}
/** @return SplFileInfo created for the file
* @param class_name name of class to instantiate
@@ -863,7 +863,7 @@ class SplFileInfo
/** @return The current entries path and file name.
*/
- function getPathname() {/**/}
+ function getPathname() {/**/}
/** @return SplFileInfo created for the path
* @param class_name name of class to instantiate
@@ -925,7 +925,7 @@ class SplFileInfo
/** @return Whether the current entry is a directory.
*/
- function isDir() {/**/}
+ function isDir() {/**/}
/** @return whether the current entry is a link.
*/
@@ -938,7 +938,7 @@ class SplFileInfo
/** @return The resolved path
*/
function getRealPath() {/**/}
-
+
/** @return getPathname()
*/
function __toString() {/**/}
@@ -948,7 +948,7 @@ class SplFileInfo
* @param mode open mode
* @param use_include_path whether to search include paths (don't use)
* @param context resource context to pased to open function
- * @throw RuntimeException if file cannot be opened (e.g. insufficient
+ * @throw RuntimeException if file cannot be opened (e.g. insufficient
* access rights).
* @return The opened file as a SplFileObject instance
*
@@ -958,7 +958,7 @@ class SplFileInfo
*/
function openFile($mode = 'r', $use_include_path = false, $context = NULL) {/**/}
- /** @param class_name name of class used with openFile(). Must be derived
+ /** @param class_name name of class used with openFile(). Must be derived
* from SPLFileObject.
*/
function setFileClass(string class_name = "SplFileObject") {/**/}
@@ -984,10 +984,10 @@ class DirectoryIterator extends SplFileInfo implements Iterator
/** @copydoc Iterator::rewind */
function rewind() {/**/}
-
+
/** @copydoc Iterator::valid */
function valid() {/**/}
-
+
/** @return index of entry
*/
function key() {/**/}
@@ -1001,7 +1001,7 @@ class DirectoryIterator extends SplFileInfo implements Iterator
/** @return Whether the current entry is either '.' or '..'.
*/
- function isDot() {/**/}
+ function isDot() {/**/}
/** @return whether the current entry is a link.
*/
@@ -1019,17 +1019,25 @@ class DirectoryIterator extends SplFileInfo implements Iterator
*/
class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
{
- const CURRENT_AS_FILEINFO 0x00000010; /* make RecursiveDirectoryTree::current() return SplFileInfo */
- const KEY_AS_FILENAME 0x00000020; /* make RecursiveDirectoryTree::key() return getFilename() */
- const NEW_CURRENT_AND_KEY 0x00000030; /* CURRENT_AS_FILEINFO + KEY_AS_FILENAME */
+ const CURRENT_AS_FILEINFO 0x00000000; /* make RecursiveDirectoryTree::current() return SplFileInfo */
+ const CURRENT_AS_SELF 0x00000010; /* make RecursiveDirectoryTree::current() return getSelf() */
+ const CURRENT_AS_PATHNAME 0x00000020; /* make RecursiveDirectoryTree::current() return getPathname() */
+
+ const KEY_AS_PATHNAME 0x00000000; /* make RecursiveDirectoryTree::key() return getPathname() */
+ const KEY_AS_FILENAME 0x00000100; /* make RecursiveDirectoryTree::key() return getFilename() */
+
+ const NEW_CURRENT_AND_KEY 0x00000100; /* CURRENT_AS_FILEINFO + KEY_AS_FILENAME */
/** Construct a directory iterator from a path-string.
*
* @param $path directory to iterate.
* @param $flags open flags
* - CURRENT_AS_FILEINFO
+ * - CURRENT_AS_SELF
+ * - CURRENT_AS_PATHNAME
+ * - KEY_AS_PATHNAME
* - KEY_AS_FILENAME
- * - NEW_CURRENT_AND_KEY
+ * - NEW_CURRENT_AND_KEY
*/
function __construct($path, $flags = 0) {/**/}
@@ -1043,11 +1051,11 @@ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveI
/** @return whether the current is a directory (not '.' or '..').
*/
- function hasChildren() {/**/}
+ function hasChildren() {/**/}
/** @return a RecursiveDirectoryIterator for the current entry.
*/
- function getChildren() {/**/}
+ function getChildren() {/**/}
/** @return sub path only (without main path)
*/
@@ -1062,7 +1070,7 @@ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveI
* @brief recursive SimpleXML_Element iterator
* @since PHP 5.0
*
- * The SimpleXMLIterator implements the RecursiveIterator interface. This
+ * The SimpleXMLIterator implements the RecursiveIterator interface. This
* allows iteration over all elements using foreach or an appropriate while
* construct, just like SimpleXMLElement does. When using the foreach construct,
* you will also iterate over the subelements. For every element which
@@ -1073,11 +1081,11 @@ class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator, C
{
/** @return whether the current node has sub nodes.
*/
- function hasChildren() {/**/}
+ function hasChildren() {/**/}
/** @return a SimpleXMLIterator for the current node.
*/
- function getChildren() {/**/}
+ function getChildren() {/**/}
/** @return number of elements/attributes seen with foreach()
*/
@@ -1085,16 +1093,16 @@ class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator, C
/** @copydoc Iterator::rewind */
function rewind() {/**/}
-
+
/** @copydoc Iterator::valid */
function valid() {/**/}
-
+
/** @copydoc Iterator::current */
function current() {/**/}
-
+
/** @copydoc Iterator::key */
function key() {/**/}
-
+
/** @copydoc Iterator::next */
function next() {/**/}
}
@@ -1126,16 +1134,16 @@ interface SplSubject
{
/** @param $observer new observer to attach
*/
- function attach(SplObserver $observer);
+ function attach(SplObserver $observer);
/** @param $observer existing observer to detach
* @note a non attached observer shouldn't result in a warning or similar
*/
- function detach(SplObserver $observer);
+ function detach(SplObserver $observer);
/** Notify all observers
*/
- function notify();
+ function notify();
}
?>
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 4f409a0f7..e6d89019d 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.71.2.17.2.14 2007/10/18 05:26:55 helly Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.15 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
index 0dc6d0073..4c6e49b97 100755
--- a/ext/spl/spl_array.h
+++ b/ext/spl/spl_array.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.h,v 1.13.2.2.2.4 2007/02/08 22:54:34 helly Exp $ */
+/* $Id: spl_array.h,v 1.13.2.2.2.5 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_ARRAY_H
#define SPL_ARRAY_H
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 930b83385..f62b261b9 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.45.2.27.2.23 2007/09/22 15:55:35 iliaa Exp $ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.26 2008/02/13 12:23:26 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -484,7 +484,7 @@ SPL_METHOD(DirectoryIterator, __construct)
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
spl_filesystem_dir_open(intern, path TSRMLS_CC);
intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0;
- intern->flags = 0;
+ intern->flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF;
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
}
@@ -661,7 +661,7 @@ SPL_METHOD(RecursiveDirectoryIterator, key)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (intern->flags & SPL_FILE_DIR_KEY_AS_FILENAME) {
+ if (SPL_FILE_DIR_KEY(intern, SPL_FILE_DIR_KEY_AS_FILENAME)) {
RETURN_STRING(intern->u.dir.entry.d_name, 1);
} else {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
@@ -676,10 +676,10 @@ SPL_METHOD(RecursiveDirectoryIterator, current)
{
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
- if (intern->flags & SPL_FILE_DIR_CURRENT_AS_PATHNAME) {
+ if (SPL_FILE_DIR_CURRENT(intern, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
RETURN_STRINGL(intern->file_name, intern->file_name_len, 1);
- } else if (intern->flags & SPL_FILE_DIR_CURRENT_AS_FILEINFO) {
+ } else if (SPL_FILE_DIR_CURRENT(intern, SPL_FILE_DIR_CURRENT_AS_FILEINFO)) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
spl_filesystem_object_create_type(0, intern, SPL_FS_INFO, NULL, return_value TSRMLS_CC);
} else {
@@ -962,7 +962,7 @@ SPL_METHOD(RecursiveDirectoryIterator, __construct)
spl_filesystem_object *intern;
char *path;
int len;
- long flags = SPL_FILE_DIR_CURRENT_AS_FILEINFO;
+ long flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO;
php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC);
@@ -1104,7 +1104,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPathname)
}
/* }}} */
-/* define an overloaded iterator structure */
+/* {{{ define an overloaded iterator structure */
typedef struct {
zend_object_iterator intern;
zval *current;
@@ -1128,6 +1128,7 @@ zend_object_iterator_funcs spl_filesystem_dir_it_funcs = {
spl_filesystem_dir_it_move_forward,
spl_filesystem_dir_it_rewind
};
+/* }}} */
/* {{{ spl_ce_dir_get_iterator */
zend_object_iterator *spl_filesystem_dir_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
@@ -1162,7 +1163,7 @@ static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter TSRMLS_DC)
efree(iterator);
}
/* }}} */
-
+
/* {{{ spl_filesystem_dir_it_valid */
static int spl_filesystem_dir_it_valid(zend_object_iterator *iter TSRMLS_DC)
{
@@ -1173,7 +1174,6 @@ static int spl_filesystem_dir_it_valid(zend_object_iterator *iter TSRMLS_DC)
}
/* }}} */
-
/* {{{ spl_filesystem_dir_it_current_data */
static void spl_filesystem_dir_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
{
@@ -1240,21 +1240,21 @@ static void spl_filesystem_tree_it_dtor(zend_object_iterator *iter TSRMLS_DC)
efree(iterator);
}
/* }}} */
-
+
/* {{{ spl_filesystem_tree_it_current_data */
static void spl_filesystem_tree_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
{
spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter;
spl_filesystem_object *object = iterator->object;
- if (object->flags & SPL_FILE_DIR_CURRENT_AS_PATHNAME) {
+ if (SPL_FILE_DIR_CURRENT(object, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
if (!iterator->current) {
ALLOC_INIT_ZVAL(iterator->current);
spl_filesystem_object_get_file_name(object TSRMLS_CC);
ZVAL_STRINGL(iterator->current, object->file_name, object->file_name_len, 1);
}
*data = &iterator->current;
- } else if (object->flags & SPL_FILE_DIR_CURRENT_AS_FILEINFO) {
+ } else if (SPL_FILE_DIR_CURRENT(object, SPL_FILE_DIR_CURRENT_AS_FILEINFO)) {
if (!iterator->current) {
ALLOC_INIT_ZVAL(iterator->current);
spl_filesystem_object_get_file_name(object TSRMLS_CC);
@@ -1273,7 +1273,7 @@ static int spl_filesystem_tree_it_current_key(zend_object_iterator *iter, char *
spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter;
spl_filesystem_object *object = iterator->object;
- if (object->flags & SPL_FILE_DIR_KEY_AS_FILENAME) {
+ if (SPL_FILE_DIR_KEY(object, SPL_FILE_DIR_KEY_AS_FILENAME)) {
*str_key_len = strlen(object->u.dir.entry.d_name) + 1;
*str_key = estrndup(object->u.dir.entry.d_name, *str_key_len - 1);
} else {
@@ -1330,7 +1330,7 @@ static void spl_filesystem_tree_it_rewind(zend_object_iterator *iter TSRMLS_DC)
}
/* }}} */
-/* iterator handler table */
+/* {{{ iterator handler table */
zend_object_iterator_funcs spl_filesystem_tree_it_funcs = {
spl_filesystem_tree_it_dtor,
spl_filesystem_dir_it_valid,
@@ -1339,6 +1339,7 @@ zend_object_iterator_funcs spl_filesystem_tree_it_funcs = {
spl_filesystem_tree_it_move_forward,
spl_filesystem_tree_it_rewind
};
+/* }}} */
/* {{{ spl_ce_dir_get_iterator */
zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
@@ -1383,7 +1384,7 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type TS
}
/* }}} */
-/* declare method parameters */
+/* {{{ declare method parameters */
/* supply a name and default to call by parameter */
static
ZEND_BEGIN_ARG_INFO(arginfo_info___construct, 0)
@@ -1444,7 +1445,7 @@ static zend_function_entry spl_SplFileInfo_functions[] = {
};
static
-ZEND_BEGIN_ARG_INFO(arginfo_dir___construct, 0)
+ZEND_BEGIN_ARG_INFO(arginfo_dir___construct, 0)
ZEND_ARG_INFO(0, path)
ZEND_END_ARG_INFO()
@@ -1487,6 +1488,7 @@ static zend_function_entry spl_RecursiveDirectoryIterator_functions[] = {
SPL_ME(RecursiveDirectoryIterator, getSubPathname,NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
+/* }}} */
static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TSRMLS_DC) /* {{{ */
{
@@ -1582,12 +1584,12 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
return result;
} /* }}} */
-#define FileFunctionCall(func_name, pass_num_args, arg2) \
+#define FileFunctionCall(func_name, pass_num_args, arg2) /* {{{ */ \
{ \
zend_function *func_ptr; \
zend_hash_find(EG(function_table), #func_name, sizeof(#func_name), (void **) &func_ptr); \
spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value, arg2 TSRMLS_CC); \
-}
+} /* }}} */
static int spl_filesystem_file_read_csv(spl_filesystem_object *intern, char delimiter, char enclosure, zval *return_value TSRMLS_DC) /* {{{ */
{
@@ -1667,7 +1669,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML
case IS_STRING:
return Z_STRLEN_P(intern->u.file.current_zval) == 0;
case IS_ARRAY:
- if ((intern->flags & SPL_FILE_OBJECT_READ_CSV)
+ if ((intern->flags & SPL_FILE_OBJECT_READ_CSV)
&& zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 1) {
zval ** first = Z_ARRVAL_P(intern->u.file.current_zval)->pListHead->pData;
@@ -2045,7 +2047,6 @@ SPL_METHOD(SplFileObject, fflush)
RETURN_BOOL(!php_stream_flush(intern->u.file.stream));
} /* }}} */
-
/* {{{ proto int SplFileObject::ftell()
Return current file position */
SPL_METHOD(SplFileObject, ftell)
@@ -2227,17 +2228,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object___construct, 0, 0, 1)
ZEND_END_ARG_INFO()
static
-ZEND_BEGIN_ARG_INFO(arginfo_file_object_setFlags, 0)
+ZEND_BEGIN_ARG_INFO(arginfo_file_object_setFlags, 0)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
static
-ZEND_BEGIN_ARG_INFO(arginfo_file_object_setMaxLineLen, 0)
+ZEND_BEGIN_ARG_INFO(arginfo_file_object_setMaxLineLen, 0)
ZEND_ARG_INFO(0, max_len)
ZEND_END_ARG_INFO()
static
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetcsv, 0, 0, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetcsv, 0, 0, 0)
ZEND_ARG_INFO(0, delimiter)
ZEND_ARG_INFO(0, enclosure)
ZEND_END_ARG_INFO()
@@ -2347,9 +2348,9 @@ PHP_MINIT_FUNCTION(spl_directory)
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO);
- REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_SELF", 0);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK);
- REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_AS_PATHNAME", 0);
+ REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME);
REGISTER_SPL_CLASS_CONST_LONG(RecursiveDirectoryIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO);
@@ -2369,7 +2370,6 @@ PHP_MINIT_FUNCTION(spl_directory)
}
/* }}} */
-
/*
* Local variables:
* tab-width: 4
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index 222ac5b59..cce07fd93 100755
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.h,v 1.12.2.5.2.4 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_directory.h,v 1.12.2.5.2.10 2008/02/13 12:23:26 helly Exp $ */
#ifndef SPL_DIRECTORY_H
#define SPL_DIRECTORY_H
@@ -35,7 +35,7 @@ PHP_MINIT_FUNCTION(spl_directory);
typedef enum {
SPL_FS_INFO, /* must be 0 */
SPL_FS_DIR,
- SPL_FS_FILE,
+ SPL_FS_FILE
} SPL_FS_OBJ_TYPE;
typedef struct _spl_filesystem_object spl_filesystem_object;
@@ -55,7 +55,7 @@ struct _spl_filesystem_object {
char *path;
int path_len;
char *file_name;
- int file_name_len;
+ int file_name_len;
SPL_FS_OBJ_TYPE type;
long flags;
zend_class_entry *file_class;
@@ -93,12 +93,16 @@ struct _spl_filesystem_object {
#define SPL_FILE_OBJECT_SKIP_EMPTY 0x00000006 /* skip empty lines */
#define SPL_FILE_OBJECT_READ_CSV 0x00000008 /* read via fgetcsv */
-#define SPL_FILE_DIR_CURRENT_AS_FILEINFO 0x00000010 /* make RecursiveDirectoryTree::current() return SplFileInfo */
+#define SPL_FILE_DIR_CURRENT_AS_FILEINFO 0x00000000 /* make RecursiveDirectoryTree::current() return SplFileInfo */
+#define SPL_FILE_DIR_CURRENT_AS_SELF 0x00000010 /* make RecursiveDirectoryTree::current() return getSelf() */
#define SPL_FILE_DIR_CURRENT_AS_PATHNAME 0x00000020 /* make RecursiveDirectoryTree::current() return getPathname() */
#define SPL_FILE_DIR_CURRENT_MODE_MASK 0x000000F0 /* mask RecursiveDirectoryTree::current() */
+#define SPL_FILE_DIR_CURRENT(intern,mode) ((intern->flags&SPL_FILE_DIR_CURRENT_MODE_MASK)==mode)
+#define SPL_FILE_DIR_KEY_AS_PATHNAME 0x00000000 /* make RecursiveDirectoryTree::key() return getPathname() */
#define SPL_FILE_DIR_KEY_AS_FILENAME 0x00000100 /* make RecursiveDirectoryTree::key() return getFilename() */
#define SPL_FILE_DIR_KEY_MODE_MASK 0x00000F00 /* mask RecursiveDirectoryTree::key() */
+#define SPL_FILE_DIR_KEY(intern,mode) ((intern->flags&SPL_FILE_DIR_KEY_MODE_MASK)==mode)
#endif /* SPL_DIRECTORY_H */
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 9404e8e24..00bacdf3a 100755
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index ecb42d304..d4a9ef47e 100755
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_engine.h,v 1.19.2.3.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_engine.h,v 1.19.2.3.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_ENGINE_H
#define SPL_ENGINE_H
diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c
index 081341312..fdbfb0069 100755
--- a/ext/spl/spl_exceptions.c
+++ b/ext/spl/spl_exceptions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_exceptions.c,v 1.6.2.1.2.2 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_exceptions.c,v 1.6.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_exceptions.h b/ext/spl/spl_exceptions.h
index 34811f876..9133b7076 100755
--- a/ext/spl/spl_exceptions.h
+++ b/ext/spl/spl_exceptions.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_exceptions.h,v 1.5.2.1.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_exceptions.h,v 1.5.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_EXCEPTIONS_H
#define SPL_EXCEPTIONS_H
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index e1fedcb0f..b7bb476ab 100755
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_functions.c,v 1.28.2.3.2.3 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_functions.c,v 1.28.2.3.2.4 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index 0a82a74da..19529a4c9 100755
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_functions.h,v 1.19.2.3.2.2 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_functions.h,v 1.19.2.3.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef PHP_FUNCTIONS_H
#define PHP_FUNCTIONS_H
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 8bd107bbf..0160b5042 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.73.2.30.2.29 2007/10/18 05:26:55 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.31 2008/03/12 13:24:24 colder Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -693,8 +693,13 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char
union _zend_function *function_handler;
spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
long level = object->level;
- zval *zobj = object->iterators[level].zobject;
-
+ zval *zobj;
+
+ if (!object->iterators) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance wasn't initialized properly", Z_OBJCE_PP(object_ptr)->name);
+ }
+ zobj = object->iterators[level].zobject;
+
function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC);
if (!function_handler) {
if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) {
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index 26c21693d..104676911 100755
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.h,v 1.18.2.7.2.12 2007/05/11 00:15:25 helly Exp $ */
+/* $Id: spl_iterators.h,v 1.18.2.7.2.14 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_ITERATORS_H
#define SPL_ITERATORS_H
@@ -94,7 +94,7 @@ enum {
enum {
/* public */
REGIT_USE_KEY = 0x00000001,
- REGIT_INVERTED = 0x00000002,
+ REGIT_INVERTED = 0x00000002
};
typedef enum {
@@ -103,7 +103,7 @@ typedef enum {
REGIT_MODE_ALL_MATCHES,
REGIT_MODE_SPLIT,
REGIT_MODE_REPLACE,
- REGIT_MODE_MAX,
+ REGIT_MODE_MAX
} regex_mode;
typedef struct _spl_dual_it_object {
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 27903e504..39a293b0f 100755
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is SplSubject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_observer.c,v 1.2.2.6.2.3 2007/02/08 22:14:25 helly Exp $ */
+/* $Id: spl_observer.c,v 1.2.2.6.2.4 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_observer.h b/ext/spl/spl_observer.h
index b6924ebd8..a1d7d5621 100755
--- a/ext/spl/spl_observer.h
+++ b/ext/spl/spl_observer.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_observer.h,v 1.2.2.2.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_observer.h,v 1.2.2.2.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_OBSERVER_H
#define SPL_OBSERVER_H
diff --git a/ext/spl/spl_sxe.c b/ext/spl/spl_sxe.c
index b7a5eac99..e5fda429f 100755
--- a/ext/spl/spl_sxe.c
+++ b/ext/spl/spl_sxe.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_sxe.c,v 1.8.2.5.2.2 2007/08/14 12:10:46 rrichards Exp $ */
+/* $Id: spl_sxe.c,v 1.8.2.5.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
diff --git a/ext/spl/spl_sxe.h b/ext/spl/spl_sxe.h
index c7c77392e..64ff2d225 100755
--- a/ext/spl/spl_sxe.h
+++ b/ext/spl/spl_sxe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_sxe.h,v 1.4.2.1.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: spl_sxe.h,v 1.4.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
#ifndef SPL_SXE_H
#define SPL_SXE_H
diff --git a/ext/spl/tests/bug41828.phpt b/ext/spl/tests/bug41828.phpt
new file mode 100644
index 000000000..6053e0e44
--- /dev/null
+++ b/ext/spl/tests/bug41828.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #41828 (Segfault if extended constructor of RecursiveIterator doesn't call its parent)
+--FILE--
+<?php
+class foo extends RecursiveIteratorIterator {
+
+ public function __construct($str) {
+ }
+
+ public function bar() {
+ }
+}
+
+$foo = new foo("This is bar");
+echo $foo->bar();
+
+?>
+==DONE==
+<?php exit(0); ?>
+--EXPECTF--
+Fatal error: main(): The foo instance wasn't initialized properly in %s on line %d
diff --git a/ext/spl/tests/dit_002.phpt b/ext/spl/tests/dit_002.phpt
new file mode 100755
index 000000000..f18d1198d
--- /dev/null
+++ b/ext/spl/tests/dit_002.phpt
@@ -0,0 +1,50 @@
+--TEST--
+SPL: DirectoryIterator defaults
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+
+$classes = array(
+ 'DirectoryIterator' => 0,
+ 'RecursiveDirectoryIterator' => 1,
+);
+
+foreach ($classes as $class => $flags) {
+ echo "===$class===\n";
+ $ref = new ReflectionClass($class);
+ $obj = $ref->newInstance('.');
+ echo get_class($obj->current()) . "\n";
+ if ($flags)
+ {
+ $flags = array(
+ RecursiveDirectoryIterator::CURRENT_AS_FILEINFO => 0,
+ RecursiveDirectoryIterator::CURRENT_AS_SELF => 0,
+ RecursiveDirectoryIterator::CURRENT_AS_PATHNAME => 1,
+ );
+ foreach($flags as $flag => $isstring) {
+ $obj = $ref->newInstance('.', $flag);
+ if ($isstring) {
+ $val = $obj->current();
+ if (is_string($val)) {
+ var_dump(true);
+ } else {
+ var_dump($val);
+ }
+ } else {
+ echo get_class($obj->current()) . "\n";
+ }
+ }
+ }
+}
+?>
+===DONE===
+--EXPECT--
+===DirectoryIterator===
+DirectoryIterator
+===RecursiveDirectoryIterator===
+SplFileInfo
+SplFileInfo
+RecursiveDirectoryIterator
+bool(true)
+===DONE===
diff --git a/ext/sqlite/pdo_sqlite2.c b/ext/sqlite/pdo_sqlite2.c
index 2064e2d70..5a6f7f5c2 100644
--- a/ext/sqlite/pdo_sqlite2.c
+++ b/ext/sqlite/pdo_sqlite2.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sqlite2.c,v 1.6.2.3.2.2 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: pdo_sqlite2.c,v 1.6.2.3.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/ext/sqlite/php_sqlite.h b/ext/sqlite/php_sqlite.h
index a2288aa77..83e420097 100644
--- a/ext/sqlite/php_sqlite.h
+++ b/ext/sqlite/php_sqlite.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
- $Id: php_sqlite.h,v 1.32.2.2.2.2 2007/05/19 17:58:22 iliaa Exp $
+ $Id: php_sqlite.h,v 1.32.2.2.2.3 2007/12/31 07:20:11 sebastian Exp $
*/
#ifndef PHP_SQLITE_H
diff --git a/ext/sqlite/sess_sqlite.c b/ext/sqlite/sess_sqlite.c
index a4f652214..e2671051c 100644
--- a/ext/sqlite/sess_sqlite.c
+++ b/ext/sqlite/sess_sqlite.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sess_sqlite.c,v 1.18.2.1.2.2 2007/05/05 15:36:15 iliaa Exp $ */
+/* $Id: sess_sqlite.c,v 1.18.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
#include "php.h"
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 184fd23fb..84cf22cd3 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
- $Id: sqlite.c,v 1.166.2.13.2.9 2007/05/19 17:58:22 iliaa Exp $
+ $Id: sqlite.c,v 1.166.2.13.2.10 2007/12/31 07:20:11 sebastian Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -1128,7 +1128,7 @@ PHP_MINFO_FUNCTION(sqlite)
{
php_info_print_table_start();
php_info_print_table_header(2, "SQLite support", "enabled");
- php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.166.2.13.2.9 2007/05/19 17:58:22 iliaa Exp $");
+ php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.166.2.13.2.10 2007/12/31 07:20:11 sebastian Exp $");
php_info_print_table_row(2, "SQLite Library", sqlite_libversion());
php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding());
php_info_print_table_end();
diff --git a/ext/standard/array.c b/ext/standard/array.c
index e3f2b7609..6f154b7d9 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.308.2.21.2.42 2007/11/06 13:28:21 jani Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.55 2008/03/12 19:13:00 felipe Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -102,7 +102,7 @@ ZEND_DECLARE_MODULE_GLOBALS(array)
*/
static void php_array_init_globals(zend_array_globals *array_globals)
{
- memset(array_globals, 0, sizeof(array_globals));
+ memset(array_globals, 0, sizeof(zend_array_globals));
}
/* }}} */
@@ -283,6 +283,11 @@ static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */
zval **element;
if (Z_TYPE_P(array) == IS_ARRAY) {
+ if (Z_ARRVAL_P(array)->nApplyCount > 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
+ return 0;
+ }
+
cnt = zend_hash_num_elements(Z_ARRVAL_P(array));
if (mode == COUNT_RECURSIVE) {
HashPosition pos;
@@ -290,7 +295,9 @@ static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **) &element, &pos) == SUCCESS;
zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)) {
+ Z_ARRVAL_P(array)->nApplyCount++;
cnt += php_count_recursive(*element, COUNT_RECURSIVE TSRMLS_CC);
+ Z_ARRVAL_P(array)->nApplyCount--;
}
}
}
@@ -324,7 +331,7 @@ PHP_FUNCTION(count)
if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval);
if (retval) {
- convert_to_long(retval);
+ convert_to_long_ex(&retval);
RETVAL_LONG(Z_LVAL_P(retval));
zval_ptr_dtor(&retval);
}
@@ -1077,7 +1084,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
if (recursive && Z_TYPE_PP(args[0]) == IS_ARRAY) {
HashTable *thash;
- SEPARATE_ZVAL_TO_MAKE_IS_REF(args[0]);
+ SEPARATE_ZVAL_IF_NOT_REF(args[0]);
thash = HASH_OF(*(args[0]));
if (thash->nApplyCount > 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
@@ -1975,6 +1982,7 @@ PHP_FUNCTION(array_push)
new_var->refcount++;
if (zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL) == FAILURE) {
+ new_var->refcount--;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element to the array as the next element is already occupied");
efree(args);
RETURN_FALSE;
@@ -2201,103 +2209,83 @@ PHP_FUNCTION(array_splice)
Returns elements specified by offset and length */
PHP_FUNCTION(array_slice)
{
- zval **input, /* Input array */
- **offset, /* Offset to get elements from */
- **length, /* How many elements to get */
- **entry, /* An array entry */
- **z_preserve_keys; /* Whether to preserve keys while copying to the new array or not */
- int offset_val, /* Value of the offset argument */
- length_val, /* Value of the length argument */
- num_in, /* Number of elements in the input array */
- pos, /* Current position in the array */
- argc; /* Number of function arguments */
-
+ zval *input, /* Input array */
+ **z_length, /* How many elements to get */
+ **entry; /* An array entry */
+ long offset, /* Offset to get elements from */
+ length = 0;
+ zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */
+ int num_in, /* Number of elements in the input array */
+ pos; /* Current position in the array */
char *string_key;
uint string_key_len;
ulong num_key;
HashPosition hpos;
- zend_bool preserve_keys = 0;
- /* Get the arguments and do error-checking */
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 4 || zend_get_parameters_ex(argc, &input, &offset, &length, &z_preserve_keys)) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|Zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) {
return;
}
-
- /* Make sure offset and length are integers and assume
- we want all entries from offset to the end if length
- is not passed */
- convert_to_long_ex(offset);
- offset_val = Z_LVAL_PP(offset);
- if (argc >= 3 && Z_TYPE_PP(length) != IS_NULL) {
- convert_to_long_ex(length);
- length_val = Z_LVAL_PP(length);
+
+ /* Get number of entries in the input hash */
+ num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
+
+ /* We want all entries from offset to the end if length is not passed or is null */
+ if (ZEND_NUM_ARGS() < 3 || Z_TYPE_PP(z_length) == IS_NULL) {
+ length = num_in;
} else {
- length_val = zend_hash_num_elements(Z_ARRVAL_PP(input));
+ convert_to_long_ex(z_length);
+ length = Z_LVAL_PP(z_length);
}
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_boolean_ex(z_preserve_keys);
- preserve_keys = Z_BVAL_PP(z_preserve_keys);
- }
-
/* Initialize returned array */
array_init(return_value);
-
- /* Get number of entries in the input hash */
- num_in = zend_hash_num_elements(Z_ARRVAL_PP(input));
-
+
/* Clamp the offset.. */
- if (offset_val > num_in)
+ if (offset > num_in) {
return;
- else if (offset_val < 0 && (offset_val = (num_in + offset_val)) < 0)
- offset_val = 0;
-
+ } else if (offset < 0 && (offset = (num_in + offset)) < 0) {
+ offset = 0;
+ }
+
/* ..and the length */
- if (length_val < 0) {
- length_val = num_in - offset_val + length_val;
- } else if (((unsigned)offset_val + (unsigned)length_val) > (unsigned)num_in) {
- length_val = num_in - offset_val;
+ if (length < 0) {
+ length = num_in - offset + length;
+ } else if (((unsigned) offset + (unsigned) length) > (unsigned) num_in) {
+ length = num_in - offset;
}
-
- if (length_val == 0)
+
+ if (length == 0) {
return;
-
+ }
+
/* Start at the beginning and go until we hit offset */
pos = 0;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &hpos);
- while (pos < offset_val && zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &hpos) == SUCCESS) {
+ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &hpos);
+ while (pos < offset && zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &hpos) == SUCCESS) {
pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &hpos);
+ zend_hash_move_forward_ex(Z_ARRVAL_P(input), &hpos);
}
-
+
/* Copy elements from input array to the one that's returned */
- while (pos < offset_val+length_val && zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &hpos) == SUCCESS) {
-
- (*entry)->refcount++;
+ while (pos < offset + length && zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &hpos) == SUCCESS) {
+
+ zval_add_ref(entry);
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &hpos)) {
+ switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 0, &hpos)) {
case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len,
- entry, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len, entry, sizeof(zval *), NULL);
break;
-
+
case HASH_KEY_IS_LONG:
- if (preserve_keys)
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key,
- entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value),
- entry, sizeof(zval *), NULL);
+ if (preserve_keys) {
+ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(zval *), NULL);
+ } else {
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry, sizeof(zval *), NULL);
+ }
break;
}
pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &hpos);
+ zend_hash_move_forward_ex(Z_ARRVAL_P(input), &hpos);
}
}
/* }}} */
@@ -2314,20 +2302,40 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS
while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) {
switch (zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos)) {
case HASH_KEY_IS_STRING:
- if (recursive &&
- zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) == SUCCESS) {
- if (*src_entry == *dest_entry && ((*dest_entry)->refcount % 2)) {
+ if (recursive && zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) == SUCCESS) {
+ HashTable *thash = HASH_OF(*dest_entry);
+
+ if ((thash && thash->nApplyCount > 1) || (*src_entry == *dest_entry && (*dest_entry)->is_ref && ((*dest_entry)->refcount % 2))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
return 0;
}
SEPARATE_ZVAL(dest_entry);
SEPARATE_ZVAL(src_entry);
- convert_to_array_ex(dest_entry);
- convert_to_array_ex(src_entry);
- if (!php_array_merge(Z_ARRVAL_PP(dest_entry),
- Z_ARRVAL_PP(src_entry), recursive TSRMLS_CC))
+ if (Z_TYPE_PP(dest_entry) == IS_NULL) {
+ convert_to_array_ex(dest_entry);
+ add_next_index_null(*dest_entry);
+ } else {
+ convert_to_array_ex(dest_entry);
+ }
+ if (Z_TYPE_PP(src_entry) == IS_NULL) {
+ convert_to_array_ex(src_entry);
+ add_next_index_null(*src_entry);
+ } else {
+ convert_to_array_ex(src_entry);
+ }
+ if (thash) {
+ thash->nApplyCount++;
+ }
+ if (!php_array_merge(Z_ARRVAL_PP(dest_entry), Z_ARRVAL_PP(src_entry), recursive TSRMLS_CC)) {
+ if (thash) {
+ thash->nApplyCount--;
+ }
return 0;
+ }
+ if (thash) {
+ thash->nApplyCount--;
+ }
} else {
(*src_entry)->refcount++;
@@ -2655,6 +2663,11 @@ PHP_FUNCTION(array_pad)
/* Do some initial calculations */
input_size = zend_hash_num_elements(Z_ARRVAL_PP(input));
pad_size_abs = abs(Z_LVAL_PP(pad_size));
+ if (pad_size_abs < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time");
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
do_pad = (input_size >= pad_size_abs) ? 0 : 1;
/* Copy the original array */
@@ -3722,13 +3735,14 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
}
c = 1;
for (i = 1; i < arr_argc; i++) {
+ Bucket **ptr = ptrs[i];
if (behavior == DIFF_NORMAL) {
- while (*ptrs[i] && (0 < (c = diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
- ptrs[i]++;
+ while (*ptr && (0 < (c = diff_data_compare_func(ptrs[0], ptr TSRMLS_CC)))) {
+ ptr++;
}
} else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */
- while (*ptrs[i] && (0 < (c = diff_key_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) {
- ptrs[i]++;
+ while (*ptr && (0 != (c = diff_key_compare_func(ptrs[0], ptr TSRMLS_CC)))) {
+ ptr++;
}
}
if (!c) {
@@ -3742,11 +3756,11 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
In this branch is execute only when DIFF_ASSOC. If behavior == DIFF_KEY
data comparison is not needed - skipped.
*/
- if (*ptrs[i]) {
+ if (*ptr) {
if (data_compare_type == DIFF_COMP_DATA_USER) {
BG(user_compare_func_name) = args[arr_argc];
}
- if (diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC) != 0) {
+ if (diff_data_compare_func(ptrs[0], ptr TSRMLS_CC) != 0) {
/* the data is not the same */
c = -1;
if (key_compare_type == DIFF_COMP_KEY_USER) {
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 220ffad51..c4fb5a13e 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: assert.c,v 1.60.2.3.2.6 2007/02/16 16:35:04 dmitry Exp $ */
+/* $Id: assert.c,v 1.60.2.3.2.7 2007/12/31 07:20:12 sebastian Exp $ */
/* {{{ includes/startup/misc */
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index 2bfe83198..b3179b99f 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: base64.c,v 1.43.2.2.2.3 2007/07/21 01:24:26 jani Exp $ */
+/* $Id: base64.c,v 1.43.2.2.2.4 2007/12/31 07:20:12 sebastian Exp $ */
#include <string.h>
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
index 20c3f3dbe..11a65e1b1 100644
--- a/ext/standard/base64.h
+++ b/ext/standard/base64.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: base64.h,v 1.14.2.1.2.2 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: base64.h,v 1.14.2.1.2.3 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef BASE64_H
#define BASE64_H
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 43b3b1407..3d61f3d0c 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.725.2.31.2.66 2007/10/22 07:37:20 dmitry Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.69 2008/03/20 00:55:26 dsp Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -4568,10 +4568,11 @@ PHP_FUNCTION(getopt)
* in order to be on the safe side, even though it is also available
* from the symbol table.
*/
- if (zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE ||
- zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void **) &args) != FAILURE) {
+ if ((zend_hash_find(HASH_OF(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), (void **) &args) != FAILURE ||
+ zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void **) &args) != FAILURE) && Z_TYPE_PP(args) == IS_ARRAY
+ ) {
int pos = 0;
- zval **arg;
+ zval **entry;
argc = zend_hash_num_elements(Z_ARRVAL_PP(args));
@@ -4586,8 +4587,22 @@ PHP_FUNCTION(getopt)
/* Iterate over the hash to construct the argv array. */
while (zend_hash_get_current_data(Z_ARRVAL_PP(args),
- (void **)&arg) == SUCCESS) {
- argv[pos++] = estrdup(Z_STRVAL_PP(arg));
+ (void **)&entry) == SUCCESS) {
+ zval arg, *arg_ptr = *entry;
+
+ if (Z_TYPE_PP(entry) != IS_STRING) {
+ arg = **entry;
+ zval_copy_ctor(&arg);
+ convert_to_string(&arg);
+ arg_ptr = &arg;
+ }
+
+ argv[pos++] = estrdup(Z_STRVAL_P(arg_ptr));
+
+ if (arg_ptr != *entry) {
+ zval_dtor(&arg);
+ }
+
zend_hash_move_forward(Z_ARRVAL_PP(args));
}
@@ -4605,7 +4620,7 @@ PHP_FUNCTION(getopt)
#ifdef HARTMUT_0
int len, c = zend_hash_num_elements(Z_ARRVAL_P(p_longopts));
struct option *p;
- zval **arg;
+ zval **entry;
char *name;
longopts = (struct option *)ecalloc(c+1, sizeof(struct option));
@@ -4618,10 +4633,19 @@ PHP_FUNCTION(getopt)
/* Iterate over the hash to construct the argv array. */
while (zend_hash_get_current_data(Z_ARRVAL_P(p_longopts),
- (void **)&arg) == SUCCESS) {
+ (void **)&entry) == SUCCESS) {
+ zval arg, *arg_ptr = *entry;
+
+ if (Z_TYPE_PP(entry) != IS_STRING) {
+ arg = **entry;
+ zval_copy_ctor(&arg);
+ convert_to_string(&arg);
+ arg_ptr = &arg;
+ }
+
p->has_arg = 0;
- name = estrdup(Z_STRVAL_PP(arg));
+ name = estrdup(Z_STRVAL_P(arg_ptr));
len = strlen(name);
if((len > 0) && (name[len-1] == ':')) {
p->has_arg++;
@@ -4636,6 +4660,10 @@ PHP_FUNCTION(getopt)
p->flag = NULL;
p->val = 0;
+ if (arg_ptr != *entry) {
+ zval_dtor(&arg);
+ }
+
zend_hash_move_forward(Z_ARRVAL_P(p_longopts));
p++;
}
@@ -5191,8 +5219,10 @@ PHP_FUNCTION(call_user_method)
SEPARATE_ZVAL(params[0]);
convert_to_string(*params[0]);
- if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL TSRMLS_CC) == SUCCESS) {
+ if (retval_ptr) {
+ COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ }
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_PP(params[0]));
}
@@ -5233,8 +5263,10 @@ PHP_FUNCTION(call_user_method_array)
element++;
}
- if (call_user_function_ex(EG(function_table), obj, *method_name, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ if (call_user_function_ex(EG(function_table), obj, *method_name, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) {
+ if (retval_ptr) {
+ COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ }
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_PP(method_name));
}
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 767ca8b2e..b9269fe8a 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.h,v 1.139.2.4.2.6 2007/07/21 01:24:26 jani Exp $ */
+/* $Id: basic_functions.h,v 1.139.2.4.2.7 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef BASIC_FUNCTIONS_H
#define BASIC_FUNCTIONS_H
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index 3e661fd9b..f8fde93dd 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: browscap.c,v 1.85.2.2.2.4 2007/10/04 13:31:10 jani Exp $ */
+/* $Id: browscap.c,v 1.85.2.2.2.5 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "php_regex.h"
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index 7116e468a..44e711b1b 100644
--- a/ext/standard/crc32.c
+++ b/ext/standard/crc32.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: crc32.c,v 1.16.2.4.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: crc32.c,v 1.16.2.4.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "basic_functions.h"
diff --git a/ext/standard/crc32.h b/ext/standard/crc32.h
index 3fa98d45a..477bac1de 100644
--- a/ext/standard/crc32.h
+++ b/ext/standard/crc32.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: crc32.h,v 1.6.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: crc32.h,v 1.6.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
/*
* This code implements the AUTODIN II polynomial
diff --git a/ext/standard/credits.c b/ext/standard/credits.c
index cef6c76dd..d6f0a8e6f 100644
--- a/ext/standard/credits.c
+++ b/ext/standard/credits.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: credits.c,v 1.36.2.4.2.4 2007/05/22 15:44:11 bjori Exp $ */
+/* $Id: credits.c,v 1.36.2.4.2.6 2008/04/10 05:32:26 philip Exp $ */
#include "php.h"
#include "info.h"
@@ -96,9 +96,9 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC)
if (flag & PHP_CREDITS_DOCS) {
php_info_print_table_start();
php_info_print_table_colspan_header(2, "PHP Documentation");
- CREDIT_LINE("Authors", "Mehdi Achour, Friedhelm Betz, Antony Dovgal, Nuno Lopes, Philip Olson, Georg Richter, Damien Seguy, Jakub Vrana");
+ CREDIT_LINE("Authors", "Mehdi Achour, Friedhelm Betz, Antony Dovgal, Nuno Lopes, Hannes Magnusson, Georg Richter, Damien Seguy, Jakub Vrana");
CREDIT_LINE("Editor", "Philip Olson");
- CREDIT_LINE("User Note Maintainers", "Mehdi Achour, Friedhelm Betz, Vincent Gevers, Aidan Lister, Nuno Lopes, Tom Sommer");
+ CREDIT_LINE("User Note Maintainers", "Friedhelm Betz, Etienne Kneuss, Nuno Lopes, Hannes Magnusson, Felipe Pena, Maciek Sokolewicz");
CREDIT_LINE("Other Contributors", "Previously active authors, editors and other contributors are listed in the manual.");
php_info_print_table_end();
}
diff --git a/ext/standard/credits.h b/ext/standard/credits.h
index 27ad4dd41..f8466147a 100644
--- a/ext/standard/credits.h
+++ b/ext/standard/credits.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: credits.h,v 1.11.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: credits.h,v 1.11.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef CREDITS_H
#define CREDITS_H
diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h
index b468545c6..2288bb812 100644
--- a/ext/standard/credits_ext.h
+++ b/ext/standard/credits_ext.h
@@ -79,7 +79,7 @@ CREDIT_LINE("System V Message based IPC", "Wez Furlong");
CREDIT_LINE("System V Semaphores", "Tom May");
CREDIT_LINE("System V Shared Memory", "Christian Cartus");
CREDIT_LINE("tidy", "John Coggeshall, Ilia Alshanetsky");
-CREDIT_LINE("tokenizer", "Andrei Zmievski");
+CREDIT_LINE("tokenizer", "Andrei Zmievski, Johannes Schlueter");
CREDIT_LINE("WDDX", "Andrei Zmievski");
CREDIT_LINE("XMLReader", "Rob Richards");
CREDIT_LINE("xmlrpc", "Dan Libby");
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 2a74d1bd0..fa51d6f7d 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Rasmus Lerdorf <rasmus@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: crypt.c,v 1.62.2.1.2.6 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: crypt.c,v 1.62.2.1.2.7 2007/12/31 07:20:12 sebastian Exp $ */
#include <stdlib.h>
#include "php.h"
diff --git a/ext/standard/css.c b/ext/standard/css.c
index 8595e0d3d..e138ab6c6 100644
--- a/ext/standard/css.c
+++ b/ext/standard/css.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: css.c,v 1.13.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: css.c,v 1.13.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "info.h"
diff --git a/ext/standard/css.h b/ext/standard/css.h
index fdced8f61..ad80fa783 100644
--- a/ext/standard/css.h
+++ b/ext/standard/css.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: css.h,v 1.6.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: css.h,v 1.6.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef CSS_H
#define CSS_H
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
index ac2eef59b..ff1bd5f94 100644
--- a/ext/standard/cyr_convert.c
+++ b/ext/standard/cyr_convert.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cyr_convert.c,v 1.27.2.3.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: cyr_convert.c,v 1.27.2.3.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#include <stdlib.h>
diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h
index fba4877ba..970edc992 100644
--- a/ext/standard/cyr_convert.h
+++ b/ext/standard/cyr_convert.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cyr_convert.h,v 1.11.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: cyr_convert.h,v 1.11.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef CYR_CONVERT_H
#define CYR_CONVERT_H
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index afb5e771d..c0bb09be0 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: datetime.c,v 1.134.2.2.2.4 2007/06/07 08:59:00 tony2001 Exp $ */
+/* $Id: datetime.c,v 1.134.2.2.2.5 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "zend_operators.h"
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
index 1f8bcc99f..c0c7a47d0 100644
--- a/ext/standard/datetime.h
+++ b/ext/standard/datetime.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: datetime.h,v 1.23.2.2.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: datetime.h,v 1.23.2.2.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef DATETIME_H
#define DATETIME_H
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index a3f540d2e..f6737ed1a 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dir.c,v 1.147.2.3.2.12 2007/09/19 22:37:58 iliaa Exp $ */
+/* $Id: dir.c,v 1.147.2.3.2.16 2008/03/05 12:10:18 tony2001 Exp $ */
/* {{{ includes/startup/misc */
@@ -256,14 +256,16 @@ PHP_FUNCTION(closedir)
{
zval **id, **tmp, *myself;
php_stream *dirp;
+ int rsrc_id;
FETCH_DIRP();
- if (dirp->rsrc_id == DIRG(default_dir)) {
+ rsrc_id = dirp->rsrc_id;
+ zend_list_delete(dirp->rsrc_id);
+
+ if (rsrc_id == DIRG(default_dir)) {
php_set_default_dir(-1 TSRMLS_CC);
}
-
- zend_list_delete(dirp->rsrc_id);
}
/* }}} */
@@ -467,7 +469,7 @@ no_results:
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))) {
+ if (PG(safe_mode) && (!php_checkuid_ex(globbuf.gl_pathv[n], NULL, CHECKUID_CHECK_FILE_AND_DIR, CHECKUID_NO_ERRORS))) {
basedir_limit = 1;
continue;
} else if (php_check_open_basedir_ex(globbuf.gl_pathv[n], 0 TSRMLS_CC)) {
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 09f186cf0..f652d2536 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dl.c,v 1.106.2.1.2.5 2007/09/18 20:19:34 stas Exp $ */
+/* $Id: dl.c,v 1.106.2.1.2.6 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "dl.h"
diff --git a/ext/standard/dl.h b/ext/standard/dl.h
index 114680770..6b00fa74e 100644
--- a/ext/standard/dl.h
+++ b/ext/standard/dl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dl.h,v 1.23.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: dl.h,v 1.23.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef DL_H
#define DL_H
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index aba99dc79..a224a1cd9 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dns.c,v 1.70.2.7.2.5 2007/06/26 11:04:55 tony2001 Exp $ */
+/* $Id: dns.c,v 1.70.2.7.2.6 2007/12/31 07:20:12 sebastian Exp $ */
/* {{{ includes */
#include "php.h"
diff --git a/ext/standard/dns.h b/ext/standard/dns.h
index cc4772aab..356ced73e 100644
--- a/ext/standard/dns.h
+++ b/ext/standard/dns.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dns.h,v 1.19.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: dns.h,v 1.19.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef DNS_H
#define DNS_H
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 8f999c39f..7f1aea174 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
| Ilia Alshanetsky <iliaa@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.113.2.3.2.2 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: exec.c,v 1.113.2.3.2.10 2008/04/08 17:17:07 iliaa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -25,6 +25,7 @@
#include "safe_mode.h"
#include "ext/standard/head.h"
#include "ext/standard/file.h"
+#include "basic_functions.h"
#include "exec.h"
#include "php_globals.h"
#include "SAPI.h"
@@ -265,11 +266,25 @@ char *php_escape_shell_cmd(char *str) {
register int x, y, l;
char *cmd;
char *p = NULL;
+
+ TSRMLS_FETCH();
l = strlen(str);
cmd = safe_emalloc(2, l, 1);
for (x = 0, y = 0; x < l; x++) {
+ int mb_len = php_mblen(str + x, (l - x));
+
+ /* skip non-valid multibyte characters */
+ if (mb_len < 0) {
+ continue;
+ } else if (mb_len > 1) {
+ memcpy(cmd + y, str + x, mb_len);
+ y += mb_len;
+ x += mb_len - 1;
+ continue;
+ }
+
switch (str[x]) {
case '"':
case '\'':
@@ -328,6 +343,7 @@ char *php_escape_shell_cmd(char *str) {
char *php_escape_shell_arg(char *str) {
int x, y, l;
char *cmd;
+ TSRMLS_FETCH();
y = 0;
l = strlen(str);
@@ -341,6 +357,18 @@ char *php_escape_shell_arg(char *str) {
#endif
for (x = 0; x < l; x++) {
+ int mb_len = php_mblen(str + x, (l - x));
+
+ /* skip non-valid multibyte characters */
+ if (mb_len < 0) {
+ continue;
+ } else if (mb_len > 1) {
+ memcpy(cmd + y, str + x, mb_len);
+ y += mb_len;
+ x += mb_len - 1;
+ continue;
+ }
+
switch (str[x]) {
#ifdef PHP_WIN32
case '"':
@@ -372,18 +400,19 @@ char *php_escape_shell_arg(char *str) {
Escape shell metacharacters */
PHP_FUNCTION(escapeshellcmd)
{
- zval **arg1;
+ char *command;
+ int command_len;
char *cmd = NULL;
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(arg1);
- if (Z_STRLEN_PP(arg1)) {
- cmd = php_escape_shell_cmd(Z_STRVAL_PP(arg1));
- RETVAL_STRING(cmd, 1);
- efree(cmd);
+
+ if (command_len) {
+ cmd = php_escape_shell_cmd(command);
+ RETVAL_STRING(cmd, 0);
+ } else {
+ RETVAL_EMPTY_STRING();
}
}
/* }}} */
@@ -392,18 +421,17 @@ PHP_FUNCTION(escapeshellcmd)
Quote and escape an argument for use in a shell command */
PHP_FUNCTION(escapeshellarg)
{
- zval **arg1;
+ char *argument;
+ int argument_len;
char *cmd = NULL;
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(arg1);
- if (Z_STRLEN_PP(arg1)) {
- cmd = php_escape_shell_arg(Z_STRVAL_PP(arg1));
- RETVAL_STRING(cmd, 1);
- efree(cmd);
+
+ if (argument) {
+ cmd = php_escape_shell_arg(argument);
+ RETVAL_STRING(cmd, 0);
}
}
/* }}} */
diff --git a/ext/standard/exec.h b/ext/standard/exec.h
index 43d798b2b..371f695e1 100644
--- a/ext/standard/exec.h
+++ b/ext/standard/exec.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: exec.h,v 1.24.2.3.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: exec.h,v 1.24.2.3.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef EXEC_H
#define EXEC_H
diff --git a/ext/standard/file.c b/ext/standard/file.c
index e10295496..8ff709c58 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.409.2.6.2.28 2007/09/04 12:51:49 iliaa Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.31 2007/12/31 07:20:12 sebastian Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -592,6 +592,7 @@ PHP_FUNCTION(file_put_contents)
zval *zcontext = NULL;
php_stream_context *context = NULL;
php_stream *srcstream = NULL;
+ char mode[3] = "wb";
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/|lr!", &filename, &filename_len,
&data, &flags, &zcontext) == FAILURE) {
@@ -604,8 +605,14 @@ PHP_FUNCTION(file_put_contents)
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
- stream = php_stream_open_wrapper_ex(filename, (flags & PHP_FILE_APPEND) ? "ab" : "wb",
- ((flags & PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
+ if (flags & PHP_FILE_APPEND) {
+ mode[0] = 'a';
+ } else if (flags & LOCK_EX) {
+ mode[0] = 'c';
+ }
+ mode[2] = '\0';
+
+ stream = php_stream_open_wrapper_ex(filename, mode, ((flags & PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
if (stream == NULL) {
RETURN_FALSE;
}
@@ -615,6 +622,10 @@ PHP_FUNCTION(file_put_contents)
RETURN_FALSE;
}
+ if (mode[0] == 'c') {
+ php_stream_truncate_set_size(stream, 0);
+ }
+
switch (Z_TYPE_P(data)) {
case IS_RESOURCE:
numbytes = php_stream_copy_to_stream(srcstream, stream, PHP_STREAM_COPY_ALL);
diff --git a/ext/standard/file.h b/ext/standard/file.h
index 7a1c7d1b3..d4d16bc09 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.h,v 1.94.2.2.2.5 2007/01/10 14:40:06 bjori Exp $ */
+/* $Id: file.h,v 1.94.2.2.2.6 2007/12/31 07:20:12 sebastian Exp $ */
/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index df60b2e2d..a9f3f1000 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filestat.c,v 1.136.2.8.2.15 2007/10/31 13:23:06 jani Exp $ */
+/* $Id: filestat.c,v 1.136.2.8.2.16 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "safe_mode.h"
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 763272460..4e41063c4 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filters.c,v 1.44.2.6.2.5 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: filters.c,v 1.44.2.6.2.6 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "php_globals.h"
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index c153c3457..167702b85 100644
--- a/ext/standard/flock_compat.c
+++ b/ext/standard/flock_compat.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: flock_compat.c,v 1.29.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: flock_compat.c,v 1.29.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include <errno.h>
diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h
index 51ae7ac4e..ac6d55cb3 100644
--- a/ext/standard/flock_compat.h
+++ b/ext/standard/flock_compat.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: flock_compat.h,v 1.20.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: flock_compat.h,v 1.20.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef FLOCK_COMPAT_H
#define FLOCK_COMPAT_H
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 46c782536..662d85cd2 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: formatted_print.c,v 1.82.2.1.2.17 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: formatted_print.c,v 1.82.2.1.2.19 2008/03/17 23:00:41 stas Exp $ */
#include <math.h> /* modf() */
#include "php.h"
@@ -76,6 +76,7 @@ php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add,
register int npad;
int req_size;
int copy_len;
+ int m_width;
copy_len = (expprec ? MIN(max_width, len) : len);
npad = min_width - copy_len;
@@ -86,11 +87,19 @@ php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add,
PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n",
*buffer, *pos, *size, add, min_width, padding, alignment));
+ m_width = MAX(min_width, copy_len);
- req_size = *pos + MAX(min_width, copy_len) + 1;
+ if(m_width > INT_MAX - *pos - 1) {
+ zend_error_noreturn(E_ERROR, "Field width %d is too long", m_width);
+ }
+
+ req_size = *pos + m_width + 1;
if (req_size > *size) {
while (req_size > *size) {
+ if(*size > INT_MAX/2) {
+ zend_error_noreturn(E_ERROR, "Field width %d is too long", req_size);
+ }
*size <<= 1;
}
PRINTF_DEBUG(("sprintf ereallocing buffer to %d bytes\n", *size));
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index 5dedcc841..d54b3b5e9 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fsock.c,v 1.121.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: fsock.c,v 1.121.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "php_globals.h"
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
index 6ae55d19a..10531b68a 100644
--- a/ext/standard/fsock.h
+++ b/ext/standard/fsock.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fsock.h,v 1.50.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: fsock.h,v 1.50.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
/* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c
index a63708177..40b74d547 100644
--- a/ext/standard/ftok.c
+++ b/ext/standard/ftok.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftok.c,v 1.16.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: ftok.c,v 1.16.2.1.2.2 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index e408615b6..c2e3896dc 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.6 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.9 2008/01/08 19:10:16 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -300,19 +300,21 @@ connect_errexit:
/* {{{ php_fopen_do_pasv
*/
-static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, int ip_size, char **phoststart TSRMLS_DC)
+static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char **phoststart TSRMLS_DC)
{
char tmp_line[512];
int result, i;
unsigned short portno;
char *tpath, *ttpath, *hoststart=NULL;
+#ifdef HAVE_IPV6
/* We try EPSV first, needed for IPv6 and works on some IPv4 servers */
php_stream_write_string(stream, "EPSV\r\n");
result = GET_FTP_RESULT(stream);
/* check if we got a 229 response */
if (result != 229) {
+#endif
/* EPSV failed, let's try PASV */
php_stream_write_string(stream, "PASV\r\n");
result = GET_FTP_RESULT(stream);
@@ -357,6 +359,8 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, int ip_siz
tpath++;
/* pull out the LSB of the port */
portno += (unsigned short) strtoul(tpath, &ttpath, 10);
+
+#ifdef HAVE_IPV6
} else {
/* parse epsv command (|||6446|) */
for (i = 0, tpath = tmp_line + 4; *tpath; tpath++) {
@@ -372,7 +376,8 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, int ip_siz
/* pull out the port */
portno = (unsigned short) strtoul(tpath + 1, &ttpath, 10);
}
-
+#endif
+
if (ttpath == NULL) {
/* didn't get correct response from EPSV/PASV */
return 0;
@@ -771,6 +776,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int f
ssb->sb.st_mode |= S_IFDIR;
}
+ php_stream_write_string(stream, "TYPE I\r\n"); /* we need this since some servers refuse to accept SIZE command in ASCII mode */
php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n", (resource->path != NULL ? resource->path : "/"));
result = GET_FTP_RESULT(stream);
if (result < 200 || result > 299) {
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 868015f9e..f0502ab21 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: head.c,v 1.84.2.1.2.7 2007/02/26 02:12:36 iliaa Exp $ */
+/* $Id: head.c,v 1.84.2.1.2.8 2007/12/31 07:20:12 sebastian Exp $ */
#include <stdio.h>
#include "php.h"
diff --git a/ext/standard/head.h b/ext/standard/head.h
index 1afac8063..365ef3ea1 100644
--- a/ext/standard/head.h
+++ b/ext/standard/head.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: head.h,v 1.28.2.1.2.2 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: head.h,v 1.28.2.1.2.3 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef HEAD_H
#define HEAD_H
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 357257997..dd8afdc9c 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.c,v 1.111.2.2.2.15 2007/10/03 04:53:05 stas Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.20 2008/04/11 19:01:25 felipe Exp $ */
/*
* HTML entity resources:
@@ -847,7 +847,7 @@ det_charset:
/* now walk the charset map and look for the codeset */
for (i = 0; charset_map[i].codeset; i++) {
- if (strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) {
+ if (len == strlen(charset_map[i].codeset) && strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) {
charset = charset_map[i].charset;
found = 1;
break;
@@ -954,6 +954,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
case cs_cp1251:
case cs_8859_5:
case cs_cp866:
+ case cs_koi8r:
replacement[0] = k;
replacement[1] = '\0';
replacement_len = 1;
diff --git a/ext/standard/html.h b/ext/standard/html.h
index b7ef2823c..e5bdafc4d 100644
--- a/ext/standard/html.h
+++ b/ext/standard/html.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.h,v 1.20.2.1.2.3 2007/05/22 12:37:00 iliaa Exp $ */
+/* $Id: html.h,v 1.20.2.1.2.4 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef HTML_H
#define HTML_H
diff --git a/ext/standard/http.c b/ext/standard/http.c
index a82ca61fa..85ad35c83 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http.c,v 1.14.2.4.2.4 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: http.c,v 1.14.2.4.2.6 2008/01/10 20:32:41 shire Exp $ */
#include "php_http.h"
#include "php_ini.h"
@@ -105,7 +105,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
*p = '\0';
} else {
/* Is an integer key */
- ekey_len = spprintf(&ekey, 12, "%ld", idx);
+ ekey_len = spprintf(&ekey, 0, "%ld", idx);
newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
@@ -153,7 +153,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
if (num_prefix) {
smart_str_appendl(formstr, num_prefix, num_prefix_len);
}
- ekey_len = spprintf(&ekey, 12, "%ld", idx);
+ ekey_len = spprintf(&ekey, 0, "%ld", idx);
smart_str_appendl(formstr, ekey, ekey_len);
efree(ekey);
}
@@ -165,10 +165,10 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
break;
case IS_LONG:
case IS_BOOL:
- ekey_len = spprintf(&ekey, 12, "%ld", Z_LVAL_PP(zdata));
+ ekey_len = spprintf(&ekey, 0, "%ld", Z_LVAL_PP(zdata));
break;
case IS_DOUBLE:
- ekey_len = spprintf(&ekey, 48, "%.*G", (int) EG(precision), Z_DVAL_PP(zdata));
+ ekey_len = spprintf(&ekey, 0, "%.*G", (int) EG(precision), Z_DVAL_PP(zdata));
break;
default:
/* fall back on convert to string */
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 0d964fd14..bdd811f8a 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.10 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.12 2008/04/08 00:03:34 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -105,6 +105,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
char *protocol_version = NULL;
int protocol_version_len = 3; /* Default: "1.0" */
struct timeval timeout;
+ char *user_headers = NULL;
tmp_line[0] = '\0';
@@ -351,10 +352,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
efree(tmp);
tmp = tmp_c;
}
-
- /* Output trimmed headers with \r\n at the end */
- php_stream_write(stream, tmp, strlen(tmp));
- php_stream_write(stream, "\r\n", sizeof("\r\n") - 1);
+
+ user_headers = estrdup(tmp);
/* Make lowercase for easy comparison against 'standard' headers */
php_strtolower(tmp, strlen(tmp));
@@ -452,6 +451,27 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
}
}
+ if (user_headers) {
+ /* A bit weird, but some servers require that Content-Length be sent prior to Content-Type for POST
+ * see bug #44603 for details. Since Content-Type maybe part of user's headers we need to do this check first.
+ */
+ if (
+ header_init &&
+ context &&
+ !(have_header & HTTP_HEADER_CONTENT_LENGTH) &&
+ php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS &&
+ Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0
+ ) {
+ scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval));
+ php_stream_write(stream, scratch, scratch_len);
+ have_header |= HTTP_HEADER_CONTENT_LENGTH;
+ }
+
+ php_stream_write(stream, user_headers, strlen(user_headers));
+ php_stream_write(stream, "\r\n", sizeof("\r\n")-1);
+ efree(user_headers);
+ }
+
/* Request content, such as for POST requests */
if (header_init && context &&
php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS &&
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 0356da8dc..8dbd04299 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: image.c,v 1.114.2.2.2.6 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: image.c,v 1.114.2.2.2.7 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include <stdio.h>
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index 3f6d85bd1..d669f2ce6 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
*/
-/* $Id: incomplete_class.c,v 1.28.2.2.2.2 2007/02/01 14:07:43 tony2001 Exp $ */
+/* $Id: incomplete_class.c,v 1.28.2.2.2.3 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "basic_functions.h"
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 0c6741952..6cd9057a3 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.249.2.10.2.14 2007/07/21 01:24:26 jani Exp $ */
+/* $Id: info.c,v 1.249.2.10.2.17 2008/03/05 21:09:29 pajoye Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -277,7 +277,7 @@ PHPAPI char *php_get_uname(char mode)
php_uname = tmp_uname;
break;
case PROCESSOR_ARCHITECTURE_MIPS :
- php_uname = "MIPS R4000";
+ snprintf(tmp_uname, sizeof(tmp_uname), "MIPS R%d000", SysInfo.wProcessorLevel);
php_uname = tmp_uname;
break;
case PROCESSOR_ARCHITECTURE_ALPHA :
@@ -326,6 +326,30 @@ PHPAPI char *php_get_uname(char mode)
if (uname((struct utsname *)&buf) == -1) {
php_uname = PHP_UNAME;
} else {
+#ifdef NETWARE
+ if (mode == 's') {
+ php_uname = buf.sysname;
+ } else if (mode == 'r') {
+ snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d",
+ buf.netware_major, buf.netware_minor, buf.netware_revision);
+ php_uname = tmp_uname;
+ } else if (mode == 'n') {
+ php_uname = buf.servername;
+ } else if (mode == 'v') {
+ snprintf(tmp_uname, sizeof(tmp_uname), "libc-%d.%d.%d #%d",
+ buf.libmajor, buf.libminor, buf.librevision, buf.libthreshold);
+ php_uname = tmp_uname;
+ } else if (mode == 'm') {
+ php_uname = buf.machine;
+ } else { /* assume mode == 'a' */
+ snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %d.%d.%d libc-%d.%d.%d #%d %s",
+ buf.sysname, buf.servername,
+ buf.netware_major, buf.netware_minor, buf.netware_revision,
+ buf.libmajor, buf.libminor, buf.librevision, buf.libthreshold,
+ buf.machine);
+ php_uname = tmp_uname;
+ }
+#else
if (mode == 's') {
php_uname = buf.sysname;
} else if (mode == 'r') {
@@ -342,6 +366,7 @@ PHPAPI char *php_get_uname(char mode)
buf.machine);
php_uname = tmp_uname;
}
+#endif /* NETWARE */
}
#else
php_uname = PHP_UNAME;
diff --git a/ext/standard/info.h b/ext/standard/info.h
index e41257a18..931c842ef 100644
--- a/ext/standard/info.h
+++ b/ext/standard/info.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.h,v 1.38.2.1.2.5 2007/06/09 11:44:08 sniper Exp $ */
+/* $Id: info.h,v 1.38.2.1.2.6 2007/12/31 07:20:12 sebastian Exp $ */
#ifndef INFO_H
#define INFO_H
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index 8939779df..578534d41 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iptc.c,v 1.50.2.2.2.5 2007/05/10 12:23:25 tony2001 Exp $ */
+/* $Id: iptc.c,v 1.50.2.2.2.6 2007/12/31 07:20:12 sebastian Exp $ */
/*
* Functions to parse & compse IPTC data.
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index 958a2c364..c5bd5c866 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: lcg.c,v 1.41.2.1.2.2 2007/05/17 06:38:13 rasmus Exp $ */
+/* $Id: lcg.c,v 1.41.2.1.2.3 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "php_lcg.h"
diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
index 1ed2edf84..c5c6caa08 100644
--- a/ext/standard/levenshtein.c
+++ b/ext/standard/levenshtein.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: levenshtein.c,v 1.34.2.1.2.3 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: levenshtein.c,v 1.34.2.1.2.4 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include <stdlib.h>
diff --git a/ext/standard/link.c b/ext/standard/link.c
index c352e59fb..24afc561d 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: link.c,v 1.52.2.1.2.3 2007/07/10 13:21:11 dmitry Exp $ */
+/* $Id: link.c,v 1.52.2.1.2.4 2007/12/31 07:20:12 sebastian Exp $ */
#include "php.h"
#include "php_filestat.h"
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index fe348786b..3f9763ba0 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mail.c,v 1.87.2.1.2.8 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.9 2007/12/31 07:20:12 sebastian Exp $ */
#include <stdlib.h>
#include <ctype.h>
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 0d16ad2ff..8f293ae71 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.131.2.2.2.6 2007/05/23 15:01:00 iliaa Exp $ */
+/* $Id: math.c,v 1.131.2.2.2.9 2008/02/21 11:53:51 tony2001 Exp $ */
#include "php.h"
#include "php_math.h"
@@ -471,14 +471,13 @@ PHP_FUNCTION(pow)
Returns e raised to the power of the number */
PHP_FUNCTION(exp)
{
- zval **num;
+ double num;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
+ return;
}
- convert_to_double_ex(num);
- Z_DVAL_P(return_value) = exp(Z_DVAL_PP(num));
- Z_TYPE_P(return_value) = IS_DOUBLE;
+
+ RETURN_DOUBLE(exp(num));
}
/* }}} */
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 7bc85bcf0..16c295b4b 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.c,v 1.39.2.1.2.4 2007/05/27 15:29:38 nlopess Exp $ */
+/* $Id: md5.c,v 1.39.2.1.2.5 2007/12/31 07:20:13 sebastian Exp $ */
/*
* md5.c - Copyright 1997 Lachlan Roche
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
index 548b8743b..b9285c1ba 100644
--- a/ext/standard/md5.h
+++ b/ext/standard/md5.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.h,v 1.17.2.1.2.2 2007/05/19 20:30:35 iliaa Exp $ */
+/* $Id: md5.h,v 1.17.2.1.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef MD5_H
#define MD5_H
diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c
index f780818a9..3c8cb93aa 100644
--- a/ext/standard/metaphone.c
+++ b/ext/standard/metaphone.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: metaphone.c,v 1.28.2.1.2.4 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: metaphone.c,v 1.28.2.1.2.7 2008/02/27 01:10:56 felipe Exp $ */
/*
Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <schwern@pobox.com>
@@ -144,13 +144,18 @@ static char Lookahead(char *word, int how_far)
* could be one though; or more too). */
#define Phonize(c) { \
if (p_idx >= max_buffer_len) { \
- *phoned_word = erealloc(*phoned_word, max_buffer_len + 2); \
+ *phoned_word = safe_erealloc(*phoned_word, 2, sizeof(char), max_buffer_len); \
max_buffer_len += 2; \
} \
(*phoned_word)[p_idx++] = c; \
}
/* Slap a null character on the end of the phoned word */
-#define End_Phoned_Word {(*phoned_word)[p_idx] = '\0';}
+#define End_Phoned_Word { \
+ if (p_idx == max_buffer_len) { \
+ *phoned_word = safe_erealloc(*phoned_word, 1, sizeof(char), max_buffer_len); \
+ } \
+ (*phoned_word)[p_idx] = '\0'; \
+ }
/* How long is the phoned word? */
#define Phone_Len (p_idx)
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 552b1503b..6b26c641d 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: microtime.c,v 1.53.2.2.2.3 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: microtime.c,v 1.53.2.2.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h
index 9cf5806e7..ca564c55c 100644
--- a/ext/standard/microtime.h
+++ b/ext/standard/microtime.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: microtime.h,v 1.14.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: microtime.h,v 1.14.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef MICROTIME_H
#define MICROTIME_H
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 097b70788..7233cb3b3 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.57.2.5.2.6 2007/09/22 15:25:46 iliaa Exp $ */
+/* $Id: pack.c,v 1.57.2.5.2.7 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
diff --git a/ext/standard/pack.h b/ext/standard/pack.h
index d28f0431e..88680fada 100644
--- a/ext/standard/pack.h
+++ b/ext/standard/pack.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pack.h,v 1.16.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: pack.h,v 1.16.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PACK_H
#define PACK_H
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
index ea23c5082..1dd1c6123 100644
--- a/ext/standard/pageinfo.c
+++ b/ext/standard/pageinfo.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pageinfo.c,v 1.40.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: pageinfo.c,v 1.40.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
#include "pageinfo.h"
diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h
index 926e88617..e3e59f96c 100644
--- a/ext/standard/pageinfo.h
+++ b/ext/standard/pageinfo.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pageinfo.h,v 1.14.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: pageinfo.h,v 1.14.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PAGEINFO_H
#define PAGEINFO_H
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index 02190b8df..d77edf899 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_array.h,v 1.50.2.2.2.3 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_array.h,v 1.50.2.2.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_ARRAY_H
#define PHP_ARRAY_H
diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h
index abc02f962..b3c61c1bf 100644
--- a/ext/standard/php_assert.h
+++ b/ext/standard/php_assert.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_assert.h,v 1.15.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_assert.h,v 1.15.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_ASSERT_H
#define PHP_ASSERT_H
diff --git a/ext/standard/php_browscap.h b/ext/standard/php_browscap.h
index 074786bd2..a5a79c7a8 100644
--- a/ext/standard/php_browscap.h
+++ b/ext/standard/php_browscap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_browscap.h,v 1.13.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_browscap.h,v 1.13.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_BROWSCAP_H
#define PHP_BROWSCAP_H
diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h
index f212c4590..1a631057c 100644
--- a/ext/standard/php_crypt.h
+++ b/ext/standard/php_crypt.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_crypt.h,v 1.18.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_crypt.h,v 1.18.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_CRYPT_H
#define PHP_CRYPT_H
diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h
index d21331f32..14fb5d69f 100644
--- a/ext/standard/php_dir.h
+++ b/ext/standard/php_dir.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dir.h,v 1.24.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_dir.h,v 1.24.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_DIR_H
#define PHP_DIR_H
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
index bf83de826..e5ff1e918 100644
--- a/ext/standard/php_ext_syslog.h
+++ b/ext/standard/php_ext_syslog.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ext_syslog.h,v 1.12.2.2.2.2 2007/05/17 06:38:13 rasmus Exp $ */
+/* $Id: php_ext_syslog.h,v 1.12.2.2.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_EXT_SYSLOG_H
#define PHP_EXT_SYSLOG_H
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
index d30cf37de..bd66459ba 100644
--- a/ext/standard/php_filestat.h
+++ b/ext/standard/php_filestat.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_filestat.h,v 1.24.2.4.2.2 2007/10/31 13:23:06 jani Exp $ */
+/* $Id: php_filestat.h,v 1.24.2.4.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_FILESTAT_H
#define PHP_FILESTAT_H
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 6afbc4531..64e05e0c3 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_fopen_wrapper.c,v 1.45.2.4.2.8 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: php_fopen_wrapper.c,v 1.45.2.4.2.9 2007/12/31 07:20:13 sebastian Exp $ */
#include <stdio.h>
#include <stdlib.h>
diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h
index c63022b01..b32ae7272 100644
--- a/ext/standard/php_fopen_wrappers.h
+++ b/ext/standard/php_fopen_wrappers.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_fopen_wrappers.h,v 1.21.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_fopen_wrappers.h,v 1.21.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_FOPEN_WRAPPERS_H
#define PHP_FOPEN_WRAPPERS_H
diff --git a/ext/standard/php_ftok.h b/ext/standard/php_ftok.h
index 444761029..c3b4b9825 100644
--- a/ext/standard/php_ftok.h
+++ b/ext/standard/php_ftok.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ftok.h,v 1.9.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_ftok.h,v 1.9.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_FTOK_H
#define PHP_FTOK_H
diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h
index 806beaaa8..9097a67de 100644
--- a/ext/standard/php_http.h
+++ b/ext/standard/php_http.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.h,v 1.5.2.2.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_http.h,v 1.5.2.2.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_HTTP_H
#define PHP_HTTP_H
diff --git a/ext/standard/php_image.h b/ext/standard/php_image.h
index 37812fbff..33f8495e9 100644
--- a/ext/standard/php_image.h
+++ b/ext/standard/php_image.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_image.h,v 1.29.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_image.h,v 1.29.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_IMAGE_H
#define PHP_IMAGE_H
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index b194ede8d..8d3061af3 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_incomplete_class.h,v 1.17.2.2.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_incomplete_class.h,v 1.17.2.2.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_INCOMPLETE_CLASS_H
#define PHP_INCOMPLETE_CLASS_H
diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h
index c85b84ab2..18d77e3f8 100644
--- a/ext/standard/php_iptc.h
+++ b/ext/standard/php_iptc.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_iptc.h,v 1.11.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_iptc.h,v 1.11.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_IPTC_H
#define PHP_IPTC_H
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
index 9e04442e5..93aa78e64 100644
--- a/ext/standard/php_lcg.h
+++ b/ext/standard/php_lcg.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_lcg.h,v 1.21.2.1.2.2 2007/05/18 11:36:55 rasmus Exp $ */
+/* $Id: php_lcg.h,v 1.21.2.1.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_LCG_H
#define PHP_LCG_H
diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h
index 0cde3a678..353f5dc27 100644
--- a/ext/standard/php_link.h
+++ b/ext/standard/php_link.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_link.h,v 1.12.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_link.h,v 1.12.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_LINK_H
#define PHP_LINK_H
diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h
index f159bc916..7b249a015 100644
--- a/ext/standard/php_mail.h
+++ b/ext/standard/php_mail.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mail.h,v 1.18.2.1.2.2 2007/07/11 17:36:56 johannes Exp $ */
+/* $Id: php_mail.h,v 1.18.2.1.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_MAIL_H
#define PHP_MAIL_H
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
index e7766a57a..84b750a0e 100644
--- a/ext/standard/php_math.h
+++ b/ext/standard/php_math.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_math.h,v 1.28.2.2.2.3 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_math.h,v 1.28.2.2.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_MATH_H
#define PHP_MATH_H
diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h
index b886a357f..3706392bc 100644
--- a/ext/standard/php_metaphone.h
+++ b/ext/standard/php_metaphone.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_metaphone.h,v 1.16.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_metaphone.h,v 1.16.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_METAPHONE_H
#define PHP_METAPHONE_H
diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h
index b6bb2c348..7a12d2466 100644
--- a/ext/standard/php_rand.h
+++ b/ext/standard/php_rand.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
| Based on code from: Shawn Cokus <Cokus@math.washington.edu> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_rand.h,v 1.28.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_rand.h,v 1.28.2.1.2.4 2008/03/07 08:56:45 tony2001 Exp $ */
#ifndef PHP_RAND_H
#define PHP_RAND_H
@@ -47,9 +47,9 @@
#define PHP_MT_RAND_MAX ((long) (0x7FFFFFFF)) /* (1<<31) - 1 */
#ifdef PHP_WIN32
-#define GENERATE_SEED() ((long) (time(0) * GetCurrentProcessId() * 1000000 * php_combined_lcg(TSRMLS_C)))
+#define GENERATE_SEED() (((long) (time(0) * GetCurrentProcessId())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C))))
#else
-#define GENERATE_SEED() ((long) (time(0) * getpid() * 1000000 * php_combined_lcg(TSRMLS_C)))
+#define GENERATE_SEED() (((long) (time(0) * getpid())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C))))
#endif
PHPAPI void php_srand(long seed TSRMLS_DC);
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
index 4e8eb52fc..fd6dfb6dc 100644
--- a/ext/standard/php_smart_str.h
+++ b/ext/standard/php_smart_str.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_smart_str.h,v 1.30.2.3.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_smart_str.h,v 1.30.2.3.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_SMART_STR_H
#define PHP_SMART_STR_H
diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h
index d71d30618..2d119e790 100644
--- a/ext/standard/php_smart_str_public.h
+++ b/ext/standard/php_smart_str_public.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_smart_str_public.h,v 1.10.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_smart_str_public.h,v 1.10.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_SMART_STR_PUBLIC_H
#define PHP_SMART_STR_PUBLIC_H
diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h
index e210bf6fb..dd41fc25a 100644
--- a/ext/standard/php_standard.h
+++ b/ext/standard/php_standard.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_standard.h,v 1.24.2.2.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_standard.h,v 1.24.2.2.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#include "basic_functions.h"
#include "php_math.h"
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index b4936d84e..c2b038fdd 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_string.h,v 1.87.2.2.2.3 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_string.h,v 1.87.2.2.2.4 2007/12/31 07:20:13 sebastian Exp $ */
/* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h
index fee24bdf7..bd170239e 100644
--- a/ext/standard/php_type.h
+++ b/ext/standard/php_type.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_type.h,v 1.6.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_type.h,v 1.6.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_TYPE_H
#define PHP_TYPE_H
diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h
index 908d64e6e..0bab2fc6c 100644
--- a/ext/standard/php_uuencode.h
+++ b/ext/standard/php_uuencode.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_uuencode.h,v 1.4.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_uuencode.h,v 1.4.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_UUENCODE_H
#define PHP_UUENCODE_H
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
index 0c9693049..19527286b 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_var.h,v 1.30.2.1.2.6 2007/05/22 14:34:22 tony2001 Exp $ */
+/* $Id: php_var.h,v 1.30.2.1.2.7 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_VAR_H
#define PHP_VAR_H
diff --git a/ext/standard/php_versioning.h b/ext/standard/php_versioning.h
index a23aa7506..2f502e305 100644
--- a/ext/standard/php_versioning.h
+++ b/ext/standard/php_versioning.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_versioning.h,v 1.10.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_versioning.h,v 1.10.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_VERSIONING_H
#define PHP_VERSIONING_H
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 2ef4b6790..69fca4d71 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: proc_open.c,v 1.36.2.1.2.17 2007/09/12 11:42:43 nlopess Exp $ */
+/* $Id: proc_open.c,v 1.36.2.1.2.19 2008/04/08 08:45:51 jani Exp $ */
#if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
# define _BSD_SOURCE /* linux wants this when XOPEN mode is on */
@@ -624,7 +624,7 @@ PHP_FUNCTION(proc_open)
goto exit_fail;
}
- if (strcmp(Z_STRVAL_PP(zmode), "w") != 0) {
+ if (strncmp(Z_STRVAL_PP(zmode), "w", 1) != 0) {
descriptors[ndesc].parentend = newpipe[1];
descriptors[ndesc].childend = newpipe[0];
descriptors[ndesc].mode |= DESC_PARENT_MODE_WRITE;
diff --git a/ext/standard/proc_open.h b/ext/standard/proc_open.h
index 520a83e92..10625f5b1 100644
--- a/ext/standard/proc_open.h
+++ b/ext/standard/proc_open.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: proc_open.h,v 1.5.2.1.2.2 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: proc_open.h,v 1.5.2.1.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifdef PHP_WIN32
typedef HANDLE php_file_descriptor_t;
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index a8ba0f8c2..b57d826a6 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: quot_print.c,v 1.29.2.2.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: quot_print.c,v 1.29.2.2.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#include <stdlib.h>
diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h
index 9ffc9286b..37a10ff2e 100644
--- a/ext/standard/quot_print.h
+++ b/ext/standard/quot_print.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: quot_print.h,v 1.13.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: quot_print.h,v 1.13.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef QUOT_PRINT_H
#define QUOT_PRINT_H
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index d9161a15f..eee131b78 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -23,7 +23,7 @@
| Shawn Cokus <Cokus@math.washington.edu> |
+----------------------------------------------------------------------+
*/
-/* $Id: rand.c,v 1.70.2.1.2.2 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: rand.c,v 1.70.2.1.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#include <stdlib.h>
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
index beacf285f..3c3a02c54 100644
--- a/ext/standard/reg.c
+++ b/ext/standard/reg.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.82.2.3.2.2 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: reg.c,v 1.82.2.3.2.5 2008/04/20 01:43:18 felipe Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -564,7 +564,9 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
} else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) {
/* No more matches */
regfree(&re);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression to split()");
+
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Regular Expression");
+
zend_hash_destroy(Z_ARRVAL_P(return_value));
efree(Z_ARRVAL_P(return_value));
RETURN_FALSE;
diff --git a/ext/standard/reg.h b/ext/standard/reg.h
index 2d3b7e8ea..6557916cf 100644
--- a/ext/standard/reg.h
+++ b/ext/standard/reg.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
*/
-/* $Id: reg.h,v 1.21.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: reg.h,v 1.21.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef REG_H
#define REG_H
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index 26e5e1783..d5c591d1f 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: scanf.c,v 1.31.2.2.2.5 2007/07/26 15:24:06 jani Exp $ */
+/* $Id: scanf.c,v 1.31.2.2.2.6 2007/12/31 07:20:13 sebastian Exp $ */
/*
scanf.c --
diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h
index 391c9d504..25ef8c45c 100644
--- a/ext/standard/scanf.h
+++ b/ext/standard/scanf.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: scanf.h,v 1.14.2.2.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: scanf.h,v 1.14.2.2.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef SCANF_H
#define SCANF_H
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index 9db3afe76..1fae65324 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sha1.c,v 1.13.2.1.2.3 2007/05/27 14:50:09 sniper Exp $ */
+/* $Id: sha1.c,v 1.13.2.1.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h
index fc9049000..a29f96190 100644
--- a/ext/standard/sha1.h
+++ b/ext/standard/sha1.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sha1.h,v 1.5.2.1.2.2 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: sha1.h,v 1.5.2.1.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef SHA1_H
#define SHA1_H
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
index 31f803dff..20ee0b73a 100644
--- a/ext/standard/soundex.c
+++ b/ext/standard/soundex.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Bjørn Borud - Guardian Networks AS <borud@guardian.no> |
+----------------------------------------------------------------------+
*/
-/* $Id: soundex.c,v 1.25.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: soundex.c,v 1.25.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
#include <stdlib.h>
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 7963e529a..c8542fba8 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.58.2.6.2.16 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: streamsfuncs.c,v 1.58.2.6.2.19 2008/02/03 16:15:30 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1325,6 +1325,9 @@ PHP_FUNCTION(stream_socket_enable_crypto)
if (php_stream_xport_crypto_setup(stream, cryptokind, sessstream TSRMLS_CC) < 0) {
RETURN_FALSE;
}
+ } else if (enable) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "When enabling encryption you must specify the crypto type");
+ RETURN_FALSE;
}
ret = php_stream_xport_crypto_enable(stream, enable TSRMLS_CC);
@@ -1361,7 +1364,7 @@ PHP_FUNCTION(stream_is_local)
wrapper = stream->wrapper;
} else {
convert_to_string_ex(&zstream);
- wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC);
+ wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0 TSRMLS_CC);
}
if(!wrapper) {
diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h
index f2ad960f4..b966ed57d 100644
--- a/ext/standard/streamsfuncs.h
+++ b/ext/standard/streamsfuncs.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.h,v 1.13.2.1.2.4 2007/07/09 17:27:24 dmitry Exp $ */
+/* $Id: streamsfuncs.h,v 1.13.2.1.2.5 2007/12/31 07:20:13 sebastian Exp $ */
/* Flags for stream_socket_client */
#define PHP_STREAM_CLIENT_PERSISTENT 1
diff --git a/ext/standard/string.c b/ext/standard/string.c
index c1e898ea2..8125c18e2 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.14.2.70 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.73 2008/01/16 08:35:59 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -452,15 +452,182 @@ PHP_MINIT_FUNCTION(nl_langinfo)
Query language and locale information */
PHP_FUNCTION(nl_langinfo)
{
- zval **item;
+ long item;
char *value;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &item) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &item) == FAILURE) {
+ return;
+ }
+
+ switch(item) { /* {{{ */
+#ifdef ABDAY_1
+ case ABDAY_1:
+ case ABDAY_2:
+ case ABDAY_3:
+ case ABDAY_4:
+ case ABDAY_5:
+ case ABDAY_6:
+ case ABDAY_7:
+#endif
+#ifdef DAY_1
+ case DAY_1:
+ case DAY_2:
+ case DAY_3:
+ case DAY_4:
+ case DAY_5:
+ case DAY_6:
+ case DAY_7:
+#endif
+#ifdef ABMON_1
+ case ABMON_1:
+ case ABMON_2:
+ case ABMON_3:
+ case ABMON_4:
+ case ABMON_5:
+ case ABMON_6:
+ case ABMON_7:
+ case ABMON_8:
+ case ABMON_9:
+ case ABMON_10:
+ case ABMON_11:
+ case ABMON_12:
+#endif
+#ifdef MON_1
+ case MON_1:
+ case MON_2:
+ case MON_3:
+ case MON_4:
+ case MON_5:
+ case MON_6:
+ case MON_7:
+ case MON_8:
+ case MON_9:
+ case MON_10:
+ case MON_11:
+ case MON_12:
+#endif
+#ifdef AM_STR
+ case AM_STR:
+#endif
+#ifdef PM_STR
+ case PM_STR:
+#endif
+#ifdef D_T_FMT
+ case D_T_FMT:
+#endif
+#ifdef D_FMT
+ case D_FMT:
+#endif
+#ifdef T_FMT
+ case T_FMT:
+#endif
+#ifdef T_FMT_AMPM
+ case T_FMT_AMPM:
+#endif
+#ifdef ERA
+ case ERA:
+#endif
+#ifdef ERA_YEAR
+ case ERA_YEAR:
+#endif
+#ifdef ERA_D_T_FMT
+ case ERA_D_T_FMT:
+#endif
+#ifdef ERA_D_FMT
+ case ERA_D_FMT:
+#endif
+#ifdef ERA_T_FMT
+ case ERA_T_FMT:
+#endif
+#ifdef ALT_DIGITS
+ case ALT_DIGITS:
+#endif
+#ifdef INT_CURR_SYMBOL
+ case INT_CURR_SYMBOL:
+#endif
+#ifdef CURRENCY_SYMBOL
+ case CURRENCY_SYMBOL:
+#endif
+#ifdef CRNCYSTR
+ case CRNCYSTR:
+#endif
+#ifdef MON_DECIMAL_POINT
+ case MON_DECIMAL_POINT:
+#endif
+#ifdef MON_THOUSANDS_SEP
+ case MON_THOUSANDS_SEP:
+#endif
+#ifdef MON_GROUPING
+ case MON_GROUPING:
+#endif
+#ifdef POSITIVE_SIGN
+ case POSITIVE_SIGN:
+#endif
+#ifdef NEGATIVE_SIGN
+ case NEGATIVE_SIGN:
+#endif
+#ifdef INT_FRAC_DIGITS
+ case INT_FRAC_DIGITS:
+#endif
+#ifdef FRAC_DIGITS
+ case FRAC_DIGITS:
+#endif
+#ifdef P_CS_PRECEDES
+ case P_CS_PRECEDES:
+#endif
+#ifdef P_SEP_BY_SPACE
+ case P_SEP_BY_SPACE:
+#endif
+#ifdef N_CS_PRECEDES
+ case N_CS_PRECEDES:
+#endif
+#ifdef N_SEP_BY_SPACE
+ case N_SEP_BY_SPACE:
+#endif
+#ifdef P_SIGN_POSN
+ case P_SIGN_POSN:
+#endif
+#ifdef N_SIGN_POSN
+ case N_SIGN_POSN:
+#endif
+#ifdef DECIMAL_POINT
+ case DECIMAL_POINT:
+#endif
+#ifdef RADIXCHAR
+ case RADIXCHAR:
+#endif
+#ifdef THOUSANDS_SEP
+ case THOUSANDS_SEP:
+#endif
+#ifdef THOUSEP
+ case THOUSEP:
+#endif
+#ifdef GROUPING
+ case GROUPING:
+#endif
+#ifdef YESEXPR
+ case YESEXPR:
+#endif
+#ifdef NOEXPR
+ case NOEXPR:
+#endif
+#ifdef YESSTR
+ case YESSTR:
+#endif
+#ifdef NOSTR
+ case NOSTR:
+#endif
+#ifdef CODESET
+ case CODESET:
+#endif
+ break;
+ default:
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '%ld' is not valid", item);
+ RETURN_FALSE;
}
- convert_to_long_ex(item);
+ /* }}} */
- value = nl_langinfo(Z_LVAL_PP(item));
+ value = nl_langinfo(item);
if (value == NULL) {
RETURN_FALSE;
} else {
@@ -4966,7 +5133,7 @@ PHP_FUNCTION(str_word_count)
while (p < e) {
s = p;
- while (p < e && (isalpha(*p) || (char_list && ch[(unsigned char)*p]) || *p == '\'' || *p == '-')) {
+ while (p < e && (isalpha((unsigned char)*p) || (char_list && ch[(unsigned char)*p]) || *p == '\'' || *p == '-')) {
p++;
}
if (p > s) {
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index a3a2391a6..985bb8411 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: syslog.c,v 1.49.2.3.2.2 2007/05/17 06:38:13 rasmus Exp $ */
+/* $Id: syslog.c,v 1.49.2.3.2.4 2008/02/20 15:28:37 iliaa Exp $ */
#include "php.h"
@@ -110,6 +110,7 @@ PHP_RINIT_FUNCTION(syslog)
} else {
BG(syslog_started)=0;
}
+ BG(syslog_device) = NULL;
return SUCCESS;
}
@@ -126,6 +127,7 @@ PHP_MSHUTDOWN_FUNCTION(syslog)
{
if (BG(syslog_device)) {
free(BG(syslog_device));
+ BG(syslog_device) = NULL;
}
return SUCCESS;
}
diff --git a/ext/standard/tests/array/array_change_key_case_variation1.phpt b/ext/standard/tests/array/array_change_key_case_variation1.phpt
new file mode 100644
index 000000000..e70774e01
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation1.phpt
@@ -0,0 +1,224 @@
+--TEST--
+Test array_change_key_case() function : usage variations - Pass different data types as $input arg
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $input argument to test behaviour of array_change_key_case()
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+//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 $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_change_key_case()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_change_key_case($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+array(0) {
+}
+
+-- Iteration 19 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_change_key_case_variation2.phpt b/ext/standard/tests/array/array_change_key_case_variation2.phpt
new file mode 100644
index 000000000..cce432e8d
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation2.phpt
@@ -0,0 +1,318 @@
+--TEST--
+Test array_change_key_case() function : usage variations - Pass different data types as $case arg
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $case argument to array_change_key_case() to test behaviour
+ * Where possible, CASE_UPPER has been entered as a string value
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$array = array ('one' => 1, 'TWO' => 2, 'Three' => 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+CASE_UPPER
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $case argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "CASE_UPPER",
+ 'CASE_UPPER',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_change_key_case()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_change_key_case($array, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Iteration 1 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 2 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 3 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 4 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 5 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 6 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 7 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 9 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 11 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 12 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 13 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 14 --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+
+-- Iteration 15 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 16 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 17 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 18 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 19 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 20 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 21 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 22 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 23 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation3.phpt b/ext/standard/tests/array/array_change_key_case_variation3.phpt
new file mode 100644
index 000000000..596703385
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation3.phpt
@@ -0,0 +1,197 @@
+--TEST--
+Test array_change_key_case() function : usage variations - different data types as keys
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays with different data types as keys to array_change_key_case()
+ * to test conversion
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays of different data types to be passed to $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*3*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*4*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*5*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*6*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*8*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*9*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_change_key_case()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ var_dump( array_change_key_case($input, CASE_UPPER) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Iteration 1 : int data --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [-2345]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 : float data --
+array(3) {
+ [10]=>
+ string(8) "positive"
+ [-10]=>
+ string(8) "negative"
+ [0]=>
+ string(4) "half"
+}
+
+-- Iteration 3 : extreme floats data --
+array(2) {
+ [12345678]=>
+ string(5) "large"
+ [0]=>
+ string(5) "small"
+}
+
+-- Iteration 4 : null uppercase data --
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5 : null lowercase data --
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6 : bool lowercase data --
+array(2) {
+ [1]=>
+ string(6) "lowert"
+ [0]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7 : bool uppercase data --
+array(2) {
+ [1]=>
+ string(6) "uppert"
+ [0]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8 : empty double quotes data --
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9 : empty single quotes data --
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10 : string data --
+array(3) {
+ ["STRINGD"]=>
+ string(7) "stringd"
+ ["STRINGS"]=>
+ string(7) "strings"
+ ["HELLO WORLD"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11 : undefined data --
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12 : unset data --
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation4.phpt b/ext/standard/tests/array/array_change_key_case_variation4.phpt
new file mode 100644
index 000000000..ad9ad75a3
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation4.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test array_change_key_case() function : usage variations - different int values for $case
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different integer values as $case argument to array_change_key_case() to test behaviour
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array('One' => 'un', 'TWO' => 'deux', 'three' => 'trois');
+for ($i = -5; $i <=5; $i += 1){
+ echo "\n-- \$sort argument is $i --\n";
+ $temp = $input;
+ var_dump(array_change_key_case($temp, $i));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- $sort argument is -5 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -4 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -3 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -2 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is -1 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 0 --
+array(3) {
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+ ["three"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 1 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 2 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 3 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 4 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+
+-- $sort argument is 5 --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation5.phpt b/ext/standard/tests/array/array_change_key_case_variation5.phpt
new file mode 100644
index 000000000..aa3852a41
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation5.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test array_change_key_case() function : usage variations - position of internal pointer
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check the position of the internal array pointer after calling the function
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois');
+
+echo "\n-- Call array_change_key_case() --\n";
+var_dump($result = array_change_key_case($input, CASE_UPPER));
+
+echo "-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Call array_change_key_case() --
+array(3) {
+ ["ONE"]=>
+ string(2) "un"
+ ["TWO"]=>
+ string(4) "deux"
+ ["THREE"]=>
+ string(5) "trois"
+}
+-- Position of Internal Pointer in Result: --
+ONE => un
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation6.phpt b/ext/standard/tests/array/array_change_key_case_variation6.phpt
new file mode 100644
index 000000000..d4371d345
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation6.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test array_change_key_case() function : usage variations - multidimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_change_key_case() converts keys in multi-dimensional arrays
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array('English' => array('one' => 1, 'two' => 2, 'three' => 3),
+ 'French' => array('un' => 1, 'deux' => 2, 'trois' => 3),
+ 'German' => array('eins' => 1, 'zwei' => 2, 'drei' => 3));
+
+echo "\n-- Pass a two-dimensional array as \$input argument --\n";
+var_dump(array_change_key_case($input, CASE_UPPER));
+
+echo "\n-- Pass a sub-arry as \$input argument --\n";
+var_dump(array_change_key_case($input['English'], CASE_UPPER));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- Pass a two-dimensional array as $input argument --
+array(3) {
+ ["ENGLISH"]=>
+ array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ }
+ ["FRENCH"]=>
+ array(3) {
+ ["un"]=>
+ int(1)
+ ["deux"]=>
+ int(2)
+ ["trois"]=>
+ int(3)
+ }
+ ["GERMAN"]=>
+ array(3) {
+ ["eins"]=>
+ int(1)
+ ["zwei"]=>
+ int(2)
+ ["drei"]=>
+ int(3)
+ }
+}
+
+-- Pass a sub-arry as $input argument --
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_change_key_case_variation7.phpt b/ext/standard/tests/array/array_change_key_case_variation7.phpt
new file mode 100644
index 000000000..173a7ec4d
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation7.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test array_change_key_case() function : usage variations - referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_change_key_case() when:
+ * 1. Passed a referenced variable
+ * 2. Passed an argument by reference
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$input = array('one' => 1, 'two' => 2, 'ABC' => 'xyz');
+
+echo "\n-- \$input argument is a reference to array --\n";
+$new_input = &$input;
+echo "Result:\n";
+var_dump(array_change_key_case($new_input, CASE_UPPER));
+echo "Original:\n";
+var_dump($input);
+echo "Referenced:\n";
+var_dump($new_input);
+
+echo "\n-- \$input is an array passed by reference --\n";
+echo "Result:\n";
+var_dump(array_change_key_case(&$input, CASE_UPPER));
+echo "Original:\n";
+var_dump($input);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- $input argument is a reference to array --
+Result:
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["ABC"]=>
+ string(3) "xyz"
+}
+Original:
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["ABC"]=>
+ string(3) "xyz"
+}
+Referenced:
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["ABC"]=>
+ string(3) "xyz"
+}
+
+-- $input is an array passed by reference --
+Result:
+array(3) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["ABC"]=>
+ string(3) "xyz"
+}
+Original:
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["ABC"]=>
+ string(3) "xyz"
+}
+Done
diff --git a/ext/standard/tests/array/array_change_key_case_variation8.phpt b/ext/standard/tests/array/array_change_key_case_variation8.phpt
new file mode 100644
index 000000000..f9893da79
--- /dev/null
+++ b/ext/standard/tests/array/array_change_key_case_variation8.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test array_change_key_case() function : usage variations - Different strings as keys
+--FILE--
+<?php
+/* Prototype : array array_change_key_case(array $input [, int $case])
+ * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_change_key_case() behaves with different strings
+ */
+
+echo "*** Testing array_change_key_case() : usage variations ***\n";
+
+$inputs = array (
+ // group of escape sequences
+ array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11),
+
+ // array contains combination of capital/small letters
+ array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12)
+);
+
+foreach($inputs as $input) {
+ echo "\n-- \$case = default --\n";
+ var_dump(array_change_key_case($input));
+ echo "-- \$case = upper --\n";
+ var_dump(array_change_key_case($input, CASE_UPPER));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_change_key_case() : usage variations ***
+
+-- $case = default --
+array(10) {
+ [""]=>
+ int(2)
+ ["\a"]=>
+ int(3)
+ ["\cx"]=>
+ int(4)
+ ["\e"]=>
+ int(5)
+ [" "]=>
+ int(6)
+ ["
+"]=>
+ int(7)
+ [" "]=>
+ int(8)
+ ["\xhh"]=>
+ int(9)
+ ["\ddd"]=>
+ int(10)
+ [" "]=>
+ int(11)
+}
+-- $case = upper --
+array(10) {
+ [""]=>
+ int(2)
+ ["\A"]=>
+ int(3)
+ ["\CX"]=>
+ int(4)
+ ["\E"]=>
+ int(5)
+ [" "]=>
+ int(6)
+ ["
+"]=>
+ int(7)
+ [" "]=>
+ int(8)
+ ["\XHH"]=>
+ int(9)
+ ["\DDD"]=>
+ int(10)
+ [" "]=>
+ int(11)
+}
+
+-- $case = default --
+array(9) {
+ ["lemon"]=>
+ int(1)
+ ["orange"]=>
+ int(11)
+ ["banana"]=>
+ int(12)
+ ["apple"]=>
+ int(4)
+ ["test"]=>
+ int(5)
+ ["tttt"]=>
+ int(6)
+ ["ttt"]=>
+ int(7)
+ ["ww"]=>
+ int(8)
+ ["x"]=>
+ int(10)
+}
+-- $case = upper --
+array(9) {
+ ["LEMON"]=>
+ int(1)
+ ["ORANGE"]=>
+ int(11)
+ ["BANANA"]=>
+ int(12)
+ ["APPLE"]=>
+ int(4)
+ ["TEST"]=>
+ int(5)
+ ["TTTT"]=>
+ int(6)
+ ["TTT"]=>
+ int(7)
+ ["WW"]=>
+ int(8)
+ ["X"]=>
+ int(10)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_chunk_basic1.phpt b/ext/standard/tests/array/array_chunk_basic1.phpt
new file mode 100644
index 000000000..56a90f479
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_basic1.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test array_chunk() function : basic functionality - defualt 'preserve_keys'
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Chunks an array into size large chunks.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_chunk() : basic functionality ***\n";
+$size = 2;
+
+$input_arrays = array (
+ // array with default keys - numeric values
+ array(1, 2, 3, 4, 5),
+
+ // array with default keys - string values
+ array('value1', "value2", "value3"),
+
+ // associative arrays - key as string
+ array('key1' => 1, "key2" => 2, "key3" => 3),
+
+ // associative arrays - key as numeric
+ array(1 => 'one', 2 => "two", 3 => "three"),
+
+ // array containing elements with/witout keys
+ array(1 => 'one','two', 3 => 'three', 4, "five" => 5)
+
+);
+
+$count = 1;
+// loop through each element of the array for input
+foreach ($input_arrays as $input_array){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input_array, $size) );
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_chunk() : basic functionality ***
+
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(6) "value3"
+ }
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(5) "three"
+ }
+}
+
+-- Iteration 5 --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_basic2.phpt b/ext/standard/tests/array/array_chunk_basic2.phpt
new file mode 100644
index 000000000..f96d863e1
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_basic2.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test array_chunk() function : basic functionality - 'preserve_keys' as true/false
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Chunks an array into size large chunks.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_chunk() : basic functionality ***\n";
+$size = 2;
+
+$input_arrays = array(
+ // array with default keys - numeric values
+ array(1, 2, 3, 4, 5),
+
+ // array with default keys - string values
+ array('value1', "value2", "value3"),
+
+ // associative arrays - key as string
+ array('key1' => 1, "key2" => 2, "key3" => 3),
+
+ // associative arrays - key as numeric
+ array(1 => 'one', 2 => "two", 3 => "three"),
+
+ // array containing elements with/without keys
+ array(1 => 'one','two', 3 => 'three', 4, "five" => 5)
+);
+
+$count = 1;
+// loop through each element of the array for input
+foreach ($input_arrays as $input_array){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input_array, $size, true) );
+ var_dump( array_chunk($input_array, $size, false) );
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_chunk() : basic functionality ***
+
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [4]=>
+ int(5)
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ }
+ [1]=>
+ array(1) {
+ [2]=>
+ string(6) "value3"
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(6) "value3"
+ }
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ ["key1"]=>
+ int(1)
+ ["key2"]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ ["key3"]=>
+ int(3)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(1) {
+ [3]=>
+ string(5) "three"
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(5) "three"
+ }
+}
+
+-- Iteration 5 --
+array(3) {
+ [0]=>
+ array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(2) {
+ [3]=>
+ string(5) "three"
+ [4]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ ["five"]=>
+ int(5)
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(5)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_error.phpt b/ext/standard/tests/array/array_chunk_error.phpt
new file mode 100644
index 000000000..519794599
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test array_chunk() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_chunk(array input, int size [, bool preserve_keys])
+ * Description: Split array into chunks
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_chunk() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_chunk() function with zero arguments --\n";
+var_dump( array_chunk() );
+
+echo "\n-- Testing array_chunk() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$size = 10;
+$preserve_keys = true;
+$extra_arg = 10;
+var_dump( array_chunk($input,$size,$preserve_keys, $extra_arg) );
+
+echo "\n-- Testing array_chunk() function with less than expected no. of arguments --\n";
+$input = array(1, 2);
+var_dump( array_chunk($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : error conditions ***
+
+-- Testing array_chunk() function with zero arguments --
+
+Warning: array_chunk() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing array_chunk() function with more than expected no. of arguments --
+
+Warning: array_chunk() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing array_chunk() function with less than expected no. of arguments --
+
+Warning: array_chunk() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation1.phpt b/ext/standard/tests/array/array_chunk_variation1.phpt
new file mode 100644
index 000000000..caaf274dd
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_variation1.phpt
@@ -0,0 +1,325 @@
+--TEST--
+Test array_chunk() function : usage variations - unexpected values for 'array' argument
+--FILE--
+<?php
+/* Prototype : proto array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Chunks an array into size large chunks.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function with unexpected values for 'array' argument
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// Initialise function arguments
+$size = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$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,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new stdclass(),
+
+ // undefined data
+/*21*/ @undefined_var,
+
+ // unset data
+/*22*/ @unset_var
+
+);
+
+$count = 1;
+// loop through each element of the array for input
+foreach($values as $value){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($value, $size) );
+ var_dump( array_chunk($value, $size, true) );
+ var_dump( array_chunk($value, $size, false) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 1 to be array, string given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation2.phpt b/ext/standard/tests/array/array_chunk_variation2.phpt
new file mode 100644
index 000000000..8cfe99440
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_variation2.phpt
@@ -0,0 +1,427 @@
+--TEST--
+Test array_chunk() function : usage variations - unexpected values for 'size' argument
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function with unexpected values for 'size' argument
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array (
+
+ // float data
+/*1*/ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+/*6*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // string data
+/*19*/ "string",
+ 'string',
+
+ // object data
+/*21*/ new stdclass(),
+
+ // undefined data
+/*22*/ @undefined_var,
+
+ // unset data
+/*23*/ @unset_var
+
+);
+
+// loop through each element of the array for size
+$count = 1;
+foreach($values as $value){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input, $value) );
+ var_dump( array_chunk($input, $value, true) );
+ var_dump( array_chunk($input, $value, false) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 2 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 4 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [1]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+
+-- Iteration 14 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [1]=>
+ int(2)
+ }
+}
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+
+-- Iteration 16 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: array_chunk() expects parameter 2 to be long, string given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation3.phpt b/ext/standard/tests/array/array_chunk_variation3.phpt
new file mode 100644
index 000000000..452006a44
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_variation3.phpt
@@ -0,0 +1,268 @@
+--TEST--
+Test array_chunk() function : usage variations - unexpected values for 'preserve_keys'
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function with unexpected values for 'preserve_keys'
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input = array(1, 2);
+$size = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$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,
+
+ // empty data
+/*12*/ "",
+ '',
+
+ // string data
+/*14*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var
+
+);
+
+$count = 1;
+
+// loop through each element of the array for preserve_keys
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input, $size, $value) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 13 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 14 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 16 --
+
+Warning: array_chunk() expects parameter 3 to be boolean, object given in %s on line %d
+NULL
+
+-- Iteration 17 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation4.phpt b/ext/standard/tests/array/array_chunk_variation4.phpt
new file mode 100644
index 000000000..7f04f51bf
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_variation4.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Test array_chunk() function : usage variations - array with diff. sub arrays
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_chunk() function - input array containing different sub arrays
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+$size = 2;
+
+// input array
+$input_array = array (
+ "array1" => array(),
+ "array2" => array(1, 2, 3),
+ "array3" => array(1)
+);
+
+echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt --\n";
+var_dump( array_chunk($input_array, $size) );
+
+echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = true --\n";
+var_dump( array_chunk($input_array, $size, true) );
+
+echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = false --\n";
+var_dump( array_chunk($input_array, $size, false) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+}
+
+-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = true --
+array(2) {
+ [0]=>
+ array(2) {
+ ["array1"]=>
+ array(0) {
+ }
+ ["array2"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ }
+ [1]=>
+ array(1) {
+ ["array3"]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+}
+
+-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = false --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt
new file mode 100644
index 000000000..8d3609282
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_variation5.phpt
@@ -0,0 +1,148 @@
+--TEST--
+Test array_chunk() function : usage variations - different 'size' values
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_chunk() function with following conditions
+ * 1. -ve size value
+ * 2. size value is more than the no. of elements in the input array
+ * 3. size value is zero
+ * 4. Decimal size value
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input_array = array(1, 2, 3);
+
+// different magnitude's
+$sizes = array(-1, count($input_array) + 1, 0, 1.5);
+
+// loop through the array for size argument
+foreach ($sizes as $size){
+ echo "\n-- Testing array_chunk() when size = $size --\n";
+ var_dump( array_chunk($input_array, $size) );
+ var_dump( array_chunk($input_array, $size, true) );
+ var_dump( array_chunk($input_array, $size, false) );
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk() when size = -1 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Testing array_chunk() when size = 4 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Testing array_chunk() when size = 0 --
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+-- Testing array_chunk() when size = 1.5 --
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [2]=>
+ int(3)
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation6.phpt b/ext/standard/tests/array/array_chunk_variation6.phpt
new file mode 100644
index 000000000..f44eb3960
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_variation6.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test array_chunk() function : usage variations - different arrays
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_chunk() function with following conditions
+ * 1. array without elements
+ * 2. associative array with duplicate keys
+ * 3. array with one element
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+// input array
+$input_arrays = array (
+
+ // array without elements
+ "array1" => array(),
+
+ // array with one element
+ "array2" => array(1),
+
+ // associative array with duplicate keys
+ "array3" => array("a" => 1, "b" => 2, "c" => 3, "a" => 4, "d" => 5)
+
+);
+
+$size = 2;
+$count = 1;
+
+echo "\n-- Testing array_chunk() by supplying various arrays --\n";
+
+// loop through the array for 'array' argument
+foreach ($input_arrays as $input_array){
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_chunk($input_array, $size) );
+ var_dump( array_chunk($input_array, $size, true) );
+ var_dump( array_chunk($input_array, $size, false) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk() by supplying various arrays --
+
+-- Iteration 1 --
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(5)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ ["a"]=>
+ int(4)
+ ["b"]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ ["c"]=>
+ int(3)
+ ["d"]=>
+ int(5)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(5)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_chunk_variation7.phpt b/ext/standard/tests/array/array_chunk_variation7.phpt
new file mode 100644
index 000000000..c8a71964f
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk_variation7.phpt
@@ -0,0 +1,89 @@
+--TEST--
+Test array_chunk() function : usage variations - references
+--FILE--
+<?php
+/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
+ * Description: Split array into chunks
+ * : Chunks an array into size large chunks
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_chunk() function with following conditions
+ * 1. input array containing references
+*/
+
+echo "*** Testing array_chunk() : usage variations ***\n";
+
+$size = 2;
+
+echo "\n-- Testing array_chunk(), input array containing references \n";
+
+$numbers=array(1, 2, 3, 4);
+// reference array
+$input_array = array (
+ "one" => &$numbers[0],
+ "two" => &$numbers[1],
+ "three" => &$numbers[2],
+ "four" => &$numbers[3]
+);
+
+var_dump( array_chunk($input_array, $size) );
+var_dump( array_chunk($input_array, $size, true) );
+var_dump( array_chunk($input_array, $size, false) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_chunk() : usage variations ***
+
+-- Testing array_chunk(), input array containing references
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ &int(3)
+ [1]=>
+ &int(4)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ ["one"]=>
+ &int(1)
+ ["two"]=>
+ &int(2)
+ }
+ [1]=>
+ array(2) {
+ ["three"]=>
+ &int(3)
+ ["four"]=>
+ &int(4)
+ }
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ &int(3)
+ [1]=>
+ &int(4)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_combine_basic.phpt b/ext/standard/tests/array/array_combine_basic.phpt
new file mode 100644
index 000000000..5d855cfec
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_basic.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test array_combine() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_combine() : basic functionality ***\n";
+
+/* Different arrays for $keys and $values arguments */
+
+// array with default keys for $keys and $values arguments
+$keys_array = array(1, 2);
+$values_array = array(3,4);
+var_dump( array_combine($keys_array, $values_array) );
+
+// associative arrays for $keys and $values arguments
+$keys_array = array(1 => "a", 2 => 'b');
+$values_array = array(3 => 'c', 4 => "d");
+var_dump( array_combine($keys_array, $values_array) );
+
+// mixed array for $keys and $values arguments
+$keys_array = array(1, 2 => "b");
+$values_array = array(3 => 'c', 4);
+var_dump( array_combine($keys_array, $values_array) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : basic functionality ***
+array(2) {
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+array(2) {
+ ["a"]=>
+ string(1) "c"
+ ["b"]=>
+ string(1) "d"
+}
+array(2) {
+ [1]=>
+ string(1) "c"
+ ["b"]=>
+ int(4)
+}
+Done
diff --git a/ext/standard/tests/array/array_combine_error1.phpt b/ext/standard/tests/array/array_combine_error1.phpt
new file mode 100644
index 000000000..aa5a1afe1
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_error1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test array_combine() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_combine() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_combine() function with Zero arguments --\n";
+var_dump( array_combine() );
+
+//Test array_combine with one more than the expected number of arguments
+echo "\n-- Testing array_combine() function with more than expected no. of arguments --\n";
+$keys = array(1, 2);
+$values = array(1, 2);
+$extra_arg = 10;
+var_dump( array_combine($keys,$values, $extra_arg) );
+
+// Testing array_combine with one less than the expected number of arguments
+echo "\n-- Testing array_combine() function with less than expected no. of arguments --\n";
+$keys = array(1, 2);
+var_dump( array_combine($keys) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : error conditions ***
+
+-- Testing array_combine() function with Zero arguments --
+
+Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing array_combine() function with more than expected no. of arguments --
+
+Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing array_combine() function with less than expected no. of arguments --
+
+Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt
new file mode 100644
index 000000000..c06fdb490
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_error2.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_combine() function : error conditions - empty array
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_combine() : error conditions specific to array_combine() ***\n";
+
+// Testing array_combine by passing empty arrays to $keys and $values arguments
+echo "\n-- Testing array_combine() function with empty arrays --\n";
+var_dump( array_combine(array(), array()) );
+
+// Testing array_combine by passing empty array to $keys
+echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n";
+var_dump( array_combine(array(), array(1, 2)) );
+
+// Testing array_combine by passing empty array to $values
+echo "\n-- Testing array_combine() function with empty array for \$values argument --\n";
+var_dump( array_combine(array(1, 2), array()) );
+
+// Testing array_combine with arrays having unequal number of elements
+echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n";
+var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : error conditions specific to array_combine() ***
+
+-- Testing array_combine() function with empty arrays --
+
+Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d
+bool(false)
+
+-- Testing array_combine() function with empty array for $keys argument --
+
+Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
+bool(false)
+
+-- Testing array_combine() function with empty array for $values argument --
+
+Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
+bool(false)
+
+-- Testing array_combine() function by passing array with unequal number of elements --
+
+Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_combine_variation1.phpt b/ext/standard/tests/array/array_combine_variation1.phpt
new file mode 100644
index 000000000..c69d4ebaf
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_variation1.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test array_combine() function : usage variations - unexpected values for 'keys' argument
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_combine() function by passing values to $keys argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $values argument passed is a fixed array.
+*/
+
+echo "*** Testing array_combine() : Passing non-array values to \$keys argument ***\n";
+
+// Initialise $values argument
+$values = array(1, 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 $keys argument
+$keys_passed = 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 element within $keys_passed to check the behavior of array_combine()
+$iterator = 1;
+foreach($keys_passed as $keys) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($keys,$values) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : Passing non-array values to $keys argument ***
+-- Iteration 1 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: array_combine() expects parameter 1 to be array, object given in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: array_combine() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_combine_variation2.phpt b/ext/standard/tests/array/array_combine_variation2.phpt
new file mode 100644
index 000000000..e58893bae
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_variation2.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test array_combine() function : usage variations - unexpected values for 'values' argument
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_combine() function by passing values to $values argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $keys argument passed is a fixed array.
+*/
+
+echo "*** Testing array_combine() : Passing non-array values to \$values argument ***\n";
+
+// Initialize $keys array
+$keys = array(1, 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 $values argument
+$values_passed = 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 element within $values_passed to check the behavior of array_combine()
+$iterator = 1;
+foreach($values_passed as $values) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($keys,$values) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : Passing non-array values to $values argument ***
+-- Iteration 1 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: array_combine() expects parameter 2 to be array, object given in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: array_combine() expects parameter 2 to be array, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_combine_variation3.phpt b/ext/standard/tests/array/array_combine_variation3.phpt
new file mode 100644
index 000000000..51d8462d5
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_variation3.phpt
@@ -0,0 +1,279 @@
+--TEST--
+Test array_combine() function : usage variations - different arrays(Bug#43424)
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to both $keys and $values arguments and testing whether
+* array_combine() behaves in an expected way with the arguments passed to the function
+*/
+
+echo "*** Testing array_combine() : Passing different types of arrays to both \$keys and \$values argument ***\n";
+/* Different heredoc strings passed as argument to arrays */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The quick 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 passed to $keys 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)
+);
+
+// loop through each sub-array within $arrays to check the behavior of array_combine()
+// same arrays are passed to both $keys and $values
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($array, $array) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : Passing different types of arrays to both $keys and $values argument ***
+-- Iteration 1 --
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+-- Iteration 2 --
+array(2) {
+ ["1.1"]=>
+ float(1.1)
+ ["2.2"]=>
+ float(2.2)
+}
+-- Iteration 3 --
+array(2) {
+ [""]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iteration 4 --
+
+Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d
+bool(false)
+-- Iteration 5 --
+array(1) {
+ [""]=>
+ NULL
+}
+-- Iteration 6 --
+array(6) {
+ ["a "]=>
+ string(3) "a "
+ ["aaaa "]=>
+ string(5) "aaaa "
+ ["b"]=>
+ string(1) "b"
+ ["b bbb"]=>
+ string(5) "b bbb"
+ ["c"]=>
+ string(1) "c"
+ ["\[\]\!\@\#$\%\^\&\*\(\)\{\}"]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 7 --
+array(6) {
+ ["a\v\f"]=>
+ string(5) "a\v\f"
+ ["aaaa\r"]=>
+ string(6) "aaaa\r"
+ ["b"]=>
+ string(1) "b"
+ ["b\tbbb"]=>
+ string(6) "b\tbbb"
+ ["c"]=>
+ string(1) "c"
+ ["\[\]\!\@\#\$\%\^\&\*\(\)\{\}"]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 8 --
+array(4) {
+ ["
+"]=>
+ string(1) "
+"
+ ["hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string"]=>
+ string(88) "hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ ["11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+}
+-- Iteration 9 --
+array(3) {
+ ["one"]=>
+ string(3) "one"
+ ["two"]=>
+ string(3) "two"
+ ["three"]=>
+ string(5) "three"
+}
+-- Iteration 10 --
+array(3) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+-- Iteration 11 --
+array(4) {
+ [10]=>
+ int(10)
+ [20]=>
+ int(20)
+ [40]=>
+ int(40)
+ [30]=>
+ int(30)
+}
+-- Iteration 12 --
+array(3) {
+ ["ten"]=>
+ string(3) "ten"
+ ["twenty"]=>
+ string(6) "twenty"
+ ["thirty"]=>
+ string(6) "thirty"
+}
+-- Iteration 13 --
+array(3) {
+ [1]=>
+ int(1)
+ ["two"]=>
+ string(3) "two"
+ ["four"]=>
+ string(4) "four"
+}
+-- Iteration 14 --
+array(2) {
+ ["null"]=>
+ string(4) "null"
+ [""]=>
+ NULL
+}
+-- Iteration 15 --
+array(4) {
+ ["true"]=>
+ string(4) "true"
+ ["false"]=>
+ string(5) "false"
+ [""]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iteration 16 --
+array(2) {
+ ["emptys"]=>
+ string(6) "emptys"
+ [""]=>
+ string(0) ""
+}
+-- Iteration 17 --
+array(2) {
+ [""]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iteration 18 --
+array(3) {
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+ [6]=>
+ int(6)
+}
+-- Iteration 19 --
+array(3) {
+ [10]=>
+ int(10)
+ [20]=>
+ int(20)
+ [3]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt
new file mode 100644
index 000000000..02ec6efd2
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_variation4.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test array_combine() function : usage variations - associative array with different keys(Bug#43424)
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_combine() by passing different
+ * associative arrays having different possible keys to $keys argument and
+ * associative arrays having different possible keys to $values argument.
+*/
+
+echo "*** Testing array_combine() : assoc array with diff keys to both \$keys and \$values 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 $arrays to check the behavior of array_combine()
+// same arrays are passed to both $keys and $values
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($array, $array) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : assoc array with diff keys to both $keys and $values 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 --
+
+Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ string(1) "1"
+}
+-- Iteration 4 --
+array(4) {
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(1) "3"
+ [4]=>
+ string(1) "4"
+}
+-- Iteration 5 --
+array(1) {
+ ["float"]=>
+ string(5) "float"
+}
+-- Iteration 6 --
+array(4) {
+ ["f1"]=>
+ string(2) "f1"
+ ["f2"]=>
+ string(2) "f2"
+ ["f3"]=>
+ string(2) "f3"
+ ["f4"]=>
+ string(2) "f4"
+}
+-- Iteration 7 --
+array(4) {
+ [111]=>
+ int(111)
+ ["color"]=>
+ string(5) "color"
+ ["2.2"]=>
+ float(2.2)
+ [33]=>
+ int(33)
+}
+-- Iteration 8 --
+array(4) {
+ [111]=>
+ int(111)
+ ["color"]=>
+ string(5) "color"
+ ["2.2"]=>
+ float(2.2)
+ [33]=>
+ int(33)
+}
+-- Iteration 9 --
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["string"]=>
+ string(6) "string"
+}
+-- Iteration 10 --
+array(1) {
+ ["hello"]=>
+ string(5) "hello"
+}
+-- Iteration 11 --
+array(6) {
+ [1]=>
+ int(1)
+ ["2.2"]=>
+ float(2.2)
+ ["int"]=>
+ string(3) "int"
+ ["float"]=>
+ string(5) "float"
+ ["unset"]=>
+ string(5) "unset"
+ ["heredoc"]=>
+ string(7) "heredoc"
+}
+Done
diff --git a/ext/standard/tests/array/array_combine_variation5.phpt b/ext/standard/tests/array/array_combine_variation5.phpt
new file mode 100644
index 000000000..c3d1d57aa
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_variation5.phpt
@@ -0,0 +1,186 @@
+--TEST--
+Test array_combine() function : usage variations - associative array with different values(Bug#43424)
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the functionality of array_combine() by passing various
+* associative arrays having different possible values to $keys argument and
+* associative arrays having different possible values to $values argument.
+*/
+
+echo "*** Testing array_combine() : assoc array with diff values to both \$keys and \$values 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 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.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)
+);
+
+
+// loop through each sub-array within $arrays to check the behavior of array_combine()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_combine($array, $array) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : assoc array with diff values to both $keys and $values argument ***
+-- Iteration 1 --
+
+Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ int(1)
+}
+-- Iteration 4 --
+array(4) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+}
+-- Iteration 5 --
+array(1) {
+ ["2.3333"]=>
+ float(2.3333)
+}
+-- Iteration 6 --
+array(4) {
+ ["1.2"]=>
+ float(1.2)
+ ["3.33"]=>
+ float(3.33)
+ ["4.8999992284"]=>
+ float(4.8999992284)
+ ["33333333.333"]=>
+ float(33333333.333)
+}
+-- Iteration 7 --
+array(4) {
+ [" Hello"]=>
+ string(6) " Hello"
+ ["col or"]=>
+ string(6) "col or"
+ [" world"]=>
+ string(7) " world"
+ ["pen
+"]=>
+ string(4) "pen
+"
+}
+-- Iteration 8 --
+array(4) {
+ ["\tHello"]=>
+ string(7) "\tHello"
+ ["col\tor"]=>
+ string(7) "col\tor"
+ ["\v\fworld"]=>
+ string(9) "\v\fworld"
+ ["pen\n"]=>
+ string(5) "pen\n"
+}
+-- Iteration 9 --
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(11) "Hello world"
+}
+-- Iteration 10 --
+array(3) {
+ ["Class A object"]=>
+ object(classA)#%d (0) {
+ }
+ [""]=>
+ NULL
+ ["Resource id #%d"]=>
+ resource(%d) of type (stream)
+}
+-- Iteration 11 --
+array(8) {
+ ["hello"]=>
+ string(5) "hello"
+ ["Class A object"]=>
+ object(classA)#%d (0) {
+ }
+ ["fruit"]=>
+ string(5) "fruit"
+ ["Resource id #%d"]=>
+ resource(%d) of type (stream)
+ [133]=>
+ int(133)
+ ["444.432"]=>
+ float(444.432)
+ [""]=>
+ NULL
+ ["Hello world"]=>
+ string(11) "Hello world"
+}
+Done
diff --git a/ext/standard/tests/array/array_combine_variation6.phpt b/ext/standard/tests/array/array_combine_variation6.phpt
new file mode 100644
index 000000000..94c7b4d66
--- /dev/null
+++ b/ext/standard/tests/array/array_combine_variation6.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_combine() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_combine() by passing array with
+* binary values for $keys and $values argument.
+*/
+
+echo "*** Testing array_combine() : binary safe checking ***\n";
+
+// array with binary values
+$arr_binary = array(b"hello", b"world");
+$arr_normal = array("hello", "world");
+
+// array with binary value for $keys and $values argument
+var_dump( array_combine($arr_binary, $arr_binary) );
+
+// array with binary value for $values argument
+var_dump( array_combine($arr_normal, $arr_binary) );
+
+// array with binary value for $keys argument
+var_dump( array_combine($arr_binary, $arr_normal) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_combine() : binary safe checking ***
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["world"]=>
+ string(5) "world"
+}
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["world"]=>
+ string(5) "world"
+}
+array(2) {
+ ["hello"]=>
+ string(5) "hello"
+ ["world"]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_basic.phpt b/ext/standard/tests/array/array_diff_assoc_basic.phpt
new file mode 100644
index 000000000..c6b3aef00
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_basic.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test array_diff_assoc() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_diff_assoc
+ */
+
+echo "*** Testing array_diff_assoc() : basic functionality ***\n";
+$array_default_key = array('one', 2, 'three', '4');
+$array_numeric_key = array(1 => 'one', 2=> 'two', 3 => 4);
+$array_string_key = array('one' => 1, 'two' => '2', '3' => 'three');
+
+
+
+echo "-- Compare Default keys to numeric keys --\n";
+var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
+var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
+
+
+echo "\n-- Compare Default keys to string keys --\n";
+var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
+var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
+
+
+echo "\n-- Compare numeric keys to string keys --\n";
+var_dump(array_diff_assoc($array_numeric_key, $array_string_key));
+var_dump(array_diff_assoc($array_string_key, $array_numeric_key));
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : basic functionality ***
+-- Compare Default keys to numeric keys --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+
+-- Compare Default keys to string keys --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+
+-- Compare numeric keys to string keys --
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(4)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ string(1) "2"
+ [3]=>
+ string(5) "three"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt
new file mode 100644
index 000000000..0c9da2f2c
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test array_diff_assoc() function : error conditions - pass array_diff_assoc() too few/zero arguments
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test errors for array_diff with too few\zero arguments
+ */
+
+echo "*** Testing array_diff_assoc() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_diff() function with zero arguments --\n";
+var_dump( array_diff_assoc() );
+
+// Testing array_diff_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_diff_assoc($arr1) );
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : error conditions ***
+
+-- Testing array_diff() function with zero arguments --
+
+Warning: Wrong parameter count for array_diff_assoc() in %s on line %d
+NULL
+
+-- Testing array_diff_assoc() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_diff_assoc() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt
new file mode 100644
index 000000000..b6c63794b
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt
@@ -0,0 +1,234 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - unexpected values for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_diff_assoc arguments that are not arrays in place of $arr1
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//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");
+
+//array of unexpected values to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp,
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($input, $array));
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+
+Warning: array_diff_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation10.phpt b/ext/standard/tests/array/array_diff_assoc_variation10.phpt
new file mode 100644
index 000000000..0687ed8a5
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation10.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - binary safe check
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() compares binary data
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array1 = array( b"1",
+ b"hello",
+ "world",
+ "str1" => "hello",
+ "str2" => "world");
+
+$array2 = array( b"1" => 'hello',
+ b"world",
+ "hello",
+ 'test');
+
+var_dump(array_diff_assoc($array1, $array2));
+var_dump(array_diff_assoc($array2, $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+array(3) {
+ [0]=>
+ string(1) "1"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+}
+array(2) {
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ string(4) "test"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt
new file mode 100644
index 000000000..5de94424e
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt
@@ -0,0 +1,235 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - unexpected values for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * pass array_diff_assoc arguments which are not arrays in place of $arr2
+ */
+
+echo "\n*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//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");
+
+//array of unexpected values to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp,
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($array, $input));
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+
+Warning: array_diff_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation3.phpt b/ext/standard/tests/array/array_diff_assoc_variation3.phpt
new file mode 100644
index 000000000..1d4aaf2e4
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation3.phpt
@@ -0,0 +1,206 @@
+--TEST--
+Test array_diff_assoc() function : variation - array containing different data types
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() compares indexed arrays containing different data types
+ */
+
+echo "\n*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//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;
+
+//array of different data types to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/
+'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345),
+
+ // float data
+/*2*/
+'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5),
+
+ // null data
+/*3*/
+'null' => array(
+ NULL,
+ null),
+
+ // boolean data
+/*4*/
+'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE),
+
+ // empty data
+/*5*/
+'empty' => array(
+ "",
+ ''),
+
+ // string data
+/*6*/
+'string' => array(
+ "string",
+ 'string',
+ $heredoc),
+
+ // binary data
+/*7*/
+'binary' => array(
+ b"binary",
+ (binary)"binary"),
+
+ // object data
+/*8*/
+'object' => array(
+ new classA()),
+
+ // undefined data
+/*9*/
+'undefined' => array(
+ @$undefined_var),
+
+ // unset data
+/*10*/
+'unset' => array(
+ @$unset_var),
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($input, $array));
+ $iterator++;
+};
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+}
+
+-- Iteration 2 --
+array(5) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+-- Iteration 4 --
+array(3) {
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+
+-- Iteration 6 --
+array(3) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(11) "hello world"
+}
+
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(6) "binary"
+ [1]=>
+ string(6) "binary"
+}
+
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation4.phpt b/ext/standard/tests/array/array_diff_assoc_variation4.phpt
new file mode 100644
index 000000000..34e979ab2
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation4.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - arrays with different data types as keys
+--FILE--
+
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() compares arrays containing different data types
+ * as keys
+ */
+
+echo "\n*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+//Different data types as keys to be passed to $arr1 argument
+$inputs = array(
+
+ // int data
+/*1*/
+'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative'),
+
+ // float data
+/*2*/
+'float' => array(
+ 10.5 => 'float 1',
+ -10.5 => 'float 2',
+ .5 => 'float 3'),
+
+ // null data
+/*3*/
+'null' => array(
+ NULL => 'null 1',
+ null => 'null 2'),
+
+ // boolean data
+/*4*/
+'bool' => array(
+ true => 'boolt',
+ false => 'boolf',
+ TRUE => 'boolT',
+ FALSE => 'boolF'),
+
+ // empty data
+/*5*/
+'empty' => array(
+ "" => 'emptyd',
+ '' => 'emptys'),
+
+ // string data
+/*6*/
+'string' => array(
+ "string" => 'stringd',
+ 'string' => 'strings',
+ $heredoc => 'stringh'),
+
+ // binary data
+/*7*/
+'binary' => array(
+ b"binary1" => 'binary 1',
+ (binary)"binary2" => 'binary 2'),
+
+ // undefined data
+/*8*/
+'undefined' => array(
+ @$undefined_var => 'undefined'),
+
+ // unset data
+/*9*/
+'unset' => array(
+ @$unset_var => 'unset'),
+
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_diff_assoc($input, $array));
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [-2345]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 --
+array(3) {
+ [10]=>
+ string(7) "float 1"
+ [-10]=>
+ string(7) "float 2"
+ [0]=>
+ string(7) "float 3"
+}
+
+-- Iteration 3 --
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 4 --
+array(2) {
+ [1]=>
+ string(5) "boolT"
+ [0]=>
+ string(5) "boolF"
+}
+
+-- Iteration 5 --
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 6 --
+array(2) {
+ ["string"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 7 --
+array(2) {
+ ["binary1"]=>
+ string(8) "binary 1"
+ ["binary2"]=>
+ string(8) "binary 2"
+}
+
+-- Iteration 8 --
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 9 --
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation5.phpt b/ext/standard/tests/array/array_diff_assoc_variation5.phpt
new file mode 100644
index 000000000..c89c65642
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation5.phpt
@@ -0,0 +1,148 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - compare integers, floats and strings
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc compares integers, floats and string
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+$arr_default_int = array(1, 2, 3, 'a');
+$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00, 'b');
+$arr_string = array('1', '2', '3', 'c');
+$arr_string_float = array('0' => '1.00', '1.00' => '2.00', '2.00' => '3.00', 'd');
+
+echo "-- Result of comparing integers and floating point numbers: --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_float));
+var_dump(array_diff_assoc($arr_float, $arr_default_int));
+
+echo "-- Result of comparing integers and strings containing an integers : --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_string));
+var_dump(array_diff_assoc($arr_string, $arr_default_int));
+
+echo "-- Result of comparing integers and strings containing floating points : --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_string_float));
+var_dump(array_diff_assoc($arr_string_float, $arr_default_int));
+
+echo "-- Result of comparing floating points and strings containing integers : --\n";
+var_dump(array_diff_assoc($arr_float, $arr_string));
+var_dump(array_diff_assoc($arr_string, $arr_float));
+
+echo "-- Result of comparing floating points and strings containing floating point: --\n";
+var_dump(array_diff_assoc($arr_float, $arr_string_float));
+var_dump(array_diff_assoc($arr_string_float, $arr_float));
+
+echo "-- Result of comparing strings containing integers and strings containing floating points : --\n";
+var_dump(array_diff_assoc($arr_string, $arr_string_float));
+var_dump(array_diff_assoc($arr_string_float, $arr_string));
+
+echo "-- Result of comparing more than two arrays: --\n";
+var_dump(array_diff_assoc($arr_default_int, $arr_float, $arr_string, $arr_string_float));
+
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+-- Result of comparing integers and floating point numbers: --
+array(1) {
+ [3]=>
+ string(1) "a"
+}
+array(1) {
+ [3]=>
+ string(1) "b"
+}
+-- Result of comparing integers and strings containing an integers : --
+array(1) {
+ [3]=>
+ string(1) "a"
+}
+array(1) {
+ [3]=>
+ string(1) "c"
+}
+-- Result of comparing integers and strings containing floating points : --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(1) "a"
+}
+array(4) {
+ [0]=>
+ string(4) "1.00"
+ ["1.00"]=>
+ string(4) "2.00"
+ ["2.00"]=>
+ string(4) "3.00"
+ [1]=>
+ string(1) "d"
+}
+-- Result of comparing floating points and strings containing integers : --
+array(1) {
+ [3]=>
+ string(1) "b"
+}
+array(1) {
+ [3]=>
+ string(1) "c"
+}
+-- Result of comparing floating points and strings containing floating point: --
+array(4) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(2)
+ [2]=>
+ float(3)
+ [3]=>
+ string(1) "b"
+}
+array(4) {
+ [0]=>
+ string(4) "1.00"
+ ["1.00"]=>
+ string(4) "2.00"
+ ["2.00"]=>
+ string(4) "3.00"
+ [1]=>
+ string(1) "d"
+}
+-- Result of comparing strings containing integers and strings containing floating points : --
+array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "c"
+}
+array(4) {
+ [0]=>
+ string(4) "1.00"
+ ["1.00"]=>
+ string(4) "2.00"
+ ["2.00"]=>
+ string(4) "3.00"
+ [1]=>
+ string(1) "d"
+}
+-- Result of comparing more than two arrays: --
+array(1) {
+ [3]=>
+ string(1) "a"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation6.phpt b/ext/standard/tests/array/array_diff_assoc_variation6.phpt
new file mode 100644
index 000000000..d6190b658
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation6.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - strict string comparison check
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc behaves
+ * 1. When comparing an array that has similar elements
+ * but has been created in a different order
+ * 2. When doing a strict comparison of string representation
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array = array ('zero',
+ 1 => 1,
+ 'two' => 2.00000000000001);
+
+$inputs = array (
+
+//default keys => string values
+/*1*/ array('2.00000000000001', '1', 'zero', 'a'),
+
+//numeric keys => string values
+/*2*/ array(2 => '2.00000000000001',
+ 1 => '1',
+ 0 => 'zero',
+ 3 => 'a'),
+
+//string keys => string values
+/*3*/ array('2' => '2.00000000000001',
+ '1' => '1',
+ '0' => 'zero',
+ '3' => 'a') ,
+
+//default keys => numeric values
+/*4*/ array(2, 1, 0),
+
+//numeric keys => numeric values
+/*5*/ array(2 => 2,
+ 1 => 1,
+ 0 => 0),
+
+//string keys => numeric values
+/*6*/ array('two' => 2,
+ '1' => 1,
+ '0' => 0),
+
+//defualt keys => float values
+/*7*/ array(2.00000000000001, 1.00, 0.01E-9),
+
+//numeric keys => float values
+/*8*/ array(2 => 2.00000000000001,
+ 1 => 1.00,
+ 0 => 0.01E-9),
+
+//string keys => float values
+/*9*/ array ('two' => 2.00000000000001,
+ '1' => 1.00,
+ '0' =>0.01E-9)
+);
+
+// loop through each element of $inputs to check the behavior of array_diff_assoc
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(array_diff_assoc($array, $input));
+ var_dump(array_diff_assoc($input, $array));
+ $iterator++;
+};
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(3) {
+ [0]=>
+ string(16) "2.00000000000001"
+ [2]=>
+ string(4) "zero"
+ [3]=>
+ string(1) "a"
+}
+
+-- Iteration 2 --
+array(1) {
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ string(16) "2.00000000000001"
+ [3]=>
+ string(1) "a"
+}
+
+-- Iteration 3 --
+array(1) {
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ string(16) "2.00000000000001"
+ [3]=>
+ string(1) "a"
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [0]=>
+ int(2)
+ [2]=>
+ int(0)
+}
+
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ int(2)
+ [0]=>
+ int(0)
+}
+
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(4) "zero"
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [0]=>
+ float(2)
+ [2]=>
+ float(1.0E-11)
+}
+
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ float(2)
+}
+array(2) {
+ [2]=>
+ float(2)
+ [0]=>
+ float(1.0E-11)
+}
+
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(4) "zero"
+}
+array(1) {
+ [0]=>
+ float(1.0E-11)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation7.phpt b/ext/standard/tests/array/array_diff_assoc_variation7.phpt
new file mode 100644
index 000000000..6fab0aebf
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation7.phpt
@@ -0,0 +1,101 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - arrays containing referenced variables
+--FILE--
+
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Tests how array_diff_assoc compares
+ * 1. Referenced variables
+ * 2. Arrays that have been referenced to each other
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$a = 'a';
+
+$arr1 = array('a', 'b', 'c', $a);
+$arr2 = array('a' => 1, 'b' => 2, 'c' => 3, &$a);
+
+echo "-- Results when \$a = $a: --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+$a = 4;
+
+echo "-- Results when \$a has been changed to $a: --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+$arr2 = &$arr1;
+
+echo "-- Results when \$arr2 is referenced to \$arr1 --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+$arr1 = array('zero' => 'x', 'one' => 'y', 'two' => 'z');
+
+echo "-- Results when \$arr1 is changed --\n";
+var_dump(array_diff_assoc($arr1, $arr2));
+var_dump(array_diff_assoc($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff_assoc() : usage variations ***
+-- Results when $a = a: --
+array(3) {
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "a"
+}
+array(3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+}
+-- Results when $a has been changed to 4: --
+array(4) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "a"
+}
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ [0]=>
+ &int(4)
+}
+-- Results when $arr2 is referenced to $arr1 --
+array(0) {
+}
+array(0) {
+}
+-- Results when $arr1 is changed --
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_assoc_variation8.phpt b/ext/standard/tests/array/array_diff_assoc_variation8.phpt
new file mode 100644
index 000000000..3189c11f2
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation8.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - array containing duplicate keys and values
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc() behaves when comparing:
+ * 1. the order of the array
+ * 2. duplicate values
+ * 3. duplicate key names
+ */
+
+echo "*** Testing array_diff_assoc() : variation ***\n";
+
+$array_index = array('a', 'b', 'c', 0 => 'd', 'b'); //duplicate key (0), duplicate value (b)
+$array_assoc = array ('2' => 'c', //same key=>value pair, different order
+ '1' => 'b',
+ '0' => 'a',
+ 'b' => '3', //key and value from array_index swapped
+ 'c' => 2); //same as above, using integer
+
+var_dump(array_diff_assoc($array_index, $array_assoc));
+var_dump(array_diff_assoc($array_assoc, $array_index));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : variation ***
+array(2) {
+ [0]=>
+ string(1) "d"
+ [3]=>
+ string(1) "b"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ ["b"]=>
+ string(1) "3"
+ ["c"]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation9.phpt b/ext/standard/tests/array/array_diff_assoc_variation9.phpt
new file mode 100644
index 000000000..5ab623265
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_variation9.phpt
@@ -0,0 +1,141 @@
+--TEST--
+Test array_diff_assoc() function : usage variations - compare multidimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
+ * Description: 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
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff_assoc behaves when comparing
+ * multi-dimensional arrays
+ */
+
+echo "*** Testing array_diff_assoc() : usage variations ***\n";
+
+$array1 = array('sub_array1' => array (1, 2, 3),
+ 'sub_array2' => array ('a', 'b', 'c'));
+$array2 = array('sub_arraya' => array (1, 3, 5),
+ 'sub_arrayb' => array ('a', 'z', 'y'));
+
+echo "-- Compare two 2-D arrays --\n";
+var_dump(array_diff_assoc($array1, $array2));
+var_dump(array_diff_assoc($array2, $array1));
+
+echo "\n-- Compare subarrays from two 2-D arrays --\n";
+var_dump(array_diff_assoc($array1['sub_array1'], $array2['sub_arraya']));
+var_dump(array_diff_assoc($array2['sub_arraya'], $array1['sub_array1']));
+var_dump(array_diff_assoc($array1['sub_array2'], $array2['sub_arrayb']));
+var_dump(array_diff_assoc($array2['sub_arrayb'], $array1['sub_array1']));
+
+echo "\n-- Compare a subarray from one 2-D array and one 2-D array --\n";
+var_dump(array_diff_assoc($array1['sub_array1'], $array2));
+var_dump(array_diff_assoc($array1, $array2['sub_arraya']));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : usage variations ***
+-- Compare two 2-D arrays --
+array(2) {
+ ["sub_array1"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["sub_array2"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+array(2) {
+ ["sub_arraya"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ ["sub_arrayb"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "z"
+ [2]=>
+ string(1) "y"
+ }
+}
+
+-- Compare subarrays from two 2-D arrays --
+array(2) {
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+}
+array(2) {
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "z"
+ [2]=>
+ string(1) "y"
+}
+
+-- Compare a subarray from one 2-D array and one 2-D array --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ ["sub_array1"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["sub_array2"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_basic.phpt b/ext/standard/tests/array/array_diff_basic.phpt
new file mode 100644
index 000000000..30aead657
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_basic.phpt
@@ -0,0 +1,116 @@
+--TEST--
+Test array_diff() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not present
+ * in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_diff
+ */
+
+echo "*** Testing array_diff() : basic functionality ***\n";
+
+//Test indexed array with integers as elements
+$array_int1 = array (1, 2, 3, 4);
+$array_int2 = array (3, 4, 5, 6);
+
+echo "-- Test indexed array with integers as elements --\n";
+var_dump(array_diff($array_int1, $array_int2));
+var_dump(array_diff($array_int2, $array_int1));
+
+
+//Test indexed array with strings as elements
+$array_string1 = array ('one', 'two', 'three', 'four');
+$array_string2 = array ('three', 'four', 'five', 'six');
+
+echo "-- Test indexed array with strings as elements --\n";
+var_dump(array_diff($array_string1, $array_string2));
+var_dump(array_diff($array_string2, $array_string1));
+
+//Test associative array with strings as keys and integers as elements
+$array_assoc_int1 = array ('one' => 1, 'two' => 2, 'three' => 3, 'four' => 4);
+$array_assoc_int2 = array ('three' => 3, 'four' => 4, 'five' => 5, 'six' => 6);
+
+echo "-- Test associative array with strings as keys and integers as elements --\n";
+var_dump(array_diff($array_assoc_int1, $array_assoc_int2));
+var_dump(array_diff($array_assoc_int2, $array_assoc_int1));
+
+//Test associative array with strings as keys and elements
+$array_assoc_str1 = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois', 'four' => 'quatre');
+$array_assoc_str2 = array ('three' => 'trois', 'four' => 'quatre', 'five' => 'cinq', 'six' => 'six');
+
+echo "-- Test associative array with strings as keys and integers as elements --\n";
+var_dump(array_diff($array_assoc_str1, $array_assoc_str2));
+var_dump(array_diff($array_assoc_str2, $array_assoc_str1));
+
+echo "-- Test array_diff with more than 2 arguments --\n";
+var_dump(array_diff($array_int1, $array_int2, $array_string1, $array_string2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : basic functionality ***
+-- Test indexed array with integers as elements --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [2]=>
+ int(5)
+ [3]=>
+ int(6)
+}
+-- Test indexed array with strings as elements --
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+array(2) {
+ [2]=>
+ string(4) "five"
+ [3]=>
+ string(3) "six"
+}
+-- Test associative array with strings as keys and integers as elements --
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(2) {
+ ["five"]=>
+ int(5)
+ ["six"]=>
+ int(6)
+}
+-- Test associative array with strings as keys and integers as elements --
+array(2) {
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+}
+array(2) {
+ ["five"]=>
+ string(4) "cinq"
+ ["six"]=>
+ string(3) "six"
+}
+-- Test array_diff with more than 2 arguments --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt
new file mode 100644
index 000000000..2e4e86f08
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_diff() function : error conditions - too few arguments passed to function
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff with less than the expected number of arguments
+ */
+
+echo "*** Testing array_diff() : error conditions ***\n";
+// Zero arguments
+echo "\n-- Testing array_diff() function with zero arguments --\n";
+var_dump( array_diff() );
+
+
+// Testing array_diff with one less than the expected number of arguments
+echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_diff($arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : error conditions ***
+
+-- Testing array_diff() function with zero arguments --
+
+Warning: Wrong parameter count for array_diff() in %s on line %d
+NULL
+
+-- Testing array_diff() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_diff() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_basic.phpt b/ext/standard/tests/array/array_diff_key_basic.phpt
new file mode 100644
index 000000000..6f6fcb9a4
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test array_diff_key() : basic functionality
+--FILE--
+<?php
+/*
+* proto array array_diff_key(array arr1, array arr2 [, array ...])
+* Function is implemented in ext/standard/array.c
+*/
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_diff_key($array1, $array2));
+?>
+--EXPECT--
+array(2) {
+ ["red"]=>
+ int(2)
+ ["purple"]=>
+ int(4)
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt
new file mode 100644
index 000000000..00da7afa9
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key_variation1.phpt
@@ -0,0 +1,89 @@
+--TEST--
+array_diff_key() : type variations
+--FILE--
+<?php
+/*
+* proto array array_diff_key(array arr1, array arr2 [, array ...])
+* Function is implemented in ext/standard/array.c
+*/
+/*
+* Testing how array_diff_key treats keys that are numbers, floating point numbers or strings.
+*/
+$arr1 = array(1 => 'a', 2 => 'b', 3 => 'c', 'key1' => 'value');
+$arr2 = array(1.00 => 'a', 2.00 => 'b', 3.00 => 'c', 'key2' => 'value');
+$arr3 = array('1' => 'a', '2' => 'b', '3' => 'c', 'key3' => 'value');
+$arr4 = array('1.00' => 'a', '2.00' => 'b', '3.00' => 'c', 'key4' => 'value'); //$arr4 looks different to the other three arrays.
+print "Result of comparing integers and floating point value:\n"; //1 and 1.00 are treated as the same thing
+print_r(array_diff_key($arr1, $arr2));
+print_r(array_diff_key($arr2, $arr1));
+print "Result of comparing integers and strings containing an integers:\n"; //1 and the string 1 are treated as the same thing
+print_r(array_diff_key($arr1, $arr3));
+print_r(array_diff_key($arr3, $arr1));
+print "Result of comparing integers and strings containing floating points:\n"; //1 and the string 1.00 are not treated as the same thing
+print_r(array_diff_key($arr1, $arr4));
+print_r(array_diff_key($arr4, $arr1));
+print "Result of comparing floating points and strings containing integers:\n";
+print_r(array_diff_key($arr2, $arr3)); //1.00 and the string 1 are treated as the same thing
+print_r(array_diff_key($arr3, $arr2));
+print "Result of comparing strings containing integers and strings containing floating points:\n"; //the strings 1 and 1.00 are not treated as the same thing.
+print_r(array_diff_key($arr3, $arr4));
+print_r(array_diff_key($arr4, $arr3));
+?>
+--EXPECTF--
+Result of comparing integers and floating point value:
+Array
+(
+ [key1] => value
+)
+Array
+(
+ [key2] => value
+)
+Result of comparing integers and strings containing an integers:
+Array
+(
+ [key1] => value
+)
+Array
+(
+ [key3] => value
+)
+Result of comparing integers and strings containing floating points:
+Array
+(
+ [1] => a
+ [2] => b
+ [3] => c
+ [key1] => value
+)
+Array
+(
+ [1.00] => a
+ [2.00] => b
+ [3.00] => c
+ [key4] => value
+)
+Result of comparing floating points and strings containing integers:
+Array
+(
+ [key2] => value
+)
+Array
+(
+ [key3] => value
+)
+Result of comparing strings containing integers and strings containing floating points:
+Array
+(
+ [1] => a
+ [2] => b
+ [3] => c
+ [key3] => value
+)
+Array
+(
+ [1.00] => a
+ [2.00] => b
+ [3.00] => c
+ [key4] => value
+)
diff --git a/ext/standard/tests/array/array_diff_uassoc_basic.phpt b/ext/standard/tests/array/array_diff_uassoc_basic.phpt
new file mode 100644
index 000000000..6a96be6b7
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_uassoc_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+array_diff_uassoc(): Basic test
+--FILE--
+<?php
+/*
+* array array_diff_uassoc ( array $array1, array $array2 [, array $..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($a, $b) {
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $b) ? 1 : -1;
+}
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
+$array2 = array("a" => "green", "yellow", "red");
+$result = array_diff_uassoc($array1, $array2, "key_compare_func");
+var_dump($result);
+?>
+--EXPECT--
+array(3) {
+ ["b"]=>
+ string(5) "brown"
+ ["c"]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_ukey_basic.phpt b/ext/standard/tests/array/array_diff_ukey_basic.phpt
new file mode 100644
index 000000000..7ac309a01
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_ukey_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+array_diff_ukey() : Basic test.
+--FILE--
+<?php
+/*
+* proto array array_diff_ukey ( array $array1, array $array2 [, array $ ..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($key1, $key2) {
+ if ($key1 == $key2) return 0;
+ else if ($key1 > $key2) return 1;
+ else return -1;
+}
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_diff_ukey($array1, $array2, 'key_compare_func'));
+?>
+--EXPECT--
+array(2) {
+ ["red"]=>
+ int(2)
+ ["purple"]=>
+ int(4)
+}
diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt
new file mode 100644
index 000000000..f9a34b0a5
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation1.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test array_diff() function : usage variations - unexpected values for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff by passing non array values in place of $arr1
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//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 $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_diff
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_diff($input, $array));
+ $iterator++;
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+-- Iteration 1 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+Warning: array_diff(): Argument #1 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation10.phpt b/ext/standard/tests/array/array_diff_variation10.phpt
new file mode 100644
index 000000000..9442b946d
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation10.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test array_diff() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test behaviour of array_diff() function with binary input
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+
+$array1 = array( b"1",
+ b"hello",
+ "world",
+ "str1" => "hello",
+ "str2" => "world");
+
+$array2 = array( b"1" => 'hello',
+ b"world",
+ "hello",
+ 'test');
+
+var_dump(array_diff($array1, $array2));
+var_dump(array_diff($array2, $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+array(1) {
+ [4]=>
+ string(4) "test"
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt
new file mode 100644
index 000000000..be68c40c2
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation2.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test array_diff() function : usage variations - unexpected values for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff by passing non array values in place of $arr2
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array = array(1, 2, 3);
+
+//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 $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // binary data
+/*21*/ b"binary",
+ (binary)"binary",
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_diff
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_diff($array, $input));
+ $iterator++;
+};
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+-- Iteration 1 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 26 --
+Warning: array_diff(): Argument #2 is not an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation3.phpt b/ext/standard/tests/array/array_diff_variation3.phpt
new file mode 100644
index 000000000..84f73fd28
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation3.phpt
@@ -0,0 +1,190 @@
+--TEST--
+Test array_diff() function : usage variations - array with different data types as values
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff() compares indexed arrays containing different
+ * data types as values in place of $arr1
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get heredoc
+$heredoc = <<<END
+This is a heredoc
+END;
+
+//array of values to iterate over
+$values = array(
+
+/*1*/"empty array" => array(),
+
+/*2*/
+"int" => array(
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345),
+
+/*3*/
+"float" => array(
+ // float data
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5),
+
+/*4*/
+"null" => array(
+ // null data
+ NULL,
+ null),
+
+/*5*/
+"boolean" => array(
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE),
+
+/*6*/
+"empty" => array(
+ // empty data
+ "",
+ ''),
+
+/*7*/
+"string" => array(
+ // string data
+ "string",
+ 'string',
+ $heredoc),
+
+/*8*/
+"binary" => array(
+ // binary data
+ b"binary",
+ (binary)"binary"),
+
+/*9*/
+"undefined" => array(
+ // undefined data
+ @$undefined_var),
+
+/*10*/
+"unset" => array(
+ // unset data
+ @$unset_var)
+);
+
+// loop through each element of the array for arr1
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n Iteration: $iterator \n";
+ var_dump( array_diff($value, $array) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+ Iteration: 1
+array(0) {
+}
+
+ Iteration: 2
+array(3) {
+ [0]=>
+ int(0)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+}
+
+ Iteration: 3
+array(5) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+}
+
+ Iteration: 4
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+ Iteration: 5
+array(2) {
+ [1]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+ Iteration: 6
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+
+ Iteration: 7
+array(3) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(17) "This is a heredoc"
+}
+
+ Iteration: 8
+array(2) {
+ [0]=>
+ string(6) "binary"
+ [1]=>
+ string(6) "binary"
+}
+
+ Iteration: 9
+array(1) {
+ [0]=>
+ NULL
+}
+
+ Iteration: 10
+array(1) {
+ [0]=>
+ NULL
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation4.phpt b/ext/standard/tests/array/array_diff_variation4.phpt
new file mode 100644
index 000000000..75b01adaa
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation4.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test array_diff() function : usage variations - array with different data types as values
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff() compares indexed arrays containing different
+ * data types as values in place of $arr2
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$array = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get heredoc
+$heredoc = <<<END
+This is a heredoc
+END;
+
+//array of values to iterate over
+$values = array(
+
+/*1*/"empty array" => array(),
+
+/*2*/
+"int" => array(
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345),
+
+/*3*/
+"float" => array(
+ // float data
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5),
+
+/*4*/
+"null" => array(
+ // null data
+ NULL,
+ null),
+
+/*5*/
+"boolean" => array(
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE),
+
+/*6*/
+"empty" => array(
+ // empty data
+ "",
+ ''),
+
+/*7*/
+"string" => array(
+ // string data
+ "string",
+ 'string',
+ $heredoc),
+
+/*8*/
+"binary" => array(
+ // binary data
+ b"binary",
+ (binary)"binary"),
+
+/*9*/
+"undefined" => array(
+ // undefined data
+ @$undefined_var),
+
+/*10*/
+"unset" => array(
+ // unset data
+ @$unset_var)
+);
+
+// loop through each element of the array for $arr2
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n Iteration: $iterator \n";
+ var_dump( array_diff($array, $value) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+
+ Iteration: 1
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 2
+array(1) {
+ [1]=>
+ int(2)
+}
+
+ Iteration: 3
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 4
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 5
+array(1) {
+ [1]=>
+ int(2)
+}
+
+ Iteration: 6
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 7
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 8
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 9
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+ Iteration: 10
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation5.phpt b/ext/standard/tests/array/array_diff_variation5.phpt
new file mode 100644
index 000000000..cb6b5d3da
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation5.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test array_diff() function : usage variations - comparing integers, float
+and string array values
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff compares integers, floats and strings
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$arr_int = array(1, 2, 3);
+$arr_float = array(1.00, 2.00, 3.00);
+$arr_int_str = array('1', '2', '3');
+$arr_float_str = array('1.00', '2.00', '3.00');
+
+print "-- Compare integers and floats: --\n";
+var_dump(array_diff($arr_int, $arr_float));
+var_dump(array_diff($arr_float, $arr_int));
+
+
+print "-- Compare integers and strings containing an integers: --\n";
+var_dump(array_diff($arr_int, $arr_int_str));
+var_dump(array_diff($arr_int_str, $arr_int));
+
+print "-- Compare integers and strings containing floats: --\n";
+var_dump(array_diff($arr_int, $arr_float_str));
+var_dump(array_diff($arr_float_str, $arr_int));
+
+print "-- Compare floats and strings containing integers: --\n";
+
+var_dump(array_diff($arr_float, $arr_int_str));
+var_dump(array_diff($arr_int_str, $arr_float));
+
+print "-- Compare floats and strings containing floats: --\n";
+var_dump(array_diff($arr_float, $arr_float_str));
+var_dump(array_diff($arr_float_str, $arr_float));
+
+print "-- Compare strings containing integers and strings containing floats: --\n";
+var_dump(array_diff($arr_int_str, $arr_float_str));
+var_dump(array_diff($arr_float_str, $arr_int_str));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+-- Compare integers and floats: --
+array(0) {
+}
+array(0) {
+}
+-- Compare integers and strings containing an integers: --
+array(0) {
+}
+array(0) {
+}
+-- Compare integers and strings containing floats: --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(3) {
+ [0]=>
+ string(4) "1.00"
+ [1]=>
+ string(4) "2.00"
+ [2]=>
+ string(4) "3.00"
+}
+-- Compare floats and strings containing integers: --
+array(0) {
+}
+array(0) {
+}
+-- Compare floats and strings containing floats: --
+array(3) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(2)
+ [2]=>
+ float(3)
+}
+array(3) {
+ [0]=>
+ string(4) "1.00"
+ [1]=>
+ string(4) "2.00"
+ [2]=>
+ string(4) "3.00"
+}
+-- Compare strings containing integers and strings containing floats: --
+array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+}
+array(3) {
+ [0]=>
+ string(4) "1.00"
+ [1]=>
+ string(4) "2.00"
+ [2]=>
+ string(4) "3.00"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation6.phpt b/ext/standard/tests/array/array_diff_variation6.phpt
new file mode 100644
index 000000000..8ea84bb9d
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation6.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test array_diff() function : usage variations - array containing duplicate keys and values
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test that array_diff behaves as expected for comparing:
+ * 1. the order of the array
+ * 2. duplicate values
+ * 3. duplicate key names
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array_index = array('a', 'b', 'c', 0 => 'd', 'b'); //duplicate key (0), duplicate value (b)
+$array_assoc = array ('2' => 'c', //same key=>value pair, different order
+ '1' => 'b',
+ '0' => 'a',
+ 'b' => '3', //key and value from array_index swapped
+ 'c' => 2); //same as above, using integer
+
+var_dump(array_diff($array_index, $array_assoc));
+var_dump(array_diff($array_assoc, $array_index));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+array(1) {
+ [0]=>
+ string(1) "d"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ ["b"]=>
+ string(1) "3"
+ ["c"]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation7.phpt b/ext/standard/tests/array/array_diff_variation7.phpt
new file mode 100644
index 000000000..c53cbb3d1
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation7.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test array_diff() function : usage variations - arrays containing referenced variables
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are not
+ * present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff compares arrays that
+ * 1. Contain referenced variables
+ * 2. Have been referenced to each other
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+$a = 'a';
+
+$arr1 = array ("&$a", 'b', 'c');
+$arr2 = array (1, 2, 3);
+echo "-- Basic Comparison --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+$a = 1;
+
+echo "-- \$a changed --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+
+$arr2 = &$arr1;
+echo "-- Arrays referenced to each other --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+
+$arr1 = array('x', 'y', 'z');
+echo "-- \$arr1 changed --\n";
+var_dump(array_diff($arr1, $arr2));
+var_dump(array_diff($arr2, $arr1));
+
+
+echo "Done";
+?>
+
+--EXPECTF--
+
+*** Testing array_diff() : usage variations ***
+-- Basic Comparison --
+array(3) {
+ [0]=>
+ string(2) "&a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+-- $a changed --
+array(3) {
+ [0]=>
+ string(2) "&a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+-- Arrays referenced to each other --
+array(0) {
+}
+array(0) {
+}
+-- $arr1 changed --
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_diff_variation8.phpt b/ext/standard/tests/array/array_diff_variation8.phpt
new file mode 100644
index 000000000..99f9614d7
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation8.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test array_diff() function : usage variations - associative arrays contianing different data types
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of $arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_diff() with associative arrays containing different data types as values
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array = array('a' => '1', 'b' => '2', 'c' => '3');
+
+// 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;
+
+// associative arrays with different values
+$inputs = array (
+ // arrays with integer values
+/*1*/ array('0' => 0, '1' => 0),
+ array("one" => 1, 'two' => 2, "three" => 1, 4 => 1),
+
+ // arrays with float values
+/*3*/ array("float1" => 2.3333, "float2" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2),
+
+ // arrays with string values
+/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'),
+ array(1 => "hello", "heredoc" => $heredoc, $heredoc),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp, new classA(), $fp),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_diff($array, $input) );
+ var_dump( array_diff($input, $array) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+-- Iteration 1 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+}
+-- Iteration 2 --
+array(1) {
+ ["c"]=>
+ string(1) "3"
+}
+array(0) {
+}
+-- Iteration 3 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(2) {
+ ["float1"]=>
+ float(2.3333)
+ ["float2"]=>
+ float(2.3333)
+}
+-- Iteration 4 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(4) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [3]=>
+ float(4.8999992284)
+ ["f4"]=>
+ float(1.2)
+}
+-- Iteration 5 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(4) {
+ [111]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(7) " world"
+ [3]=>
+ string(6) " Hello"
+}
+-- Iteration 6 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(4) {
+ [111]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(9) "\v\fworld"
+ [3]=>
+ string(7) "\tHello"
+}
+-- Iteration 7 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(3) {
+ [1]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+ [2]=>
+ string(11) "Hello world"
+}
+-- Iteration 8 --
+array(3) {
+ ["a"]=>
+ string(1) "1"
+ ["b"]=>
+ string(1) "2"
+ ["c"]=>
+ string(1) "3"
+}
+array(5) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [12]=>
+ object(classA)#%d (0) {
+ }
+ [13]=>
+ resource(%d) of type (stream)
+}
+Done
diff --git a/ext/standard/tests/array/array_diff_variation9.phpt b/ext/standard/tests/array/array_diff_variation9.phpt
new file mode 100644
index 000000000..58d9c201b
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_variation9.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Test array_diff() function : usage variations - multidimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
+ * Description: Returns the entries of arr1 that have values which are
+ * not present in any of the others arguments.
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_diff() compares multidimensional arrays
+ */
+
+echo "*** Testing array_diff() : usage variations ***\n";
+
+$array1 = array('sub_array1' => array (1, 2, 3),
+ 'sub_array2' => array ('a', 'b', 'c'));
+$array2 = array('sub_arraya' => array (1, 3, 5),
+ 'sub_arrayb' => array ('a', 'z', 'y'));
+
+echo "-- Compare two 2-D arrays --\n";
+var_dump(array_diff($array1, $array2));
+var_dump(array_diff($array2, $array1));
+
+echo "\n-- Compare subarrays from two 2-D arrays --\n";
+var_dump(array_diff($array1['sub_array1'], $array2['sub_arraya']));
+var_dump(array_diff($array2['sub_arraya'], $array1['sub_array1']));
+
+var_dump(array_diff($array1['sub_array2'], $array2['sub_arrayb']));
+var_dump(array_diff($array2['sub_arrayb'], $array1['sub_array1']));
+
+echo "\n-- Compare a subarray from one 2-D array and one 2-D array --\n";
+var_dump(array_diff($array1['sub_array1'], $array2));
+var_dump(array_diff($array1, $array2['sub_arraya']));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_diff() : usage variations ***
+-- Compare two 2-D arrays --
+array(0) {
+}
+array(0) {
+}
+
+-- Compare subarrays from two 2-D arrays --
+array(1) {
+ [1]=>
+ int(2)
+}
+array(1) {
+ [2]=>
+ int(5)
+}
+array(2) {
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "z"
+ [2]=>
+ string(1) "y"
+}
+
+-- Compare a subarray from one 2-D array and one 2-D array --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ ["sub_array1"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["sub_array2"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_key_basic.phpt b/ext/standard/tests/array/array_intersect_key_basic.phpt
new file mode 100644
index 000000000..fc6e177f5
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_key_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+array_intersect_key(): Basic Test
+--FILE--
+<?php
+/*
+* proto array array_intersect_key(array arr1, array arr2 [, array ...])
+* Function is implemented in ext/standard/array.c
+*/
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_intersect_key($array1, $array2));
+?>
+--EXPECT--
+array(2) {
+ ["blue"]=>
+ int(1)
+ ["green"]=>
+ int(3)
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_uassoc_basic.phpt b/ext/standard/tests/array/array_intersect_uassoc_basic.phpt
new file mode 100644
index 000000000..1a2d57ec3
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_uassoc_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+array_intersect_uassoc(): Basic test
+--FILE--
+<?php
+/*
+* array array_intersect_uassoc ( array $array1, array $array2 [, array $..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($a, $b) {
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $b) ? 1 : -1;
+}
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
+$array2 = array("a" => "green", "yellow", "red");
+$result = array_intersect_uassoc($array1, $array2, "key_compare_func");
+var_dump($result);
+?>
+--EXPECT--
+array(1) {
+ ["a"]=>
+ string(5) "green"
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_ukey_basic.phpt b/ext/standard/tests/array/array_intersect_ukey_basic.phpt
new file mode 100644
index 000000000..db21b9b01
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_ukey_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+array_intersect_ukey(): Basic test.
+--FILE--
+<?php
+/*
+* proto array array_intersect_ukey ( array $array1, array $array2 [, array $ ..., callback $key_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+function key_compare_func($key1, $key2) {
+ if ($key1 == $key2) return 0;
+ else if ($key1 > $key2) return 1;
+ else return -1;
+}
+$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
+$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
+var_dump(array_intersect_ukey($array1, $array2, 'key_compare_func'));
+?>
+--EXPECT--
+array(2) {
+ ["blue"]=>
+ int(1)
+ ["green"]=>
+ int(3)
+}
diff --git a/ext/standard/tests/array/array_key_exists_basic.phpt b/ext/standard/tests/array/array_key_exists_basic.phpt
new file mode 100644
index 000000000..6fbd415dc
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test array_key_exists() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Test basic functionality of array_key_exists()
+ */
+
+echo "*** Testing array_key_exists() : basic functionality ***\n";
+
+$key1 = 'key';
+$key2 = 'val';
+$search = array('one', 'key' => 'value', 'val');
+var_dump(array_key_exists($key1, $search));
+var_dump(array_key_exists($key2, $search));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_key_exists() : basic functionality ***
+bool(true)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_error.phpt b/ext/standard/tests/array/array_key_exists_error.phpt
new file mode 100644
index 000000000..f87d2199e
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test array_key_exists() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass incorrect number of arguments to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : error conditions ***\n";
+
+//Test array_key_exists with one more than the expected number of arguments
+echo "\n-- Testing array_key_exists() function with more than expected no. of arguments --\n";
+$key = 1;
+$search = array(1, 2);
+$extra_arg = 10;
+var_dump( array_key_exists($key, $search, $extra_arg) );
+
+// Testing array_key_exists with one less than the expected number of arguments
+echo "\n-- Testing array_key_exists() function with less than expected no. of arguments --\n";
+$key = 1;
+var_dump( array_key_exists($key) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : error conditions ***
+
+-- Testing array_key_exists() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_key_exists() in %s on line %d
+NULL
+
+-- Testing array_key_exists() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_key_exists() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_object1.phpt b/ext/standard/tests/array/array_key_exists_object1.phpt
new file mode 100644
index 000000000..6c85f5389
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_object1.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test array_key_exists() function : object functionality
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Test basic functionality of array_key_exists() with objects
+ */
+
+echo "*** Testing array_key_exists() : object functionality ***\n";
+
+class myClass {
+ var $var1;
+ var $var2;
+ var $var3;
+
+ function __construct($a, $b, $c = null) {
+ $this->var1 = $a;
+ $this->var2 = $b;
+ if (!is_null($c)) {
+ $this->var3 = $c;
+ }
+ }
+}
+
+echo "\n-- Do not assign a value to \$class1->var3 --\n";
+$class1 = new myClass ('a', 'b');
+echo "\$key = var1:\n";
+var_dump(array_key_exists('var1', $class1));
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class1));
+echo "\$class1:\n";
+var_dump($class1);
+
+echo "\n-- Assign a value to \$class2->var3 --\n";
+$class2 = new myClass('x', 'y', 'z');
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class2));
+echo "\$class2:\n";
+var_dump($class2);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : object functionality ***
+
+-- Do not assign a value to $class1->var3 --
+$key = var1:
+bool(true)
+$key = var3:
+bool(true)
+$class1:
+object(myClass)#%d (3) {
+ ["var1"]=>
+ string(1) "a"
+ ["var2"]=>
+ string(1) "b"
+ ["var3"]=>
+ NULL
+}
+
+-- Assign a value to $class2->var3 --
+$key = var3:
+bool(true)
+$class2:
+object(myClass)#%d (3) {
+ ["var1"]=>
+ string(1) "x"
+ ["var2"]=>
+ string(1) "y"
+ ["var3"]=>
+ string(1) "z"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_object2.phpt b/ext/standard/tests/array/array_key_exists_object2.phpt
new file mode 100644
index 000000000..07c93b2f8
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_object2.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Test array_key_exists() function : object functionality - different visibilities
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass array_key_exists() an object with private and protected properties
+ */
+
+echo "*** Testing array_key_exists() : object functionality ***\n";
+
+class myClass {
+ public $var1;
+ protected $var2;
+ private $var3;
+
+ function __construct($a, $b, $c = null) {
+ $this->var1 = $a;
+ $this->var2 = $b;
+ if (!is_null($c)) {
+ $this->var3 = $c;
+ }
+ }
+}
+
+echo "\n-- Do not assign a value to \$class1->var3 --\n";
+$class1 = new myClass ('a', 'b');
+echo "\$key = var1:\n";
+var_dump(array_key_exists('var1', $class1));
+echo "\$key = var2:\n";
+var_dump(array_key_exists('var2', $class1));
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class1));
+echo "\$class1:\n";
+var_dump($class1);
+
+echo "\n-- Assign a value to \$class2->var3 --\n";
+$class2 = new myClass('x', 'y', 'z');
+echo "\$key = var3:\n";
+var_dump(array_key_exists('var3', $class2));
+echo "\$class2:\n";
+var_dump($class2);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : object functionality ***
+
+-- Do not assign a value to $class1->var3 --
+$key = var1:
+bool(true)
+$key = var2:
+bool(false)
+$key = var3:
+bool(false)
+$class1:
+object(myClass)#%d (3) {
+ ["var1"]=>
+ string(1) "a"
+ ["var2:protected"]=>
+ string(1) "b"
+ ["var3:private"]=>
+ NULL
+}
+
+-- Assign a value to $class2->var3 --
+$key = var3:
+bool(false)
+$class2:
+object(myClass)#%d (3) {
+ ["var1"]=>
+ string(1) "x"
+ ["var2:protected"]=>
+ string(1) "y"
+ ["var3:private"]=>
+ string(1) "z"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation1.phpt b/ext/standard/tests/array/array_key_exists_variation1.phpt
new file mode 100644
index 000000000..2f50d3e86
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation1.phpt
@@ -0,0 +1,203 @@
+--TEST--
+Test array_key_exists() function : usage variations - Pass different data types as $key arg
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass different data types as $key argument to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$search = array ('zero', 'key' => 'val', 'two');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "key";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+key
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $key argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "key",
+ 'key',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_key_exists()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_key_exists($input, $search) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+bool(true)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt
new file mode 100644
index 000000000..0804006f6
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation2.phpt
@@ -0,0 +1,225 @@
+--TEST--
+Test array_key_exists() function : usage variations - Pass differnt data types to $search arg
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass different data types as $search argument to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$key = 'val';
+
+//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 $search argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_key_exists()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_key_exists($key, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation3.phpt b/ext/standard/tests/array/array_key_exists_variation3.phpt
new file mode 100644
index 000000000..e8a52a705
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation3.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test array_key_exists() function : usage variations - floats and casting to ints
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass floats as $key argument, then cast float values
+ * to integers and pass as $key argument
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$keys = array(1.2345678900E-10, 1.00000000000001, 1.99999999999999);
+
+$search = array ('zero', 'one', 'two');
+
+$iterator = 1;
+foreach($keys as $key) {
+ echo "\n-- Iteration $iterator --\n";
+ echo "Pass float as \$key:\n";
+ var_dump(array_key_exists($key, $search));
+ echo "Cast float to int:\n";
+ var_dump(array_key_exists((int)$key, $search));
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1 --
+Pass float as $key:
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Cast float to int:
+bool(true)
+
+-- Iteration 1 --
+Pass float as $key:
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Cast float to int:
+bool(true)
+
+-- Iteration 1 --
+Pass float as $key:
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+Cast float to int:
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation4.phpt b/ext/standard/tests/array/array_key_exists_variation4.phpt
new file mode 100644
index 000000000..edc39269a
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation4.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test array_key_exists() function : usage variations - referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass referenced variables as arguments to array_key_exists() to test behaviour
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$array = array('one' => 1, 'two' => 2, 'three' => 3);
+
+echo "\n-- \$search is a reference to \$array --\n";
+$search = &$array;
+var_dump(array_key_exists('one', $search));
+
+echo "\n-- \$key is a referenced variable --\n";
+$key = 'two';
+var_dump(array_key_exists(&$key, $array));
+
+echo "\n-- Both arguments are referenced variables --\n";
+var_dump(array_key_exists(&$key, &$array));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- $search is a reference to $array --
+bool(true)
+
+-- $key is a referenced variable --
+bool(true)
+
+-- Both arguments are referenced variables --
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_key_exists_variation5.phpt b/ext/standard/tests/array/array_key_exists_variation5.phpt
new file mode 100644
index 000000000..9c15759fc
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation5.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test array_key_exists() function : usage variations - multidimensional arrays
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Test how array_key_exists() behaves with multi-dimensional arrays
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$multi_array = array ('zero' => 'val1',
+ 'one' => 'val2',
+ 'sub1' => array (1, 2, 3));
+
+echo "\n-- Attempt to match key in sub-array --\n";
+// this key is in the sub-array
+var_dump(array_key_exists(0, $multi_array));
+
+echo "\n-- \$search arg points to sub-array --\n";
+var_dump(array_key_exists(0, $multi_array['sub1']));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Attempt to match key in sub-array --
+bool(false)
+
+-- $search arg points to sub-array --
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation6.phpt b/ext/standard/tests/array/array_key_exists_variation6.phpt
new file mode 100644
index 000000000..d19e58e76
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation6.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test array_key_exists() function : usage variations - equality test for certain data types
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass certain data types that can be taken as a key in an array
+ * and test whether array_key_exists(() thinks they are equal and therefore
+ * returns true when searching for them
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$unset = 10;
+unset($unset);
+$array = array ('null' => null,
+ 'NULL' => NULL,
+ 'empty single quoted string' => '',
+ "empty double quoted string" => "",
+ 'undefined variable' => @$undefined,
+ 'unset variable' => @$unset);
+
+//iterate through original array
+foreach($array as $name => $input) {
+ $iterator = 1;
+ echo "\n-- Key in \$search array is : $name --\n";
+ $search[$input] = 'test';
+
+ //iterate through array again to see which values are considered equal
+ foreach($array as $key) {
+ echo "Iteration $iterator: ";
+ var_dump(array_key_exists($key, $search));
+ $iterator++;
+ }
+ $search = null;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Key in $search array is : null --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : NULL --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : empty single quoted string --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : empty double quoted string --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : undefined variable --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+
+-- Key in $search array is : unset variable --
+Iteration 1: bool(true)
+Iteration 2: bool(true)
+Iteration 3: bool(true)
+Iteration 4: bool(true)
+Iteration 5: bool(true)
+Iteration 6: bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation7.phpt b/ext/standard/tests/array/array_key_exists_variation7.phpt
new file mode 100644
index 000000000..845c1e54b
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation7.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_key_exists() function : usage variations - position of internal array pointer
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Check the position of the internal array pointer after calling array_key_exists()
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois');
+
+echo "\n-- Call array_key_exists() --\n";
+var_dump($result = array_key_exists('one', $input));
+
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Call array_key_exists() --
+bool(true)
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_key_exists_variation8.phpt b/ext/standard/tests/array/array_key_exists_variation8.phpt
new file mode 100644
index 000000000..d5bad62e2
--- /dev/null
+++ b/ext/standard/tests/array/array_key_exists_variation8.phpt
@@ -0,0 +1,547 @@
+--TEST--
+Test array_key_exists() function : usage variations - array keys are different data types
+--FILE--
+<?php
+/* Prototype : bool array_key_exists(mixed $key, array $search)
+ * Description: Checks if the given key or index exists in the array
+ * Source code: ext/standard/array.c
+ * Alias to functions: key_exists
+ */
+
+/*
+ * Pass an array where the keys are different data types as the $search argument
+ * then pass many different data types as $key argument to test where array_key_exist()
+ * returns true.
+ */
+
+echo "*** Testing array_key_exists() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+string
+EOT;
+
+// different data types to be iterated over
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*3*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*4*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*5*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*6*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*8*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*9*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_key_exists()
+$iterator = 1;
+foreach($inputs as $type => $input) {
+ echo "\n-- Iteration $iterator: $type data --\n";
+
+ //iterate over again to get all different key values
+ foreach ($inputs as $new_type => $new_input) {
+ echo "-- \$key arguments are $new_type data:\n";
+ foreach ($new_input as $key => $search) {
+ var_dump(array_key_exists($key, $input));
+ }
+ }
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_key_exists() : usage variations ***
+
+-- Iteration 1: int data --
+-- $key arguments are int data:
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(true)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(true)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 2: float data --
+-- $key arguments are int data:
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(true)
+bool(true)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 3: extreme floats data --
+-- $key arguments are int data:
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(true)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 4: null uppercase data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 5: null lowercase data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 6: bool lowercase data --
+-- $key arguments are int data:
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(true)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(true)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 7: bool uppercase data --
+-- $key arguments are int data:
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(true)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(true)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(true)
+bool(true)
+-- $key arguments are bool uppercase data:
+bool(true)
+bool(true)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 8: empty double quotes data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 9: empty single quotes data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 10: string data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(false)
+-- $key arguments are null lowercase data:
+bool(false)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(false)
+-- $key arguments are empty single quotes data:
+bool(false)
+-- $key arguments are string data:
+bool(true)
+bool(true)
+bool(true)
+-- $key arguments are undefined data:
+bool(false)
+-- $key arguments are unset data:
+bool(false)
+
+-- Iteration 11: undefined data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+
+-- Iteration 12: unset data --
+-- $key arguments are int data:
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are float data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are extreme floats data:
+bool(false)
+bool(false)
+-- $key arguments are null uppercase data:
+bool(true)
+-- $key arguments are null lowercase data:
+bool(true)
+-- $key arguments are bool lowercase data:
+bool(false)
+bool(false)
+-- $key arguments are bool uppercase data:
+bool(false)
+bool(false)
+-- $key arguments are empty double quotes data:
+bool(true)
+-- $key arguments are empty single quotes data:
+bool(true)
+-- $key arguments are string data:
+bool(false)
+bool(false)
+bool(false)
+-- $key arguments are undefined data:
+bool(true)
+-- $key arguments are unset data:
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_map.phpt b/ext/standard/tests/array/array_map.phpt
deleted file mode 100644
index 78815e083..000000000
--- a/ext/standard/tests/array/array_map.phpt
+++ /dev/null
@@ -1,423 +0,0 @@
---TEST--
-Test array_map() function
---FILE--
-<?php
-/* Prototype: array array_map ( callback $callback, array $arr1 [, array $...] );
- Description: array_map() returns an array containing all the elements of arr1
- after applying the callback function to each one. The number of
- parameters that the callback function accepts should match the
- number of arrays passed to the array_map()
-*/
-
-echo "*** Testing basic operations ***\n";
-/* array_map with null as function and different arrays */
-var_dump( array_map(NULL, array()) );
-var_dump( array_map(NULL, array(), array()) );
-var_dump( array_map(NULL, array(1,2,3), array(1,2,3)) );
-var_dump( array_map(NULL, array(1,2), array(1,2,3,4)) );
-var_dump( array_map(NULL, array("Jan", "Feb", "March"), array("31","28","31")) );
-var_dump( array_map(NULL, array("Text", "Words", "Lineup"), array(4, 5, 6)) );
-var_dump( array_map(NULL, array("a", "ab", "abc", "abcd"), array()) );
-var_dump( array_map(NULL,
- array("Jan"=>"01", "Feb"=>"02", "March"=>"03"),
- array("31"=>"Jan", "28"=>"Feb", "031"=>"March")
- )
- );
-
-/* using key as "string" where no.of arguments passed to array_map() is 2 */
-var_dump( array_map( create_function('$n', 'return $n*$n;'),
- array("key1"=>1, "key2"=>2, "key3"=>3)
- )
- );
-
-echo "\n*** Testing possible variations ***\n";
-/* anonymous callback function */
-var_dump( array_map( create_function('$a,$b', 'return $a+$b;'),
- array(1,2,3),
- array(5,6,7,8,9)
- )
- );
-
-/* anonymous callback function with reference */
-var_dump( array_map( create_function('&$a, $b', 'return array($a,$b);'),
- array("Hello","Good"),
- array("World","Day")
- )
- );
-
-/* callback function with reference */
-$a = array(1,2,3);
-function square(&$var) {
- return( $var * $var );
-}
-print_r( array_map('square', $a) );
-
-/* array_map in recursion */
-function square_recur($var) {
- if (is_array($var))
- return array_map('square_recur', $var);
- return $var * $var;
-}
-$rec_array = array(1, 2, array(3, 4, array(5, 2), array() ) );
-var_dump( array_map('square_recur', $rec_array) );
-
-/* callback function as string variable containing the function name */
-$string_var = "square";
-var_dump( array_map("square", $a) );
-var_dump( array_map($string_var, $a) );
-
-echo "\n*** Testing error conditions ***\n";
-/* arguments of non array type */
-$int_var=10;
-$float_var = 10.5;
-var_dump( array_map('square', $int_var) );
-var_dump( array_map('square', $float_var) );
-var_dump( array_map('square', $string_var) );
-
-/* Zero argument */
-var_dump( array_map() );
-
-/* use array(), echo(), empty(), eval(), exit(), isset(), list(), print()
- and unset() as callback, failure expected */
-var_dump( array_map( 'echo', array(1) ) );
-var_dump( array_map( 'array', array(1) ) );
-var_dump( array_map( 'empty', array(1) ) );
-var_dump( array_map( 'eval', array(1) ) );
-var_dump( array_map( 'exit', array(1) ) );
-var_dump( array_map( 'isset', array(1) ) );
-var_dump( array_map( 'list', array(1) ) );
-var_dump( array_map( 'print', array(1) ) );
-
-
-echo "\n*** Testing operation on objects ***\n";
-/* array_map with class object */
-class check_array_map {
- public static function helloWorld() {
- return "Static_Function_helloWorld(): Hello World";
- }
- public function Message($v) {
- return $v;
- }
-
- public static function Square( $n ) {
- return $n * $n;
- }
-}
-/* call static member function */
-var_dump( array_map( array('check_array_map', 'Square'), array(1,2,3)) );
-
-/* call non static member function - notice should be issues*/
-var_dump( array_map( array('check_array_map', 'Message'), array(1)) );
-
-/* call function using object */
-$obj = new check_array_map();
-var_dump( array_map( array($obj, 'helloWorld' ) ) ); // not enough args warning
-var_dump( array_map( array($obj, 'helloWorld'), array(1) ) );
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing basic operations ***
-array(0) {
-}
-array(0) {
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(2)
- }
- [2]=>
- array(2) {
- [0]=>
- int(3)
- [1]=>
- int(3)
- }
-}
-array(4) {
- [0]=>
- array(2) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- }
- [1]=>
- array(2) {
- [0]=>
- int(2)
- [1]=>
- int(2)
- }
- [2]=>
- array(2) {
- [0]=>
- NULL
- [1]=>
- int(3)
- }
- [3]=>
- array(2) {
- [0]=>
- NULL
- [1]=>
- int(4)
- }
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- string(3) "Jan"
- [1]=>
- string(2) "31"
- }
- [1]=>
- array(2) {
- [0]=>
- string(3) "Feb"
- [1]=>
- string(2) "28"
- }
- [2]=>
- array(2) {
- [0]=>
- string(5) "March"
- [1]=>
- string(2) "31"
- }
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- string(4) "Text"
- [1]=>
- int(4)
- }
- [1]=>
- array(2) {
- [0]=>
- string(5) "Words"
- [1]=>
- int(5)
- }
- [2]=>
- array(2) {
- [0]=>
- string(6) "Lineup"
- [1]=>
- int(6)
- }
-}
-array(4) {
- [0]=>
- array(2) {
- [0]=>
- string(1) "a"
- [1]=>
- NULL
- }
- [1]=>
- array(2) {
- [0]=>
- string(2) "ab"
- [1]=>
- NULL
- }
- [2]=>
- array(2) {
- [0]=>
- string(3) "abc"
- [1]=>
- NULL
- }
- [3]=>
- array(2) {
- [0]=>
- string(4) "abcd"
- [1]=>
- NULL
- }
-}
-array(3) {
- [0]=>
- array(2) {
- [0]=>
- string(2) "01"
- [1]=>
- string(3) "Jan"
- }
- [1]=>
- array(2) {
- [0]=>
- string(2) "02"
- [1]=>
- string(3) "Feb"
- }
- [2]=>
- array(2) {
- [0]=>
- string(2) "03"
- [1]=>
- string(5) "March"
- }
-}
-array(3) {
- ["key1"]=>
- int(1)
- ["key2"]=>
- int(4)
- ["key3"]=>
- int(9)
-}
-
-*** Testing possible variations ***
-array(5) {
- [0]=>
- int(6)
- [1]=>
- int(8)
- [2]=>
- int(10)
- [3]=>
- int(8)
- [4]=>
- int(9)
-}
-array(2) {
- [0]=>
- array(2) {
- [0]=>
- string(5) "Hello"
- [1]=>
- string(5) "World"
- }
- [1]=>
- array(2) {
- [0]=>
- string(4) "Good"
- [1]=>
- string(3) "Day"
- }
-}
-Array
-(
- [0] => 1
- [1] => 4
- [2] => 9
-)
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(4)
- [2]=>
- array(4) {
- [0]=>
- int(9)
- [1]=>
- int(16)
- [2]=>
- array(2) {
- [0]=>
- int(25)
- [1]=>
- int(4)
- }
- [3]=>
- array(0) {
- }
- }
-}
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(4)
- [2]=>
- int(9)
-}
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(4)
- [2]=>
- int(9)
-}
-
-*** Testing error conditions ***
-
-Warning: array_map(): Argument #2 should be an array in %s on line %d
-NULL
-
-Warning: array_map(): Argument #2 should be an array in %s on line %d
-NULL
-
-Warning: array_map(): Argument #2 should be an array in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_map() %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'echo', should be either NULL or a valid callback in %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'array', should be either NULL or a valid callback in %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'empty', should be either NULL or a valid callback in %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'eval', should be either NULL or a valid callback in %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'exit', should be either NULL or a valid callback in %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'isset', should be either NULL or a valid callback in %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'list', should be either NULL or a valid callback in %s on line %d
-NULL
-
-Warning: array_map(): The first argument, 'print', should be either NULL or a valid callback in %s on line %d
-NULL
-
-*** Testing operation on objects ***
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(4)
- [2]=>
- int(9)
-}
-
-Strict Standards: Non-static method check_array_map::Message() cannot be called statically in %s on line %d
-
-Strict Standards: Non-static method check_array_map::Message() cannot be called statically in %s on line %d
-array(1) {
- [0]=>
- int(1)
-}
-
-Warning: Wrong parameter count for array_map() in %s on line %d
-NULL
-array(1) {
- [0]=>
- string(41) "Static_Function_helloWorld(): Hello World"
-}
-Done
diff --git a/ext/standard/tests/array/array_map_basic.phpt b/ext/standard/tests/array/array_map_basic.phpt
new file mode 100644
index 000000000..53a7bb4e2
--- /dev/null
+++ b/ext/standard/tests/array/array_map_basic.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test array_map() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_map() : basic functionality ***\n";
+
+function multiply($p, $q) {
+ return ($p * $q);
+}
+
+function square($p) {
+ return ($p * $p);
+}
+
+function concatenate($a, $b) {
+ return "$a = $b";
+}
+
+// integer array
+$arr1 = array(1, 2, 3);
+$arr2 = array(4, 5, 6);
+
+echo "-- With two integer array --\n";
+var_dump( array_map('multiply', $arr1, $arr2) );
+
+echo "-- With single integer array --\n";
+var_dump( array_map('square', $arr1) );
+
+// string array
+$arr1 = array("one", "two");
+$arr2 = array("single", "double");
+
+echo "-- With string array --\n";
+var_dump( array_map('concatenate', $arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : basic functionality ***
+-- With two integer array --
+array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(10)
+ [2]=>
+ int(18)
+}
+-- With single integer array --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+ [2]=>
+ int(9)
+}
+-- With string array --
+array(2) {
+ [0]=>
+ string(12) "one = single"
+ [1]=>
+ string(12) "two = double"
+}
+Done
diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt
new file mode 100644
index 000000000..a1c93d0fc
--- /dev/null
+++ b/ext/standard/tests/array/array_map_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test array_map() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_map() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_map() function with Zero arguments --\n";
+var_dump( array_map() );
+
+// Testing array_map with one less than the expected number of arguments
+echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n";
+function callback1() {
+ return 1;
+}
+var_dump( array_map('callback1') );
+
+echo "\n-- Testing array_map() function with less no. of arrays than callback function arguments --\n";
+$arr1 = array(1, 2);
+function callback2($p, $q) {
+ return $p * $q;
+}
+var_dump( array_map('callback2', $arr1) );
+
+echo "\n-- Testing array_map() function with more no. of arrays than callback function arguments --\n";
+$arr2 = array(3, 4);
+$arr3 = array(5, 6);
+var_dump( array_map('callback2', $arr1, $arr2, $arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : error conditions ***
+
+-- Testing array_map() function with Zero arguments --
+
+Warning: Wrong parameter count for array_map() in %s on line %d
+NULL
+
+-- Testing array_map() function with one less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_map() in %s on line %d
+NULL
+
+-- Testing array_map() function with less no. of arrays than callback function arguments --
+
+Warning: Missing argument 2 for callback2() in %s on line %d
+
+Notice: Undefined variable: q in %s on line %d
+
+Warning: Missing argument 2 for callback2() in %s on line %d
+
+Notice: Undefined variable: q in %s on line %d
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+}
+
+-- Testing array_map() function with more no. of arrays than callback function arguments --
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(8)
+}
+Done
diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt
new file mode 100644
index 000000000..1265e3a74
--- /dev/null
+++ b/ext/standard/tests/array/array_map_object1.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Test array_map() function : usage variations - object functionality
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Testing array_map() for object functionalities:
+ * 1) simple class with variable and method
+ * 2) class without members
+ * 3) class with only one method and no variable
+ * 4) abstract and child class
+ * 5) class with static and final members
+ * 6) interface and implemented class
+ */
+echo "*** Testing array_map() : object functionality ***\n";
+
+echo "-- simple class with public variable and method --\n";
+class SimpleClass
+{
+ public $var1 = 1;
+ public function square($n) {
+ return $n * $n;
+ }
+}
+var_dump( array_map(array('SimpleClass', 'square'), array(1, 2)) );
+
+echo "\n-- simple class with private variable and method --\n";
+class SimpleClassPri
+{
+ private $var1 = 10;
+ private function add($n) {
+ return $var + $n;
+ }
+}
+var_dump( array_map(array('SimpleClassPri', 'add'), array(1)) );
+
+echo "\n-- simple class with protected variable and method --\n";
+class SimpleClassPro
+{
+ protected $var1 = 5;
+ protected function mul($n) {
+ return $var1 * $n;
+ }
+}
+var_dump( array_map(array('SimpleClassPro', 'mul'), array(2)) );
+
+echo "\n-- class without members --";
+class EmptyClass
+{
+}
+var_dump( array_map(array('EmptyClass'), array(1, 2)) );
+
+echo "\n-- 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";
+ }
+}
+var_dump( array_map(array('ChildClass', 'emptyFunction'), array(1, 2)) );
+
+echo "\n-- class with final method --";
+class FinalClass
+{
+ private $var4;
+ final function finalMethod() {
+ echo "This function can't be overloaded";
+ }
+}
+var_dump( array_map(array('FinalClass', 'finalMethod'), array(1, 2)) );
+
+echo "\n-- class with static members --\n";
+class StaticClass
+{
+ static $var5 = 2;
+ public static function square($n) {
+ return ($n * $n);
+ }
+ private static function cube($n) {
+ return ($n * $n * $n);
+ }
+ protected static function retVal($n) {
+ return array($n);
+ }
+}
+var_dump( array_map(array('StaticClass', 'square'), array(1, 2)) );
+var_dump( array_map(array('StaticClass', 'cube'), array(2)) );
+var_dump( array_map(array('StaticClass', 'retVal'), array(3, 4)) );
+
+echo "-- class implementing an interface --\n";
+interface myInterface
+{
+ public function toImplement();
+}
+class InterClass implements myInterface
+{
+ public static function square($n) {
+ return ($n * $n);
+ }
+ public function toImplement() {
+ return 1;
+ }
+}
+var_dump( array_map(array('InterClass', 'square'), array(1, 2)));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : object functionality ***
+-- simple class with public variable and method --
+
+Strict Standards: Non-static method SimpleClass::square() cannot be called statically in %s on line %d
+
+Strict Standards: Non-static method SimpleClass::square() cannot be called statically in %s on line %d
+
+Strict Standards: Non-static method SimpleClass::square() cannot be called statically in %s on line %d
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+}
+
+-- simple class with private variable and method --
+
+Strict Standards: Non-static method SimpleClassPri::add() cannot be called statically in %s on line %d
+
+Warning: array_map(): The first argument, 'SimpleClassPri::add', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- simple class with protected variable and method --
+
+Strict Standards: Non-static method SimpleClassPro::mul() cannot be called statically in %s on line %d
+
+Warning: array_map(): The first argument, 'SimpleClassPro::mul', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- class without members --
+Warning: array_map(): The first argument, 'Array', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- abstract class --
+Strict Standards: Non-static method ChildClass::emptyFunction() cannot be called statically in %s on line %d
+
+Strict Standards: Non-static method ChildClass::emptyFunction() cannot be called statically in %s on line %d
+defined in child
+Strict Standards: Non-static method ChildClass::emptyFunction() cannot be called statically in %s on line %d
+defined in childarray(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+-- class with final method --
+Strict Standards: Non-static method FinalClass::finalMethod() cannot be called statically in %s on line %d
+
+Strict Standards: Non-static method FinalClass::finalMethod() cannot be called statically in %s on line %d
+This function can't be overloaded
+Strict Standards: Non-static method FinalClass::finalMethod() cannot be called statically in %s on line %d
+This function can't be overloadedarray(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+-- class with static members --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+}
+
+Warning: array_map(): The first argument, 'StaticClass::cube', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'StaticClass::retVal', should be either NULL or a valid callback in %s on line %d
+NULL
+-- class implementing an interface --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+}
+Done
diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt
new file mode 100644
index 000000000..91f713018
--- /dev/null
+++ b/ext/standard/tests/array/array_map_object2.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test array_map() function : object functionality - with non-existent class and method
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Testing array_map() for following object functionalities:
+ * 1) non-existent class
+ * 2) existent class and non-existent function
+ */
+echo "*** Testing array_map() : with non-existent class and method ***\n";
+
+class SimpleClass
+{
+ public $var1 = 1;
+ public function square($n) {
+ return $n * $n;
+ }
+ public static function cube($n) {
+ return $n * $n * $n;
+ }
+}
+
+echo "-- with non-existent class --\n";
+var_dump( array_map(array('non-existent', 'square'), array(1, 2)) );
+
+echo "-- with existent class and non-existent method --\n";
+var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : with non-existent class and method ***
+-- with non-existent class --
+
+Warning: array_map(): The first argument, 'non-existent::square', should be either NULL or a valid callback in %s on line %d
+NULL
+-- with existent class and non-existent method --
+
+Warning: array_map(): The first argument, 'SimpleClass::non-existent', should be either NULL or a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt
new file mode 100644
index 000000000..56296a0b8
--- /dev/null
+++ b/ext/standard/tests/array/array_map_object3.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test array_map() function : object functionality - class methods as callback function
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Testing array_map() for object functionality with following callback function variations:
+ * 1) child class method using parent object
+ * 2) parent class method using child object
+ * 3) child class method using parent class
+ * 4) parent class method using child class
+ */
+echo "*** Testing array_map() : class methods as callback function ***\n";
+
+$arr1 = array(1, 5, 7);
+
+class ParentClass
+{
+ public $var1 = 10;
+ public static function staticParent1($n) {
+ return $n;
+ }
+ private static function staticParent2($n) {
+ return $n;
+ }
+}
+class ChildClass extends ParentClass
+{
+ var $parent_obj;
+ public function __construct ( ) {
+ $this->parent_obj = new ParentClass();
+ }
+ public $var2 = 5;
+ public static function staticChild($n) {
+ return $n;
+ }
+ public function nonstaticChild($n) {
+ return $n;
+ }
+}
+
+$childobj = new ChildClass();
+$parentobj = new ParentClass();
+
+echo "-- accessing parent method from child class --\n";
+var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) );
+
+echo "-- accessing child method from parent class --\n";
+var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) );
+
+echo "-- accessing parent method using child class object --\n";
+var_dump( array_map(array($childobj, 'staticParent1'), $arr1) );
+
+echo "-- accessing child method using parent class object --\n";
+var_dump( array_map(array($parentobj, 'staticChild'), $arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : class methods as callback function ***
+-- accessing parent method from child class --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(7)
+}
+-- accessing child method from parent class --
+
+Warning: array_map(): The first argument, 'ParentClass::staticChild', should be either NULL or a valid callback in %s on line %d
+NULL
+-- accessing parent method using child class object --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(7)
+}
+-- accessing child method using parent class object --
+
+Warning: array_map(): The first argument, 'ParentClass::staticChild', should be either NULL or a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation1.phpt b/ext/standard/tests/array/array_map_variation1.phpt
new file mode 100644
index 000000000..cd09be7ba
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation1.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test array_map() function : usage variations - string keys
+--FILE--
+<?php
+
+/* Prototype : array array_map(mixed callback, array input1 [, array input2 ,...])
+ * Description: Applies the callback to the elements in given arrays.
+ * Source code: ext/standard/array.c
+*/
+
+
+
+echo "*** Testing array_map() : string keys ***\n";
+
+$arr = array("stringkey" => "value");
+function cb1 ($a) {return array ($a);};
+function cb2 ($a,$b) {return array ($a,$b);};
+var_dump( array_map("cb1", $arr));
+var_dump( array_map("cb2", $arr,$arr));
+var_dump( array_map(null, $arr));
+var_dump( array_map(null, $arr, $arr));
+echo "Done";
+?>
+
+--EXPECT--
+*** Testing array_map() : string keys ***
+array(1) {
+ ["stringkey"]=>
+ array(1) {
+ [0]=>
+ string(5) "value"
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ }
+}
+array(1) {
+ ["stringkey"]=>
+ string(5) "value"
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt
new file mode 100644
index 000000000..cc7543699
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation10.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Test array_map() function : usage variations - anonymous callback function
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing anoymous callback function with following variations
+ */
+
+echo "*** Testing array_map() : anonymous callback function ***\n";
+
+$array1 = array(1, 2, 3);
+$array2 = array(3, 4, 5);
+
+echo "-- anonymous function with all parameters and body --\n";
+var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1, $array2));
+
+echo "-- anonymous function with two parameters and passing one array --\n";
+var_dump( array_map( create_function('$a, $b', 'return array($a, $b);'), $array1));
+
+echo "-- anonymous function with NULL parameter --\n";
+var_dump( array_map( create_function(NULL, 'return NULL;'), $array1));
+
+echo "-- anonymous function with NULL body --\n";
+var_dump( array_map( create_function('$a', NULL), $array1));
+
+echo "-- passing NULL as 'arr1' --\n";
+var_dump( array_map( create_function('$a', 'return array($a);'), NULL));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : anonymous callback function ***
+-- anonymous function with all parameters and body --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(4)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(5)
+ }
+}
+-- anonymous function with two parameters and passing one array --
+
+Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d
+
+Notice: Undefined variable: b in %s(20) : runtime-created function on line %d
+
+Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d
+
+Notice: Undefined variable: b in %s(20) : runtime-created function on line %d
+
+Warning: Missing argument 2 for __lambda_func() in %s(20) : runtime-created function on line %d
+
+Notice: Undefined variable: b in %s(20) : runtime-created function on line %d
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ NULL
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ NULL
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ NULL
+ }
+}
+-- anonymous function with NULL parameter --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- anonymous function with NULL body --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- passing NULL as 'arr1' --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation11.phpt b/ext/standard/tests/array/array_map_variation11.phpt
new file mode 100644
index 000000000..9cad3668d
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation11.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test array_map() function : usage variations - with recursive callback
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing subarrays and recursive callback function
+ */
+
+echo "*** Testing array_map() : recursive callback function ***\n";
+
+// callback function
+function square_recur_single_array($var) {
+ if (is_array($var))
+ return array_map('square_recur_single_array', $var);
+ return $var * $var;
+}
+
+$array1 = array(1, array(2, 3, array(5)), array(4));
+
+var_dump( array_map('square_recur_single_array', $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : recursive callback function ***
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(9)
+ [2]=>
+ array(1) {
+ [0]=>
+ int(25)
+ }
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(16)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt
new file mode 100644
index 000000000..e599ed5a5
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation12.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test array_map() function : usage variations - built-in function as callback
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing buit-in function as callback function
+ */
+
+echo "*** Testing array_map() : built-in function ***\n";
+
+$array1 = array(1, 2, 3);
+$array2 = array(3, 4, 5);
+
+echo "-- with built-in function 'pow' and two parameters --\n";
+var_dump( array_map('pow', $array1, $array2));
+
+echo "-- with built-in function 'pow' and one parameter --\n";
+var_dump( array_map('pow', $array1));
+
+echo "-- with language construct --\n";
+var_dump( array_map('echo', $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : built-in function ***
+-- with built-in function 'pow' and two parameters --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(16)
+ [2]=>
+ int(243)
+}
+-- with built-in function 'pow' and one parameter --
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- with language construct --
+
+Warning: array_map(): The first argument, 'echo', should be either NULL or a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation13.phpt b/ext/standard/tests/array/array_map_variation13.phpt
new file mode 100644
index 000000000..94babdf96
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation13.phpt
@@ -0,0 +1,107 @@
+--TEST--
+Test array_map() function : usage variations - callback function with different return types
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing different callback function returning:
+ * int, string, bool, null values
+ */
+
+echo "*** Testing array_map() : callback with diff return value ***\n";
+
+$array1 = array(1, 2, 3);
+$array2 = array(3, 4, 5);
+
+echo "-- with integer return value --\n";
+function callback_int($a, $b)
+{
+ return $a + $b;
+}
+var_dump( array_map('callback_int', $array1, $array2));
+
+echo "-- with string return value --\n";
+function callback_string($a, $b)
+{
+ return "$a"."$b";
+}
+var_dump( array_map('callback_string', $array1, $array2));
+
+echo "-- with bool return value --\n";
+function callback_bool($a, $b)
+{
+ return TRUE;
+}
+var_dump( array_map('callback_bool', $array1, $array2));
+
+echo "-- with null return value --\n";
+function callback_null($array1)
+{
+ return NULL;
+}
+var_dump( array_map('callback_null', $array1));
+
+echo "-- with no return value --\n";
+function callback_without_ret($arr1)
+{
+ echo "callback_without_ret called\n";
+}
+var_dump( array_map('callback_without_ret', $array1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : callback with diff return value ***
+-- with integer return value --
+array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(6)
+ [2]=>
+ int(8)
+}
+-- with string return value --
+array(3) {
+ [0]=>
+ string(2) "13"
+ [1]=>
+ string(2) "24"
+ [2]=>
+ string(2) "35"
+}
+-- with bool return value --
+array(3) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(true)
+}
+-- with null return value --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+-- with no return value --
+callback_without_ret called
+callback_without_ret called
+callback_without_ret called
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt
new file mode 100644
index 000000000..baa1f7753
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation14.phpt
@@ -0,0 +1,125 @@
+--TEST--
+Test array_map() function : usage variations - null value for 'callback' argument
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing null values for $callback argument and testing whether shortest
+ * array will be extended with empty elements
+ */
+
+echo "*** Testing array_map() : null value for 'callback' argument ***\n";
+
+// arrays to be passed as arguments
+$arr1 = array(1, 2);
+$arr2 = array("one", "two");
+$arr3 = array(1.1, 2.2);
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+/* calling array_map() with null callback */
+
+echo "-- with null --\n";
+var_dump( array_map(null, $arr1, $arr2, $arr3) );
+var_dump( array_map(NULL, $arr1, $arr2, $arr3) );
+
+echo "-- with unset variable --\n";
+var_dump( array_map(@$unset_var, $arr1, $arr2, $arr3) );
+
+echo "-- with undefined variable --\n";
+var_dump( array_map(@$undefined_var, $arr1) );
+
+echo "-- with empty string --\n";
+var_dump( array_map("", $arr1, $arr2) );
+
+echo "-- with empty array --\n";
+var_dump( array_map(array(), $arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : null value for 'callback' argument ***
+-- with null --
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ float(1.1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(3) "two"
+ [2]=>
+ float(2.2)
+ }
+}
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ float(1.1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(3) "two"
+ [2]=>
+ float(2.2)
+ }
+}
+-- with unset variable --
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ float(1.1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(3) "two"
+ [2]=>
+ float(2.2)
+ }
+}
+-- with undefined variable --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- with empty string --
+
+Warning: array_map(): The first argument, '', should be either NULL or a valid callback in %s line %d
+NULL
+-- with empty array --
+
+Warning: array_map(): The first argument, 'Array', should be either NULL or a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt
new file mode 100644
index 000000000..9844d4c8c
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation15.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test array_map() function : usage variations - non existent 'callback' function
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing non existent function for $callback argument
+ */
+
+echo "*** Testing array_map() : non existent 'callback' function ***\n";
+
+// arrays to be passed as arguments
+$arr1 = array(1, 2);
+$arr2 = array("one", "two");
+$arr3 = array(1.1, 2.2);
+
+var_dump( array_map('non_existent', $arr1, $arr2, $arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : non existent 'callback' function ***
+
+Warning: array_map(): The first argument, 'non_existent', should be either NULL or a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt
new file mode 100644
index 000000000..e6972972d
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation16.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test array_map() function : usage variations - failing built-in functions & language constructs
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing non-permmited built-in functions and language constructs i.e.
+ * echo(), array(), empty(), eval(), exit(), isset(), list(), print()
+ */
+
+echo "*** Testing array_map() : non-permmited built-in functions ***\n";
+
+// array to be passed as arguments
+$arr1 = array(1, 2);
+
+// built-in functions & language constructs
+$callback_names = array(
+/*1*/ 'echo',
+ 'array',
+ 'empty',
+/*4*/ 'eval',
+ 'exit',
+ 'isset',
+ 'list',
+/*8*/ 'print'
+);
+for($count = 0; $count < count($callback_names); $count++)
+{
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_map($callback_names[$count], $arr1) );
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : non-permmited built-in functions ***
+-- Iteration 1 --
+
+Warning: array_map(): The first argument, 'echo', should be either NULL or a valid callback in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_map(): The first argument, 'array', should be either NULL or a valid callback in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_map(): The first argument, 'empty', should be either NULL or a valid callback in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_map(): The first argument, 'eval', should be either NULL or a valid callback in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_map(): The first argument, 'exit', should be either NULL or a valid callback in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_map(): The first argument, 'isset', should be either NULL or a valid callback in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_map(): The first argument, 'list', should be either NULL or a valid callback in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_map(): The first argument, 'print', should be either NULL or a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt
new file mode 100644
index 000000000..4c96af230
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation17.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test array_map() function : usage variations - unexpected values for 'callback' argument
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing different scalar/nonscalar values in place of $callback
+ */
+
+echo "*** Testing array_map() : unexpected values for 'callback' argument ***\n";
+
+$arr1 = array(1, 2, 3);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $input argument
+$unexpected_callbacks = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // boolean data
+/*10*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*14*/ "",
+ '',
+
+ // array data
+/*16*/ array(),
+ array(1, 2),
+ array(1, array(2)),
+
+ // object data
+/*19*/ new classA(),
+
+ // resource variable
+/*20*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_map
+for($count = 0; $count < count($unexpected_callbacks); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --";
+ var_dump( array_map($unexpected_callbacks[$count], $arr1));
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : unexpected values for 'callback' argument ***
+
+-- Iteration 1 --
+Warning: array_map(): The first argument, '0', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_map(): The first argument, '1', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_map(): The first argument, '12345', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_map(): The first argument, '-2345', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_map(): The first argument, '10.5', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_map(): The first argument, '-10.5', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_map(): The first argument, '123456789000', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_map(): The first argument, '1.23456789E-9', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_map(): The first argument, '0.5', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_map(): The first argument, '1', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_map(): The first argument, '', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_map(): The first argument, '1', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_map(): The first argument, '', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_map(): The first argument, '', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_map(): The first argument, '', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_map(): The first argument, 'Array', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_map(): The first argument, 'Array', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_map(): The first argument, 'Array', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_map(): The first argument, 'Class A object', should be either NULL or a valid callback in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_map(): The first argument, 'Resource id #%d', should be either NULL or a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation18.phpt b/ext/standard/tests/array/array_map_variation18.phpt
new file mode 100644
index 000000000..8170fb846
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation18.phpt
@@ -0,0 +1,205 @@
+--TEST--
+Test array_map() function : usage variations - unexpected values for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing non array values in place of $arr1
+ */
+
+echo "*** Testing array_map() : unexpected values for 'arr1' ***\n";
+
+function callback($a)
+{
+ return $a;
+}
+
+//get an unset array variable
+$unset_var1 = array(1, 2);
+unset ($unset_var1);
+
+// get an unset variable
+$unset_var2 = 10;
+unset ($unset_var2);
+
+// 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");
+
+// different scalar/non-scalar values for array input
+$unexpected_inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var1,
+ @$unset_var2,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $unexpected_inputs to check the behavior of array_map
+for($count = 0; $count < count($unexpected_inputs); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_map('callback', $unexpected_inputs[$count]));
+};
+
+fclose($fp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : unexpected values for 'arr1' ***
+-- Iteration 1 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 24 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+-- Iteration 25 --
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_map_variation2.phpt b/ext/standard/tests/array/array_map_variation2.phpt
new file mode 100644
index 000000000..6cd0096b6
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation2.phpt
@@ -0,0 +1,276 @@
+--TEST--
+Test array_map() function : usage variations - references
+--FILE--
+<?php
+
+/* Prototype : array array_map(mixed callback, array input1 [, array input2 ,...])
+ * Description: Applies the callback to the elements in given arrays.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_map() : references ***\n";
+$arr = array("k1" => "v1","k2"=>"v2");
+$arr[]=&$arr["k1"];
+$arr[]=&$arr;
+function cb1 ($a) {var_dump ($a);return array ($a);};
+function cb2 (&$a) {var_dump ($a);return array (&$a);};
+var_dump( array_map("cb1", $arr));
+var_dump( array_map("cb2", $arr,$arr));
+var_dump( array_map(null, $arr));
+var_dump( array_map(null, $arr, $arr));
+
+// Break cycles
+$arr[0] = null;
+$arr[1] = null;
+
+echo "Done";
+?>
+
+--EXPECT--
+*** Testing array_map() : references ***
+string(2) "v1"
+string(2) "v2"
+string(2) "v1"
+array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *RECURSION*
+ }
+ }
+}
+array(4) {
+ ["k1"]=>
+ array(1) {
+ [0]=>
+ string(2) "v1"
+ }
+ ["k2"]=>
+ array(1) {
+ [0]=>
+ string(2) "v2"
+ }
+ [0]=>
+ array(1) {
+ [0]=>
+ string(2) "v1"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *RECURSION*
+ }
+ }
+ }
+ }
+}
+string(2) "v1"
+string(2) "v2"
+string(2) "v1"
+array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *RECURSION*
+ }
+ }
+}
+array(4) {
+ [0]=>
+ array(1) {
+ [0]=>
+ &string(2) "v1"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(2) "v2"
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ &string(2) "v1"
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *RECURSION*
+ }
+ }
+ }
+}
+array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *RECURSION*
+ }
+ }
+}
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &string(2) "v1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(2) "v2"
+ [1]=>
+ string(2) "v2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &string(2) "v1"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *RECURSION*
+ }
+ }
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ &array(4) {
+ ["k1"]=>
+ &string(2) "v1"
+ ["k2"]=>
+ string(2) "v2"
+ [0]=>
+ &string(2) "v1"
+ [1]=>
+ *RECURSION*
+ }
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation3.phpt b/ext/standard/tests/array/array_map_variation3.phpt
new file mode 100644
index 000000000..a0715504e
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation3.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_map() function : usage variations - different arrays for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing different arrays for $arr1 argument
+ */
+
+echo "*** Testing array_map() : different arrays for 'arr1' argument ***\n";
+
+function callback($a)
+{
+ return ($a);
+}
+
+// different arrays
+$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_map()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_map('callback', $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : different arrays for 'arr1' argument ***
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(0) {
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 7 --
+array(6) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(4) "aaaa"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(4) "bbbb"
+ [4]=>
+ string(1) "c"
+ [5]=>
+ string(5) "ccccc"
+}
+-- Iteration 8 --
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+}
+-- Iteration 9 --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+-- Iteration 10 --
+array(4) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(20)
+ [4]=>
+ int(40)
+ [3]=>
+ int(30)
+}
+-- Iteration 11 --
+array(3) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+}
+-- Iteration 12 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 13 --
+array(3) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- Iteration 14 --
+array(4) {
+ [1]=>
+ string(4) "true"
+ [0]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- Iteration 15 --
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- Iteration 16 --
+array(6) {
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ [5]=>
+ bool(false)
+ [6]=>
+ bool(true)
+}
+-- Iteration 17 --
+array(3) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+}
+-- Iteration 18 --
+array(3) {
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt
new file mode 100644
index 000000000..2517d034e
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation4.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test array_map() function : usage variations - associative array with different keys
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing associative array with different keys for $arr1 argument
+ */
+
+echo "*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***\n";
+
+function callback($a)
+{
+ return ($a);
+}
+
+// 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
+/*2*/ 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_map()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_map('callback', $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : associative array with diff. keys for '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
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ string(1) "1"
+}
+-- Iteration 4 --
+array(4) {
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(1) "3"
+ [4]=>
+ string(1) "4"
+}
+-- Iteration 5 --
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+-- Iteration 6 --
+array(4) {
+ [1]=>
+ string(2) "f1"
+ [3]=>
+ string(2) "f2"
+ [4]=>
+ string(2) "f3"
+ [33333333]=>
+ string(2) "f4"
+}
+-- Iteration 7 --
+array(4) {
+ ["\tHello"]=>
+ int(111)
+ ["re\td"]=>
+ string(5) "color"
+ ["\v\fworld"]=>
+ float(2.2)
+ ["pen\n"]=>
+ int(33)
+}
+-- Iteration 8 --
+array(4) {
+ [" Hello"]=>
+ int(111)
+ ["re d"]=>
+ string(5) "color"
+ [" world"]=>
+ float(2.2)
+ ["pen
+"]=>
+ int(33)
+}
+-- Iteration 9 --
+array(2) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(6) "string"
+}
+-- Iteration 10 --
+array(1) {
+ [""]=>
+ string(5) "hello"
+}
+-- Iteration 11 --
+array(6) {
+ ["hello"]=>
+ int(1)
+ ["fruit"]=>
+ float(2.2)
+ [133]=>
+ string(3) "int"
+ [444]=>
+ string(5) "float"
+ [""]=>
+ string(5) "unset"
+ ["Hello world"]=>
+ string(7) "heredoc"
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation5.phpt b/ext/standard/tests/array/array_map_variation5.phpt
new file mode 100644
index 000000000..55f156921
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation5.phpt
@@ -0,0 +1,181 @@
+--TEST--
+Test array_map() function : usage variations - associative array with different values
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing associative array with different values for $arr1 argument
+ */
+
+echo "*** Testing array_map() : associative array with diff. values for 'arr1' argument ***\n";
+
+function callback($a)
+{
+ return ($a);
+}
+//get an unset variable
+$unset_var = array(1, 2);
+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.3333),
+
+ // 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_map()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_map('callback', $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : associative array with diff. values for 'arr1' argument ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ int(1)
+}
+-- Iteration 4 --
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [4]=>
+ int(4)
+}
+-- Iteration 5 --
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+-- Iteration 6 --
+array(4) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [3]=>
+ float(4.8999992284)
+ ["f4"]=>
+ float(33333333.3333)
+}
+-- Iteration 7 --
+array(4) {
+ [111]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(7) " world"
+ [3]=>
+ string(4) "pen
+"
+}
+-- Iteration 8 --
+array(4) {
+ [111]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(9) "\v\fworld"
+ [3]=>
+ string(5) "pen\n"
+}
+-- Iteration 9 --
+array(2) {
+ [1]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iteration 10 --
+array(3) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+-- Iteration 11 --
+array(8) {
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [222]=>
+ 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_map_variation6.phpt b/ext/standard/tests/array/array_map_variation6.phpt
new file mode 100644
index 000000000..2409a5763
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation6.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test array_map() function : usage variations - array having subarrays
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having different subarrays
+ */
+
+echo "*** Testing array_map() : array having subarrays ***\n";
+
+function callback($a)
+{
+ return $a;
+}
+
+// different subarrays
+$arr1 = array(
+ array(),
+ array(1, 2),
+ array('a', 'b'),
+ array(1, 2, 'a', 'b'),
+ array(1 => 'a', 'b' => 2)
+);
+
+var_dump( array_map('callback', $arr1));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : array having subarrays ***
+array(5) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ [3]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(1) "a"
+ [3]=>
+ string(1) "b"
+ }
+ [4]=>
+ array(2) {
+ [1]=>
+ string(1) "a"
+ ["b"]=>
+ int(2)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation7.phpt b/ext/standard/tests/array/array_map_variation7.phpt
new file mode 100644
index 000000000..8f88a0f88
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation7.phpt
@@ -0,0 +1,122 @@
+--TEST--
+Test array_map() function : usage variations - arrays of different size
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having different size
+ * 1) first array as empty array
+ * 2) second array as empty array
+ * 3) second array shorter than first array
+ * 4) first array shorter than second array
+ * 5) one more array than callback function arguments
+ */
+
+echo "*** Testing array_map() : arrays with diff. size ***\n";
+
+function callback($a, $b)
+{
+ return array($a => $b);
+}
+
+// calling array_map with different arrays
+var_dump( array_map('callback', array(1, 2, 3), array()) );
+var_dump( array_map('callback', array(), array('a', 'b', 'c')) );
+var_dump( array_map('callback', array(1, 2, 3), array('a', 'b')) );
+var_dump( array_map('callback', array(012, 0x2F, 0X1A), array(2.3, 12.4e2)) );
+var_dump( array_map('callback', array(), array(1, 2, 3), array('a', 'b')) ); // passing more no. of arrays than callback function argument
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : arrays with diff. size ***
+array(3) {
+ [0]=>
+ array(1) {
+ [1]=>
+ NULL
+ }
+ [1]=>
+ array(1) {
+ [2]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [3]=>
+ NULL
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [""]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(1) {
+ [""]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(1) {
+ [""]=>
+ string(1) "c"
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [1]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(1) {
+ [2]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(1) {
+ [3]=>
+ NULL
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [10]=>
+ float(2.3)
+ }
+ [1]=>
+ array(1) {
+ [47]=>
+ float(1240)
+ }
+ [2]=>
+ array(1) {
+ [26]=>
+ NULL
+ }
+}
+array(3) {
+ [0]=>
+ array(1) {
+ [""]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [""]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [""]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation8.phpt b/ext/standard/tests/array/array_map_variation8.phpt
new file mode 100644
index 000000000..5672e6cd9
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation8.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test array_map() function : usage variations - array with references
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having reference values for $arr1 argument
+ */
+
+echo "*** Testing array_map() : array with references for 'arr1' argument ***\n";
+
+function callback1($a)
+{
+ return ($a);
+}
+
+function callback_cat($a, $b)
+{
+ return ($a . $b);
+}
+
+// reference variables
+$value1 = 10;
+$value2 = "hello";
+$value3 = 0;
+$value4 = &$value2;
+
+// array containing reference variables
+$arr1 = array(
+ 0 => 0,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => "hello",
+ 4 => &$value3,
+ $value4 => &$value2
+);
+echo "-- with one array --\n";
+var_dump( array_map('callback1', $arr1) );
+
+echo "-- with two arrays --\n";
+var_dump( array_map('callback_cat', $arr1, $arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : array with references for 'arr1' argument ***
+-- with one array --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ int(0)
+ ["hello"]=>
+ string(5) "hello"
+}
+-- with two arrays --
+array(6) {
+ [0]=>
+ string(2) "00"
+ [1]=>
+ string(10) "hellohello"
+ [2]=>
+ string(10) "hellohello"
+ [3]=>
+ string(10) "hellohello"
+ [4]=>
+ string(2) "00"
+ [5]=>
+ string(10) "hellohello"
+}
+Done
diff --git a/ext/standard/tests/array/array_map_variation9.phpt b/ext/standard/tests/array/array_map_variation9.phpt
new file mode 100644
index 000000000..b4f69739d
--- /dev/null
+++ b/ext/standard/tests/array/array_map_variation9.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test array_map() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
+ * Description: Applies the callback to the elements of the given arrays
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_map() by passing array having binary values for $arr1 argument
+ */
+
+echo "*** Testing array_map() : array with binary data for 'arr1' argument ***\n";
+
+function callback1($a)
+{
+ return ($a);
+}
+function callback2($a, $b)
+{
+ return array($a => $b);
+}
+
+// array with binary data
+$arr1 = array(b"hello", b"world", "1", b"22.22");
+
+echo "-- checking binary safe array with one parameter callback function --\n";
+var_dump( array_map('callback1', $arr1) );
+
+echo "-- checking binary safe array with two parameter callback function --\n";
+var_dump( array_map(b"callback2", $arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_map() : array with binary data for 'arr1' argument ***
+-- checking binary safe array with one parameter callback function --
+array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "22.22"
+}
+-- checking binary safe array with two parameter callback function --
+
+Warning: Missing argument 2 for callback2() in %s on line %d
+
+Notice: Undefined variable: b in %s on line %d
+
+Warning: Missing argument 2 for callback2() in %s on line %d
+
+Notice: Undefined variable: b in %s on line %d
+
+Warning: Missing argument 2 for callback2() in %s on line %d
+
+Notice: Undefined variable: b in %s on line %d
+
+Warning: Missing argument 2 for callback2() in %s on line %d
+
+Notice: Undefined variable: b in %s on line %d
+array(4) {
+ [0]=>
+ array(1) {
+ ["hello"]=>
+ NULL
+ }
+ [1]=>
+ array(1) {
+ ["world"]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [1]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ ["22.22"]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_basic.phpt b/ext/standard/tests/array/array_merge_basic.phpt
new file mode 100644
index 000000000..c4dc69638
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test array_merge() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_merge()
+ */
+
+echo "*** Testing array_merge() : basic functionality ***\n";
+
+//indexed array
+$array1 = array ('zero', 'one', 'two');
+//associative array
+$array2 = array ('a' => 1, 'b' => 2, 'c' => 3);
+
+var_dump(array_merge($array1, $array2));
+
+var_dump(array_merge($array2, $array1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : basic functionality ***
+array(6) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+}
+array(6) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_error.phpt b/ext/standard/tests/array/array_merge_error.phpt
new file mode 100644
index 000000000..3a394bbb7
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test array_merge() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_merge() to test behaviour
+ */
+
+echo "*** Testing array_merge() : error conditions ***\n";
+
+// Testing array_merge with zero arguments
+echo "\n-- Testing array_merge() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_merge() );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge() : error conditions ***
+
+-- Testing array_merge() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_merge() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_recursive_basic1.phpt b/ext/standard/tests/array/array_merge_recursive_basic1.phpt
new file mode 100644
index 000000000..a86a8510a
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_basic1.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test array_merge_recursive() function : basic functionality - array with default keys
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_merge_recursive() : array with default keys ***\n";
+
+// Initialise the arrays
+$arr1 = array(1, array(1, 2));
+$arr2 = array(3, array("hello", 'world'));
+$arr3 = array(array(6, 7), array("str1", 'str2'));
+
+// Calling array_merge_recursive() with default arguments
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+// Calling array_merge_recursive() with more arguments
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1,$arr2) );
+var_dump( array_merge_recursive($arr1,$arr2,$arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with default keys ***
+-- With default argument --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+-- With more arguments --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ int(3)
+ [3]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+}
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ int(3)
+ [3]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [4]=>
+ array(2) {
+ [0]=>
+ int(6)
+ [1]=>
+ int(7)
+ }
+ [5]=>
+ array(2) {
+ [0]=>
+ string(4) "str1"
+ [1]=>
+ string(4) "str2"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_basic2.phpt b/ext/standard/tests/array/array_merge_recursive_basic2.phpt
new file mode 100644
index 000000000..3f8c62e7a
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_basic2.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test array_merge_recursive() function : basic functionality - associative arrays
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_merge_recursive() : associative arrays ***\n";
+
+// Initialise the arrays
+$arr1 = array(1 => "one", 2 => array(1, 2));
+$arr2 = array(2 => 'three', "four" => array("hello", 'world'));
+$arr3 = array(1 => array(6, 7), 'four' => array("str1", 'str2'));
+
+// Calling array_merge_recursive() with default arguments
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+// Calling array_merge_recursive() with more arguments
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1,$arr2) );
+var_dump( array_merge_recursive($arr1,$arr2,$arr3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : associative arrays ***
+-- With default argument --
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+-- With more arguments --
+array(4) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+ ["four"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+}
+array(5) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+ ["four"]=>
+ array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(4) "str1"
+ [3]=>
+ string(4) "str2"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ int(6)
+ [1]=>
+ int(7)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_error.phpt b/ext/standard/tests/array/array_merge_recursive_error.phpt
new file mode 100644
index 000000000..b2fb1fd6d
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test array_merge_recursive() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_merge_recursive() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_merge_recursive() function with Zero arguments --\n";
+var_dump( array_merge_recursive() );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : error conditions ***
+
+-- Testing array_merge_recursive() function with Zero arguments --
+
+Warning: Wrong parameter count for array_merge_recursive() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation1.phpt b/ext/standard/tests/array/array_merge_recursive_variation1.phpt
new file mode 100644
index 000000000..75e0c2086
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation1.phpt
@@ -0,0 +1,303 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - unexpected values for $arr1 argument
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing non array values to 'arr1' argument of array_merge_recursive() and see
+ * that the function outputs proper warning messages wherever expected.
+*/
+
+echo "*** Testing array_merge_recursive() : Passing non array values to \$arr1 argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class A
+{
+// public $var = 10;
+ public function __toString() {
+ return "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,
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+ // resource variable
+/*23*/ $fp,
+
+ // object data
+/*24*/ new A()
+);
+
+// initialise the second argument
+$arr2 = array(1, array("hello", 'world'));
+
+// loop through each element of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "\n-- Iteration $iterator --";
+
+ // with default argument
+ echo "\n-- With default argument --";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : Passing non array values to $arr1 argument ***
+
+-- Iteration 1 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+-- With default argument --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+-- With more arguments --
+Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation10.phpt b/ext/standard/tests/array/array_merge_recursive_variation10.phpt
new file mode 100644
index 000000000..42d315eb8
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation10.phpt
@@ -0,0 +1,174 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - two dimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * two dimensional arrays for $arr1 argument.
+*/
+
+echo "*** Testing array_merge_recursive() : two dimensional array for \$arr1 argument ***\n";
+
+// initialize the 2-d array
+$arr1 = array(
+ array(1, 2, 3, 1),
+ "array" => array("hello", "world", "str1" => "hello", "str2" => 'world'),
+ array(1 => "one", 2 => "two", "one", 'two'),
+ array(1, 2, 3, 1)
+);
+
+// initialize the second argument
+$arr2 = array(1, "hello", "array" => array("hello", 'world'));
+
+echo "-- Passing the entire 2-d array --\n";
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "-- Passing the sub-array --\n";
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1["array"]) );
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1["array"], $arr2["array"]) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : two dimensional array for $arr1 argument ***
+-- Passing the entire 2-d array --
+-- With default argument --
+array(4) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+ ["array"]=>
+ array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+ ["array"]=>
+ array(6) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+ [3]=>
+ int(1)
+ [4]=>
+ string(5) "hello"
+}
+-- Passing the sub-array --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation2.phpt b/ext/standard/tests/array/array_merge_recursive_variation2.phpt
new file mode 100644
index 000000000..83f237474
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation2.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - unexpected values for $arr2 argument
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing non array values to 'arr2' argument of array_merge_recursive() and see
+ * that the function outputs proper warning messages wherever expected.
+*/
+
+echo "*** Testing array_merge_recursive() : Passing non array values to \$arr2 argument ***\n";
+
+// initialise the first argument
+$arr1 = array(1, array("hello", 'world'));
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class A
+{
+// public $var = 10;
+ public function __toString() {
+ return "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,
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+ // resource variable
+/*23*/ $fp,
+
+ // object data
+/*24*/ new A()
+);
+
+// loop through each element of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : Passing non array values to $arr2 argument ***
+
+-- Iteration 1 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_merge_recursive(): Argument #2 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation3.phpt b/ext/standard/tests/array/array_merge_recursive_variation3.phpt
new file mode 100644
index 000000000..722388a01
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation3.phpt
@@ -0,0 +1,761 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - different arrays for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different arrays to $arr1 argument and testing whether
+* array_merge_recursive() behaves in an expected way.
+*/
+
+echo "*** Testing array_merge_recursive() : Passing different arrays to \$arr1 argument ***\n";
+
+/* Different heredoc strings */
+
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The quick 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 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", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings
+ array('a\v\f', 'aaaa\r', 'b', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings
+ array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces), // with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "1" => 1 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty"), // 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 containing embedded arrays
+/*15*/ array("str1", "array" => array("hello", 'world'), array(1, 2))
+);
+
+// initialise the second argument
+$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c"));
+
+// loop through each sub array of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // with default argument
+ echo "-- With default argument --\n";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --\n";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : Passing different arrays to $arr1 argument ***
+-- Iteration 1 --
+-- With default argument --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 2 --
+-- With default argument --
+array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 3 --
+-- With default argument --
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 4 --
+-- With default argument --
+array(0) {
+}
+-- With more arguments --
+array(4) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 5 --
+-- With default argument --
+array(1) {
+ [0]=>
+ NULL
+}
+-- With more arguments --
+array(5) {
+ [0]=>
+ NULL
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 6 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(3) "a "
+ [1]=>
+ string(5) "aaaa "
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(3) "a "
+ [1]=>
+ string(5) "aaaa "
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 7 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(5) "a\v\f"
+ [1]=>
+ string(6) "aaaa\r"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(5) "a\v\f"
+ [1]=>
+ string(6) "aaaa\r"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 8 --
+-- With default argument --
+array(3) {
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(88) "hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+-- With more arguments --
+array(7) {
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(88) "hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 9 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 10 --
+-- With default argument --
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+-- With more arguments --
+array(7) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 11 --
+-- With default argument --
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(40)
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(40)
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 12 --
+-- With default argument --
+array(2) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+}
+-- With more arguments --
+array(6) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 13 --
+-- With default argument --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(4) "four"
+}
+-- With more arguments --
+array(7) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(4) "four"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 14 --
+-- With default argument --
+array(3) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 15 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(4) "true"
+ [1]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(4) "true"
+ [1]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 16 --
+-- With default argument --
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 17 --
+-- With default argument --
+array(6) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ bool(false)
+ [5]=>
+ bool(true)
+}
+-- With more arguments --
+array(10) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ bool(false)
+ [5]=>
+ bool(true)
+ [6]=>
+ string(3) "one"
+ [7]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 18 --
+-- With default argument --
+array(3) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 19 --
+-- With default argument --
+array(3) {
+ [0]=>
+ string(4) "str1"
+ ["array"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(4) "str1"
+ ["array"]=>
+ array(5) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(1) "a"
+ [3]=>
+ string(1) "b"
+ [4]=>
+ string(1) "c"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt
new file mode 100644
index 000000000..bacfe3aff
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt
@@ -0,0 +1,424 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - associative array with different keys
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing different
+ * associative arrays having different keys to $arr1 argument.
+*/
+
+echo "*** Testing array_merge_recursive() : 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 associative arrays to be passed to $arr1 argument
+$arrays = array (
+/*1*/ // arrays with integer keys
+ array(0 => "0", 1 => array(1 => "one")),
+ array(1 => "1", 2 => array(1 => "one", 2 => "two", 3 => 1, 4 => "4")),
+
+ // arrays with float keys
+/*3*/ array(2.3333 => "float", 44.44 => array(1.1 => "float")),
+ array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => array(1.1 => "f1"), 3333333.333333 => "f4"),
+
+ // arrays with string keys
+/*5*/ array('\tHello' => array("hello", 'world'), '\v\fworld' => 2.2, 'pen\n' => 111),
+ array("\tHello" => array("hello", 'world'), "\v\fworld" => 2.2, "pen\n" => 111),
+ array("hello", $heredoc => array("heredoc", 'string'), "string"),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(new classA() => 11, @$unset_var => array("unset"), $fp => 'resource', 11, "hello")
+);
+
+// initialise the second array
+$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c"));
+
+// loop through each sub array of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // with default argument
+ echo "-- With default argument --\n";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --\n";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : 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
+-- Iteration 1 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(3) "one"
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(3) "one"
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 2 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(1)
+ [4]=>
+ string(1) "4"
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(1)
+ [4]=>
+ string(1) "4"
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 3 --
+-- With default argument --
+array(2) {
+ [0]=>
+ string(5) "float"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(5) "float"
+ }
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(5) "float"
+ [1]=>
+ array(1) {
+ [1]=>
+ string(5) "float"
+ }
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 4 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(2) "f1"
+ [1]=>
+ string(2) "f2"
+ [2]=>
+ array(1) {
+ [1]=>
+ string(2) "f1"
+ }
+ [3]=>
+ string(2) "f4"
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ string(2) "f1"
+ [1]=>
+ string(2) "f2"
+ [2]=>
+ array(1) {
+ [1]=>
+ string(2) "f1"
+ }
+ [3]=>
+ string(2) "f4"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 5 --
+-- With default argument --
+array(3) {
+ ["\tHello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ ["\v\fworld"]=>
+ float(2.2)
+ ["pen\n"]=>
+ int(111)
+}
+-- With more arguments --
+array(7) {
+ ["\tHello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ ["\v\fworld"]=>
+ float(2.2)
+ ["pen\n"]=>
+ int(111)
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 6 --
+-- With default argument --
+array(3) {
+ [" Hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [" world"]=>
+ float(2.2)
+ ["pen
+"]=>
+ int(111)
+}
+-- With more arguments --
+array(7) {
+ [" Hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [" world"]=>
+ float(2.2)
+ ["pen
+"]=>
+ int(111)
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 7 --
+-- With default argument --
+array(3) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ array(2) {
+ [0]=>
+ string(7) "heredoc"
+ [1]=>
+ string(6) "string"
+ }
+ [1]=>
+ string(6) "string"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ array(2) {
+ [0]=>
+ string(7) "heredoc"
+ [1]=>
+ string(6) "string"
+ }
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 8 --
+-- With default argument --
+array(3) {
+ [""]=>
+ array(1) {
+ [0]=>
+ string(5) "unset"
+ }
+ [0]=>
+ int(11)
+ [1]=>
+ string(5) "hello"
+}
+-- With more arguments --
+array(7) {
+ [""]=>
+ array(1) {
+ [0]=>
+ string(5) "unset"
+ }
+ [0]=>
+ int(11)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation5.phpt b/ext/standard/tests/array/array_merge_recursive_variation5.phpt
new file mode 100644
index 000000000..3b251220e
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation5.phpt
@@ -0,0 +1,404 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - associative array with different values
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing different
+ * associative arrays having different values to $arr1 argument.
+*/
+
+echo "*** Testing array_merge_recursive() : 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 associative arrays to be passed to $arr1 argument
+$arrays = array (
+// arrays with integer values
+/*1*/ array('0' => 0, '1' => 0),
+ array("one" => 1, 'two' => 2, "three" => 1, 4 => 1),
+
+ // arrays with float values
+/*3*/ array("f1" => 2.3333, "f2" => 2.3333, "f3" => array(1.1, 2.22)),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => array(1.2, 'f4' => 1.2)),
+
+ // arrays with string values
+/*5*/ array(111 => "\tHello", "array" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"),
+ array(111 => '\tHello', 'array' => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'),
+ array(1 => "hello", "string" => $heredoc, $heredoc),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(11 => new classA(), "string" => @$unset_var, "resource" => $fp, new classA(), $fp),
+);
+
+// initialise the second array
+$arr2 = array( 1 => "one", 2, "string" => "hello", "array" => array("a", "b", "c"));
+
+// loop through each sub array of $arrays and check the behavior of array_merge_recursive()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // with default argument
+ echo "-- With default argument --\n";
+ var_dump( array_merge_recursive($arr1) );
+
+ // with more arguments
+ echo "-- With more arguments --\n";
+ var_dump( array_merge_recursive($arr1, $arr2) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : assoc. array with diff. values to $arr1 argument ***
+-- Iteration 1 --
+-- With default argument --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 2 --
+-- With default argument --
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+-- With more arguments --
+array(8) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(1)
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 3 --
+-- With default argument --
+array(3) {
+ ["f1"]=>
+ float(2.3333)
+ ["f2"]=>
+ float(2.3333)
+ ["f3"]=>
+ array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.22)
+ }
+}
+-- With more arguments --
+array(7) {
+ ["f1"]=>
+ float(2.3333)
+ ["f2"]=>
+ float(2.3333)
+ ["f3"]=>
+ array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.22)
+ }
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 4 --
+-- With default argument --
+array(4) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [0]=>
+ float(4.8999992284)
+ ["f4"]=>
+ array(2) {
+ [0]=>
+ float(1.2)
+ ["f4"]=>
+ float(1.2)
+ }
+}
+-- With more arguments --
+array(8) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [0]=>
+ float(4.8999992284)
+ ["f4"]=>
+ array(2) {
+ [0]=>
+ float(1.2)
+ ["f4"]=>
+ float(1.2)
+ }
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 5 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(6) " Hello"
+ ["array"]=>
+ string(6) "col or"
+ [1]=>
+ string(7) " world"
+ [2]=>
+ string(6) " Hello"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ string(6) " Hello"
+ ["array"]=>
+ array(4) {
+ [0]=>
+ string(6) "col or"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(1) "c"
+ }
+ [1]=>
+ string(7) " world"
+ [2]=>
+ string(6) " Hello"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+}
+-- Iteration 6 --
+-- With default argument --
+array(4) {
+ [0]=>
+ string(7) "\tHello"
+ ["array"]=>
+ string(7) "col\tor"
+ [1]=>
+ string(9) "\v\fworld"
+ [2]=>
+ string(7) "\tHello"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ string(7) "\tHello"
+ ["array"]=>
+ array(4) {
+ [0]=>
+ string(7) "col\tor"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+ [3]=>
+ string(1) "c"
+ }
+ [1]=>
+ string(9) "\v\fworld"
+ [2]=>
+ string(7) "\tHello"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["string"]=>
+ string(5) "hello"
+}
+-- Iteration 7 --
+-- With default argument --
+array(3) {
+ [0]=>
+ string(5) "hello"
+ ["string"]=>
+ string(11) "Hello world"
+ [1]=>
+ string(11) "Hello world"
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ string(5) "hello"
+ ["string"]=>
+ array(2) {
+ [0]=>
+ string(11) "Hello world"
+ [1]=>
+ string(5) "hello"
+ }
+ [1]=>
+ string(11) "Hello world"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ int(2)
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+-- Iteration 8 --
+-- With default argument --
+array(5) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ ["string"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ resource(%d) of type (stream)
+}
+-- With more arguments --
+array(8) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ ["string"]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "hello"
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ resource(%d) of type (stream)
+ [3]=>
+ string(3) "one"
+ [4]=>
+ int(2)
+ ["array"]=>
+ array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation6.phpt b/ext/standard/tests/array/array_merge_recursive_variation6.phpt
new file mode 100644
index 000000000..8e460ba36
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation6.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - array with duplicate keys
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * array having duplicate keys.
+*/
+
+echo "*** Testing array_merge_recursive() : array with duplicate keys for \$arr1 argument ***\n";
+
+/* initialize the array having duplicate keys */
+// array with numeric keys
+$arr1_numeric_key = array( 1 => "one", 2 => "two", 2 => array(1, 2), 3 => "three", 1 => array("duplicate", 'strings'));
+// array with string keys
+$arr1_string_key = array("str1" => "hello", "str2" => 111, "str1" => "world", "str2" => 111.111);
+
+// initialize the second argument
+$arr2 = array("one", "str1" => "two", array("one", "two"));
+
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1_numeric_key) );
+var_dump( array_merge_recursive($arr1_string_key) );
+
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1_numeric_key, $arr2) );
+var_dump( array_merge_recursive($arr1_string_key, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with duplicate keys for $arr1 argument ***
+-- With default argument --
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(9) "duplicate"
+ [1]=>
+ string(7) "strings"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ ["str1"]=>
+ string(5) "world"
+ ["str2"]=>
+ float(111.111)
+}
+-- With more arguments --
+array(6) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(9) "duplicate"
+ [1]=>
+ string(7) "strings"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ string(5) "three"
+ [3]=>
+ string(3) "one"
+ ["str1"]=>
+ string(3) "two"
+ [4]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+}
+array(4) {
+ ["str1"]=>
+ array(2) {
+ [0]=>
+ string(5) "world"
+ [1]=>
+ string(3) "two"
+ }
+ ["str2"]=>
+ float(111.111)
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation7.phpt b/ext/standard/tests/array/array_merge_recursive_variation7.phpt
new file mode 100644
index 000000000..b244e7d6b
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation7.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - array with reference variables
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * array having reference variables.
+*/
+
+echo "*** Testing array_merge_recursive() : array with reference variables for \$arr1 argument ***\n";
+
+$value1 = 10;
+$value2 = "hello";
+$value3 = 0;
+$value4 = &$value2;
+
+// input array containing elements as reference variables
+$arr1 = array(
+ 0 => 0,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => "hello",
+ 4 => &$value3,
+ $value4 => &$value2
+);
+
+// initialize the second argument
+$arr2 = array($value4 => "hello", &$value2);
+
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with reference variables for $arr1 argument ***
+-- With default argument --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ &string(5) "hello"
+ [2]=>
+ &string(5) "hello"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ &int(0)
+ ["hello"]=>
+ &string(5) "hello"
+}
+-- With more arguments --
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ &string(5) "hello"
+ [2]=>
+ &string(5) "hello"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ &int(0)
+ ["hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "hello"
+ }
+ [5]=>
+ &string(5) "hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation8.phpt b/ext/standard/tests/array/array_merge_recursive_variation8.phpt
new file mode 100644
index 000000000..6ad2f6989
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation8.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing an array having binary values.
+*/
+
+echo "*** Testing array_merge_recursive() : array with binary data for \$arr1 argument ***\n";
+
+// array with binary values
+$arr1 = array(b"1", b"hello" => "hello", b"world", "str1" => b"hello", "str2" => "world");
+
+// initialize the second argument
+$arr2 = array(b"str1" => b"binary", b"hello" => "binary", b"str2" => b"binary");
+
+echo "-- With default argument --\n";
+var_dump( array_merge_recursive($arr1) );
+
+echo "-- With more arguments --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : array with binary data for $arr1 argument ***
+-- With default argument --
+array(5) {
+ [0]=>
+ string(1) "1"
+ ["hello"]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ string(5) "hello"
+ ["str2"]=>
+ string(5) "world"
+}
+-- With more arguments --
+array(5) {
+ [0]=>
+ string(1) "1"
+ ["hello"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(6) "binary"
+ }
+ [1]=>
+ string(5) "world"
+ ["str1"]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(6) "binary"
+ }
+ ["str2"]=>
+ array(2) {
+ [0]=>
+ string(5) "world"
+ [1]=>
+ string(6) "binary"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation9.phpt b/ext/standard/tests/array/array_merge_recursive_variation9.phpt
new file mode 100644
index 000000000..d51d2f890
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_recursive_variation9.phpt
@@ -0,0 +1,117 @@
+--TEST--
+Test array_merge_recursive() function : usage variations - common key and value(Bug#43559)
+--FILE--
+<?php
+/* Prototype : array array_merge_recursive(array $arr1[, array $...])
+ * Description: Recursively merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_merge_recursive() by passing
+ * arrays having common key and value.
+*/
+
+echo "*** Testing array_merge_recursive() : arrays with common key and value ***\n";
+
+/* initialize the array having duplicate values */
+
+// integer values
+$arr1 = array("a" => 1, "b" => 2);
+$arr2 = array("b" => 2, "c" => 4);
+echo "-- Integer values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// float values
+$arr1 = array("a" => 1.1, "b" => 2.2);
+$arr2 = array("b" => 2.2, "c" => 3.3);
+echo "-- Float values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// string values
+$arr1 = array("a" => "hello", "b" => "world");
+$arr2 = array("b" => "world", "c" => "string");
+echo "-- String values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// boolean values
+$arr1 = array("a" => true, "b" => false);
+$arr2 = array("b" => false);
+echo "-- Boolean values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+// null values
+$arr1 = array( "a" => NULL);
+$arr2 = array( "a" => NULL);
+echo "-- Null values --\n";
+var_dump( array_merge_recursive($arr1, $arr2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge_recursive() : arrays with common key and value ***
+-- Integer values --
+array(3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ }
+ ["c"]=>
+ int(4)
+}
+-- Float values --
+array(3) {
+ ["a"]=>
+ float(1.1)
+ ["b"]=>
+ array(2) {
+ [0]=>
+ float(2.2)
+ [1]=>
+ float(2.2)
+ }
+ ["c"]=>
+ float(3.3)
+}
+-- String values --
+array(3) {
+ ["a"]=>
+ string(5) "hello"
+ ["b"]=>
+ array(2) {
+ [0]=>
+ string(5) "world"
+ [1]=>
+ string(5) "world"
+ }
+ ["c"]=>
+ string(6) "string"
+}
+-- Boolean values --
+array(2) {
+ ["a"]=>
+ bool(true)
+ ["b"]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+-- Null values --
+array(1) {
+ ["a"]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_merge_variation1.phpt b/ext/standard/tests/array/array_merge_variation1.phpt
new file mode 100644
index 000000000..1ce71debb
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation1.phpt
@@ -0,0 +1,231 @@
+--TEST--
+Test array_merge() function : usage variations - Pass different data types to $arr1 arg
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $arr1 argument to test behaviour
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr2 = array (1, 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
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_merge()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_merge($input, $arr2) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+-- Iteration 19 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_merge(): Argument #1 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_variation10.phpt b/ext/standard/tests/array/array_merge_variation10.phpt
new file mode 100644
index 000000000..7f08a4bb7
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation10.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test array_merge() function : usage variations - position of internal array pointer
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check the position of the internal array pointer after calling array_merge().
+ * This test is also passing more than two arguments to array_merge().
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+$arr1 = array ('zero', 'one', 'two');
+$arr2 = array ('zero', 'un', 'deux');
+$arr3 = array ('null', 'eins', 'zwei');
+
+echo "\n-- Call array_merge() --\n";
+var_dump($result = array_merge($arr1, $arr2, $arr3));
+
+echo "\n-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo "\$arr1: ";
+echo key($arr1) . " => " . current ($arr1) . "\n";
+echo "\$arr2: ";
+echo key($arr2) . " => " . current ($arr2) . "\n";
+echo "\$arr3: ";
+echo key($arr3) . " => " . current ($arr3) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Call array_merge() --
+array(9) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(4) "zero"
+ [4]=>
+ string(2) "un"
+ [5]=>
+ string(4) "deux"
+ [6]=>
+ string(4) "null"
+ [7]=>
+ string(4) "eins"
+ [8]=>
+ string(4) "zwei"
+}
+
+-- Position of Internal Pointer in Result: --
+0 => zero
+
+-- Position of Internal Pointer in Original Array: --
+$arr1: 0 => zero
+$arr2: 0 => zero
+$arr3: 0 => null
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation2.phpt b/ext/standard/tests/array/array_merge_variation2.phpt
new file mode 100644
index 000000000..4ebbeb92b
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation2.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test array_merge() function : usage variations - Pass different data types as $arr2 arg
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $arr2 argument to array_merge() to test behaviour
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr1 = array (1, 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
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_merge()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_merge($arr1, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+-- Iteration 19 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_merge(): Argument #2 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_merge_variation3.phpt b/ext/standard/tests/array/array_merge_variation3.phpt
new file mode 100644
index 000000000..717968adb
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation3.phpt
@@ -0,0 +1,379 @@
+--TEST--
+Test array_merge() function : usage variations - arrays of diff. data types
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of different data types to test how array_merge adds them
+ * onto an existing array
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr = array (1, 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");
+
+// arrays of different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_merge
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_merge($input, $arr) );
+ var_dump( array_merge($arr, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1: int data --
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+}
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(0)
+ [3]=>
+ int(1)
+ [4]=>
+ int(12345)
+ [5]=>
+ int(-2345)
+}
+
+-- Iteration 2: float data --
+array(7) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+ [5]=>
+ int(1)
+ [6]=>
+ int(2)
+}
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(10.5)
+ [3]=>
+ float(-10.5)
+ [4]=>
+ float(123456789000)
+ [5]=>
+ float(1.23456789E-9)
+ [6]=>
+ float(0.5)
+}
+
+-- Iteration 3: null data --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+
+-- Iteration 4: bool data --
+array(6) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+}
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+ [4]=>
+ bool(true)
+ [5]=>
+ bool(false)
+}
+
+-- Iteration 5: empty string data --
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+}
+
+-- Iteration 6: empty array data --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+-- Iteration 7: string data --
+array(5) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(11) "hello world"
+ [3]=>
+ int(1)
+ [4]=>
+ int(2)
+}
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+ [3]=>
+ string(6) "string"
+ [4]=>
+ string(11) "hello world"
+}
+
+-- Iteration 8: object data --
+array(3) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9: undefined data --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+}
+
+-- Iteration 10: unset data --
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+}
+
+-- Iteration 11: resource data --
+array(3) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ resource(%d) of type (stream)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation4.phpt b/ext/standard/tests/array/array_merge_variation4.phpt
new file mode 100644
index 000000000..e4eb2570c
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation4.phpt
@@ -0,0 +1,368 @@
+--TEST--
+Test array_merge() function : usage variations - Diff. data types as array keys
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array with different data types as keys to test how array_merge
+ * adds it onto an existing array
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$arr = array ('one' => 1, 'two' => 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays with keys as different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_merge
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_merge($input, $arr) );
+ var_dump( array_merge($arr, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Iteration 1: int data --
+array(6) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(6) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+}
+
+-- Iteration 2: float data --
+array(5) {
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(5) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+}
+
+-- Iteration 3: extreme floats data --
+array(4) {
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+}
+
+-- Iteration 4: null uppercase data --
+array(3) {
+ [""]=>
+ string(6) "null 1"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5: null lowercase data --
+array(3) {
+ [""]=>
+ string(6) "null 2"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6: bool lowercase data --
+array(4) {
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7: bool uppercase data --
+array(4) {
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8: empty double quotes data --
+array(3) {
+ [""]=>
+ string(6) "emptyd"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9: empty single quotes data --
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10: string data --
+array(5) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(5) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11: undefined data --
+array(3) {
+ [""]=>
+ string(9) "undefined"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12: unset data --
+array(3) {
+ [""]=>
+ string(5) "unset"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation5.phpt b/ext/standard/tests/array/array_merge_variation5.phpt
new file mode 100644
index 000000000..eca6078e6
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation5.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test array_merge() function : usage variations - numeric keys
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_merge() arrays with only numeric keys to test behaviour.
+ * $arr2 contains a duplicate element to $arr1.
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+//numeric keys
+$arr1 = array('zero', 'one', 'two', 'three');
+$arr2 = array(1 => 'one', 20 => 'twenty', 30 => 'thirty');
+
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+array(7) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ string(6) "twenty"
+ [6]=>
+ string(6) "thirty"
+}
+array(7) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(6) "twenty"
+ [2]=>
+ string(6) "thirty"
+ [3]=>
+ string(4) "zero"
+ [4]=>
+ string(3) "one"
+ [5]=>
+ string(3) "two"
+ [6]=>
+ string(5) "three"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation6.phpt b/ext/standard/tests/array/array_merge_variation6.phpt
new file mode 100644
index 000000000..13b346eb3
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation6.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_merge() function : usage variations - string keys
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_merge arrays with string keys to test behaviour.
+ * $arr2 has a duplicate key to $arr1
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+//string keys
+$arr1 = array('zero' => 'zero', 'one' => 'un', 'two' => 'deux');
+$arr2 = array('zero' => 'zero', 'un' => 'eins', 'deux' => 'zwei');
+
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+array(5) {
+ ["zero"]=>
+ string(4) "zero"
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+ ["un"]=>
+ string(4) "eins"
+ ["deux"]=>
+ string(4) "zwei"
+}
+array(5) {
+ ["zero"]=>
+ string(4) "zero"
+ ["un"]=>
+ string(4) "eins"
+ ["deux"]=>
+ string(4) "zwei"
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation7.phpt b/ext/standard/tests/array/array_merge_variation7.phpt
new file mode 100644
index 000000000..00943f3ea
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation7.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test array_merge() function : usage variations - Mixed keys
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_merge() arrays with mixed keys to test how it attaches them to
+ * existing arrays
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+//mixed keys
+$arr1 = array('zero', 20 => 'twenty', 'thirty' => 30, true => 'bool');
+$arr2 = array(0, 1, 2, null => 'null', 1.234E-10 => 'float');
+
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+array(8) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(6) "twenty"
+ ["thirty"]=>
+ int(30)
+ [2]=>
+ string(4) "bool"
+ [3]=>
+ string(5) "float"
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+ [""]=>
+ string(4) "null"
+}
+array(8) {
+ [0]=>
+ string(5) "float"
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [""]=>
+ string(4) "null"
+ [3]=>
+ string(4) "zero"
+ [4]=>
+ string(6) "twenty"
+ ["thirty"]=>
+ int(30)
+ [5]=>
+ string(4) "bool"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation8.phpt b/ext/standard/tests/array/array_merge_variation8.phpt
new file mode 100644
index 000000000..a4cdea74f
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation8.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test array_merge() function : usage variations - multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_merge() with multi-dimensional arrays
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+$arr1 = array('zero', 'one', 'two', array(0));
+$arr2 = array(1, 2, 3);
+
+echo "\n-- Merge a two-dimensional and a one-dimensional array --\n";
+var_dump(array_merge($arr1, $arr2));
+
+echo "\n-- Merge an array and a sub-array --\n";
+var_dump(array_merge($arr1[3], $arr2));
+var_dump(array_merge($arr2, $arr1[3]));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Merge a two-dimensional and a one-dimensional array --
+array(7) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+ [6]=>
+ int(3)
+}
+
+-- Merge an array and a sub-array --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(0)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_merge_variation9.phpt b/ext/standard/tests/array/array_merge_variation9.phpt
new file mode 100644
index 000000000..e42e29282
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_variation9.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test array_merge() function : usage variations - referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/* Test array_merge() when:
+ * 1. Passed an array made up of referenced variables
+ * 2. Passed an array as the first argument and a reference to that array as the second.
+ */
+
+echo "*** Testing array_merge() : usage variations ***\n";
+
+$val1 = 'foo';
+$val2 = 'bar';
+$val3 = 'baz';
+
+$arr1 = array(&$val1, &$val2, &$val3);
+$arr2 = array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3');
+
+echo "\n-- Merge an array made up of referenced variables to an assoc. array --\n";
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+$val2 = 'hello world';
+
+echo "\n-- Change \$val2 --\n";
+var_dump(array_merge($arr1, $arr2));
+var_dump(array_merge($arr2, $arr1));
+
+echo "\n-- Merge an array and a reference to the first array --\n";
+var_dump(array_merge($arr2, &$arr2));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : usage variations ***
+
+-- Merge an array made up of referenced variables to an assoc. array --
+array(6) {
+ [0]=>
+ &string(3) "foo"
+ [1]=>
+ &string(3) "bar"
+ [2]=>
+ &string(3) "baz"
+ ["key1"]=>
+ string(4) "val1"
+ ["key2"]=>
+ string(4) "val2"
+ ["key3"]=>
+ string(4) "val3"
+}
+array(6) {
+ ["key1"]=>
+ string(4) "val1"
+ ["key2"]=>
+ string(4) "val2"
+ ["key3"]=>
+ string(4) "val3"
+ [0]=>
+ &string(3) "foo"
+ [1]=>
+ &string(3) "bar"
+ [2]=>
+ &string(3) "baz"
+}
+
+-- Change $val2 --
+array(6) {
+ [0]=>
+ &string(3) "foo"
+ [1]=>
+ &string(11) "hello world"
+ [2]=>
+ &string(3) "baz"
+ ["key1"]=>
+ string(4) "val1"
+ ["key2"]=>
+ string(4) "val2"
+ ["key3"]=>
+ string(4) "val3"
+}
+array(6) {
+ ["key1"]=>
+ string(4) "val1"
+ ["key2"]=>
+ string(4) "val2"
+ ["key3"]=>
+ string(4) "val3"
+ [0]=>
+ &string(3) "foo"
+ [1]=>
+ &string(11) "hello world"
+ [2]=>
+ &string(3) "baz"
+}
+
+-- Merge an array and a reference to the first array --
+array(3) {
+ ["key1"]=>
+ string(4) "val1"
+ ["key2"]=>
+ string(4) "val2"
+ ["key3"]=>
+ string(4) "val3"
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_basic.phpt b/ext/standard/tests/array/array_pad_basic.phpt
new file mode 100644
index 000000000..1dfc71e01
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test array_pad() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_pad() : basic functionality ***\n";
+
+// Initialise $input and $pad_value arguments
+$input = array(1, 2, 3);
+$pad_value = -3;
+
+// positive $pad_size
+echo "-- Positive pad_size --\n";
+var_dump( array_pad($input, 8, $pad_value) );
+
+// negative $pad_size
+echo "-- Negative pad_size --\n";
+var_dump( array_pad($input, -8, $pad_value) );
+
+// $pad_size less than array size, no padding expected
+echo "-- Pad_size lesser than array_size --\n";
+var_dump( array_pad($input, 2, $pad_value) );
+
+// $pad_size equal to array size, no padding expected
+echo "-- Pad_size equal to array_size --\n";
+var_dump( array_pad($input, 3, $pad_value) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : basic functionality ***
+-- Positive pad_size --
+array(8) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(-3)
+ [4]=>
+ int(-3)
+ [5]=>
+ int(-3)
+ [6]=>
+ int(-3)
+ [7]=>
+ int(-3)
+}
+-- Negative pad_size --
+array(8) {
+ [0]=>
+ int(-3)
+ [1]=>
+ int(-3)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-3)
+ [4]=>
+ int(-3)
+ [5]=>
+ int(1)
+ [6]=>
+ int(2)
+ [7]=>
+ int(3)
+}
+-- Pad_size lesser than array_size --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+-- Pad_size equal to array_size --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_error.phpt b/ext/standard/tests/array/array_pad_error.phpt
new file mode 100644
index 000000000..49fa66e86
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_error.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_pad() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_pad() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_pad() function with Zero arguments --\n";
+var_dump( array_pad() );
+
+//Test array_pad with one more than the expected number of arguments
+echo "\n-- Testing array_pad() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$pad_size = 10;
+$pad_value = 1;
+$extra_arg = 10;
+var_dump( array_pad($input, $pad_size, $pad_value, $extra_arg) );
+
+// Testing array_pad with less than the expected number of arguments
+echo "\n-- Testing array_pad() function with less than expected no. of arguments --\n";
+$input = array(1, 2);
+$pad_size = 10;
+var_dump( array_pad($input, $pad_size) );
+var_dump( array_pad($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : error conditions ***
+
+-- Testing array_pad() function with Zero arguments --
+
+Warning: Wrong parameter count for array_pad() in %s on line %d
+NULL
+
+-- Testing array_pad() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_pad() in %s on line %d
+NULL
+
+-- Testing array_pad() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_pad() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_pad() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_pad_variation1.phpt b/ext/standard/tests/array/array_pad_variation1.phpt
new file mode 100644
index 000000000..b92f36da7
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_variation1.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test array_pad() function : usage variations - unexpected values for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_pad() function by passing values to $input argument other than arrays
+* and see that function outputs proper warning messages wherever expected.
+* The $pad_size and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : passing non array values to \$input argument ***\n";
+
+// Initialise $pad_size and $pad_value
+$pad_size = 10;
+$pad_value = 1;
+
+//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 $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+ // 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 element of $inputs to check the behavior of array_pad()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+ var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : passing non array values to $input argument ***
+
+-- Iteration 1 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pad(): The argument should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_pad_variation2.phpt b/ext/standard/tests/array/array_pad_variation2.phpt
new file mode 100644
index 000000000..0413b9ef2
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_variation2.phpt
@@ -0,0 +1,288 @@
+--TEST--
+Test array_pad() function : usage variations - unexpected values for 'pad_size' argument(Bug#43482)
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_pad() function by passing values to $pad_size argument other than integers
+* and see that function outputs proper warning messages wherever expected.
+* The $input and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : passing non integer values to \$pad_size argument ***\n";
+
+// Initialise $input and $pad_value arguments
+$input = array(1, 2);
+$pad_value = 1;
+
+//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
+$pad_sizes = array(
+
+ // float data
+/*1*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ -12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*6*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // string data
+/*19*/ "string",
+ 'string',
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $pad_sizes to check the behavior of array_pad()
+$iterator = 1;
+foreach($pad_sizes as $pad_size) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_pad($input, $pad_size, $pad_value) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : passing non integer values to $pad_size argument ***
+-- Iteration 1 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+ [6]=>
+ int(1)
+ [7]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(1)
+}
+-- Iteration 2 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+ [6]=>
+ int(1)
+ [7]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(2)
+}
+-- Iteration 3 --
+
+Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d
+bool(false)
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 9 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 10 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 12 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 16 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 17 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 18 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 19 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 20 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 21 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 22 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 23 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 24 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation3.phpt b/ext/standard/tests/array/array_pad_variation3.phpt
new file mode 100644
index 000000000..75df11822
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_variation3.phpt
@@ -0,0 +1,869 @@
+--TEST--
+Test array_pad() function : usage variations - possible values for 'pad_value' argument
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_pad() function for expected behavior by passing
+* different possible values for $pad_value argument.
+* $input and $pad_size arguments take fixed value.
+*/
+
+echo "*** Testing array_pad() : possible values for \$pad_value argument ***\n";
+
+// Initialise $input and $pad_size argument
+$input = array(1, 2);
+$pad_size = 4;
+
+//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");
+
+// get a reference variable
+$value = "hello";
+$reference = &$value;
+
+// different values to be passed to $pad_value argument
+$pad_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',
+ $heredoc,
+
+ // strings with different white spaces
+/*26*/ "\v\fHello\t world!! \rstring\n",
+ '\v\fHello\t world!! \rstring\n',
+
+ // object data
+/*28*/ new classA(),
+
+ // undefined data
+/*29*/ @$undefined_var,
+
+ // unset data
+/*30*/ @$unset_var,
+
+ // resource variable
+/*31*/ $fp,
+
+ // reference variable
+/*32*/ $reference
+);
+
+// loop through each element of $pad_values to check the behavior of array_pad()
+$iterator = 1;
+foreach($pad_values as $pad_value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+ var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : possible values for $pad_value argument ***
+-- Iteration 1 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(12345)
+}
+array(4) {
+ [0]=>
+ int(12345)
+ [1]=>
+ int(12345)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 4 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(-2345)
+ [3]=>
+ int(-2345)
+}
+array(4) {
+ [0]=>
+ int(-2345)
+ [1]=>
+ int(-2345)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(10.5)
+ [3]=>
+ float(10.5)
+}
+array(4) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(10.5)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(-10.5)
+ [3]=>
+ float(-10.5)
+}
+array(4) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(123456789000)
+}
+array(4) {
+ [0]=>
+ float(123456789000)
+ [1]=>
+ float(123456789000)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 8 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(1.23456789E-9)
+ [3]=>
+ float(1.23456789E-9)
+}
+array(4) {
+ [0]=>
+ float(1.23456789E-9)
+ [1]=>
+ float(1.23456789E-9)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 9 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.5)
+}
+array(4) {
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(0.5)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 10 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(0) {
+ }
+ [3]=>
+ array(0) {
+ }
+}
+array(4) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 11 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+}
+array(4) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 12 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+array(4) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 13 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+}
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 14 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [3]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+}
+array(4) {
+ [0]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [1]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 15 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 16 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 17 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 18 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 19 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 20 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 21 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+}
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 22 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+}
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 23 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+ [3]=>
+ string(6) "string"
+}
+array(4) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 24 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(6) "string"
+ [3]=>
+ string(6) "string"
+}
+array(4) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 25 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(11) "hello world"
+ [3]=>
+ string(11) "hello world"
+}
+array(4) {
+ [0]=>
+ string(11) "hello world"
+ [1]=>
+ string(11) "hello world"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 26 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(25) " Hello world!! string
+"
+ [3]=>
+ string(25) " Hello world!! string
+"
+}
+array(4) {
+ [0]=>
+ string(25) " Hello world!! string
+"
+ [1]=>
+ string(25) " Hello world!! string
+"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 27 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+ [3]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+}
+array(4) {
+ [0]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+ [1]=>
+ string(30) "\v\fHello\t world!! \rstring\n"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 28 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [3]=>
+ object(classA)#%d (0) {
+ }
+}
+array(4) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 29 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 30 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 31 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ resource(%d) of type (stream)
+ [3]=>
+ resource(%d) of type (stream)
+}
+array(4) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+-- Iteration 32 --
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "hello"
+}
+array(4) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation4.phpt b/ext/standard/tests/array/array_pad_variation4.phpt
new file mode 100644
index 000000000..83c1e8300
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_variation4.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test array_pad() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing binary values to $pad_value argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $input and $pad_size arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing binary values to \$pad_value argument ***\n";
+
+// initialize the $input and $pad_size argument
+$input = array(1, 2, 3);
+$pad_size = 6;
+
+// initialize $pad_value with reference variable
+$binary = b"hello";
+
+var_dump( array_pad($input, $pad_size, $binary) ); // positive 'pad_size'
+var_dump( array_pad($input, -$pad_size, $binary) ); // negative 'pad_size'
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing binary values to $pad_value argument ***
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ string(5) "hello"
+ [5]=>
+ string(5) "hello"
+}
+array(6) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ int(1)
+ [4]=>
+ int(2)
+ [5]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation5.phpt b/ext/standard/tests/array/array_pad_variation5.phpt
new file mode 100644
index 000000000..4e8e0f113
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_variation5.phpt
@@ -0,0 +1,140 @@
+--TEST--
+Test array_pad() function : usage variations - two dimensional array for 'pad_value' argument
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing two dimensional array to $pad_value argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $input and $pad_size arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing 2-d array to \$pad_value argument ***\n";
+
+// initialize the $input and $pad_size argument
+$input = array(1, 2, 3);
+$pad_size = 5;
+
+// initialize $pad_value
+$pad_value = array (
+ array(1),
+ array("hello", 'world'),
+ array("one" => 1, 'two' => 2)
+);
+
+var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_value'
+var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_value'
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing 2-d array to $pad_value argument ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+}
+array(5) {
+ [0]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ }
+ [2]=>
+ int(1)
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation6.phpt b/ext/standard/tests/array/array_pad_variation6.phpt
new file mode 100644
index 000000000..2f97e3ee5
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_variation6.phpt
@@ -0,0 +1,668 @@
+--TEST--
+Test array_pad() function : usage variations - different arrays for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different arrays to $input argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $pad_size and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing different arrays to \$input argument ***\n";
+
+/* Different heredoc strings */
+
+// 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;
+
+// different arrays to be passed to $input argument
+$inputs = 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\tbbb", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings
+ array('a\v\f', 'aaaa\r', 'b\tbbb', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // 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)
+);
+
+// initialize the $pad_size and $pad_value arguments
+$pad_size = 6;
+$pad_value = "HELLO";
+
+// loop through each sub-array within $inputs to check the behavior of array_pad()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+ var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing different arrays to $input argument ***
+-- Iteration 1 --
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+}
+-- Iteration 2 --
+array(6) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ float(1.1)
+ [5]=>
+ float(2.2)
+}
+-- Iteration 3 --
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ bool(false)
+ [5]=>
+ bool(true)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+-- Iteration 5 --
+array(6) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ NULL
+}
+-- Iteration 6 --
+array(6) {
+ [0]=>
+ string(3) "a "
+ [1]=>
+ string(5) "aaaa "
+ [2]=>
+ string(5) "b bbb"
+ [3]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(3) "a "
+ [3]=>
+ string(5) "aaaa "
+ [4]=>
+ string(5) "b bbb"
+ [5]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 7 --
+array(6) {
+ [0]=>
+ string(5) "a\v\f"
+ [1]=>
+ string(6) "aaaa\r"
+ [2]=>
+ string(6) "b\tbbb"
+ [3]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "a\v\f"
+ [3]=>
+ string(6) "aaaa\r"
+ [4]=>
+ string(6) "b\tbbb"
+ [5]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 8 --
+array(6) {
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(86) "hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [0]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(86) "hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [2]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+}
+-- Iteration 9 --
+array(6) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(5) "three"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+ [5]=>
+ string(5) "three"
+}
+-- Iteration 10 --
+array(6) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+-- Iteration 11 --
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(20)
+ [2]=>
+ int(40)
+ [3]=>
+ int(30)
+ [4]=>
+ string(5) "HELLO"
+ [5]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ int(10)
+ [3]=>
+ int(20)
+ [4]=>
+ int(40)
+ [5]=>
+ int(30)
+}
+-- Iteration 12 --
+array(6) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+}
+-- Iteration 13 --
+array(6) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(4) "four"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["one"]=>
+ int(1)
+ [3]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 14 --
+array(6) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- Iteration 15 --
+array(6) {
+ [0]=>
+ string(4) "true"
+ [1]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(4) "true"
+ [3]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- Iteration 16 --
+array(6) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- Iteration 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)
+}
+-- Iteration 18 --
+array(6) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [""]=>
+ int(4)
+ [3]=>
+ int(5)
+ [4]=>
+ int(6)
+}
+-- Iteration 19 --
+array(6) {
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+}
+array(6) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_pad_variation7.phpt b/ext/standard/tests/array/array_pad_variation7.phpt
new file mode 100644
index 000000000..887f35194
--- /dev/null
+++ b/ext/standard/tests/array/array_pad_variation7.phpt
@@ -0,0 +1,127 @@
+--TEST--
+Test array_pad() function : usage variations - two dimensional array for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value)
+ * Description: Returns a copy of input array padded with pad_value to size pad_size
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing two dimensional array to $input argument and testing whether
+* array_pad() behaves in an expected way with the other arguments passed to the function.
+* The $pad_size and $pad_value arguments passed are fixed values.
+*/
+
+echo "*** Testing array_pad() : Passing 2-D array to \$input argument ***\n";
+
+// initialize the 2-d array
+$input = array (
+ array(1, 2, 3),
+ array("hello", 'world'),
+ array("one" => 1, "two" => 2)
+);
+
+// initialize the $pad_size and $pad_value arguments
+$pad_size = 5;
+$pad_value = "HELLO";
+
+// entire 2-d array
+echo "-- Entire 2-d array for \$input argument --\n";
+var_dump( array_pad($input, $pad_size, $pad_value) ); // positive 'pad_size'
+var_dump( array_pad($input, -$pad_size, $pad_value) ); // negative 'pad_size'
+
+// sub array
+echo "-- Sub array for \$input argument --\n";
+var_dump( array_pad($input[1], $pad_size, $pad_value) ); // positive 'pad_size'
+var_dump( array_pad($input[1], -$pad_size, $pad_value) ); // negative 'pad_size'
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_pad() : Passing 2-D array to $input argument ***
+-- Entire 2-d array for $input argument --
+array(5) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [2]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(5) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ }
+ [4]=>
+ array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ }
+}
+-- Sub array for $input argument --
+array(5) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "HELLO"
+ [4]=>
+ string(5) "HELLO"
+}
+array(5) {
+ [0]=>
+ string(5) "HELLO"
+ [1]=>
+ string(5) "HELLO"
+ [2]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_push_basic.phpt b/ext/standard/tests/array/array_push_basic.phpt
new file mode 100644
index 000000000..5ccf037da
--- /dev/null
+++ b/ext/standard/tests/array/array_push_basic.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test array_push() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_push with indexed and associative arrays
+ */
+
+echo "*** Testing array_push() : basic functionality ***\n";
+
+$array = array ('zero', 'one', 'two');
+$var1 = 'three';
+$var2 = 'four';
+
+echo "\n-- Push values onto an indexed array --\n";
+var_dump(array_push($array, $var1, $var2));
+var_dump($array);
+
+$array_assoc = array ('one' => 'un', 'two' => 'deux');
+
+echo "\n-- Push values onto an associative array --\n";
+var_dump(array_push($array_assoc, $var1, $var2));
+var_dump($array_assoc);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_push() : basic functionality ***
+
+-- Push values onto an indexed array --
+int(5)
+array(5) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ [4]=>
+ string(4) "four"
+}
+
+-- Push values onto an associative array --
+int(4)
+array(4) {
+ ["one"]=>
+ string(2) "un"
+ ["two"]=>
+ string(4) "deux"
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(4) "four"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_error1.phpt b/ext/standard/tests/array/array_push_error1.phpt
new file mode 100644
index 000000000..1b427ff93
--- /dev/null
+++ b/ext/standard/tests/array/array_push_error1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test array_push() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_push() to test behaviour
+ */
+
+echo "*** Testing array_push() : error conditions ***\n";
+
+// Testing array_push with one less than the expected number of arguments
+echo "\n-- Testing array_push() function with less than expected no. of arguments --\n";
+$stack = array(1, 2);
+var_dump( array_push($stack) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : error conditions ***
+
+-- Testing array_push() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_push() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_error2.phpt b/ext/standard/tests/array/array_push_error2.phpt
new file mode 100644
index 000000000..86f8df78b
--- /dev/null
+++ b/ext/standard/tests/array/array_push_error2.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_push() function : error conditions - min and max int values as keys
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Use PHP's minimum and maximum integer values as array keys
+ * then try and push new elements onto the array
+ */
+
+echo "*** Testing array_push() : error conditions ***\n";
+
+$array = array(-PHP_INT_MAX => 'min', PHP_INT_MAX => 'max');
+
+var_dump(array_push($array, 'new'));
+var_dump($array);
+var_dump(array_push($array, 'var'));
+var_dump($array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_push() : error conditions ***
+int(3)
+array(3) {
+ [-2147483647]=>
+ string(3) "min"
+ [2147483647]=>
+ string(3) "max"
+ [-2147483648]=>
+ string(3) "new"
+}
+
+Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d
+bool(false)
+array(3) {
+ [-2147483647]=>
+ string(3) "min"
+ [2147483647]=>
+ string(3) "max"
+ [-2147483648]=>
+ string(3) "new"
+}
+Done
diff --git a/ext/standard/tests/array/array_push_variation1.phpt b/ext/standard/tests/array/array_push_variation1.phpt
new file mode 100644
index 000000000..c4451d9e4
--- /dev/null
+++ b/ext/standard/tests/array/array_push_variation1.phpt
@@ -0,0 +1,225 @@
+--TEST--
+Test array_push() function : usage variations - Pass different data types as $stack arg
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $stack argument to array_push() to test behaviour
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$var = 'value';
+
+//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 $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_push()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_push($input, $var) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+int(1)
+
+-- Iteration 19 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: array_push(): First argument should be an array in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_variation2.phpt b/ext/standard/tests/array/array_push_variation2.phpt
new file mode 100644
index 000000000..7fefcfa49
--- /dev/null
+++ b/ext/standard/tests/array/array_push_variation2.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test array_push() function : usage variations - Pass different data types as $var arg
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $var argument to array_push to test behaviour
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$stack = array (1, 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 $var argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_push()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $temp_array = $stack;
+ var_dump( array_push($temp_array, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Iteration 1 --
+int(3)
+
+-- Iteration 2 --
+int(3)
+
+-- Iteration 3 --
+int(3)
+
+-- Iteration 4 --
+int(3)
+
+-- Iteration 5 --
+int(3)
+
+-- Iteration 6 --
+int(3)
+
+-- Iteration 7 --
+int(3)
+
+-- Iteration 8 --
+int(3)
+
+-- Iteration 9 --
+int(3)
+
+-- Iteration 10 --
+int(3)
+
+-- Iteration 11 --
+int(3)
+
+-- Iteration 12 --
+int(3)
+
+-- Iteration 13 --
+int(3)
+
+-- Iteration 14 --
+int(3)
+
+-- Iteration 15 --
+int(3)
+
+-- Iteration 16 --
+int(3)
+
+-- Iteration 17 --
+int(3)
+
+-- Iteration 18 --
+int(3)
+
+-- Iteration 19 --
+int(3)
+
+-- Iteration 20 --
+int(3)
+
+-- Iteration 21 --
+int(3)
+
+-- Iteration 22 --
+int(3)
+
+-- Iteration 23 --
+int(3)
+
+-- Iteration 24 --
+int(3)
+
+-- Iteration 25 --
+int(3)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_variation3.phpt b/ext/standard/tests/array/array_push_variation3.phpt
new file mode 100644
index 000000000..2bc71a769
--- /dev/null
+++ b/ext/standard/tests/array/array_push_variation3.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test array_push() function : usage variations - multidimensional arrays
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_push when passed:
+ * 1. an array as $var arg
+ * 2. as sub-array as $stack arg
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+echo "\n-- Pass array as \$var argument --\n";
+$array = array(1, 2, 3);
+$sub_array = array('one', 'two');
+var_dump(array_push($array, $sub_array));
+var_dump($array);
+
+echo "\n-- Pass sub-array as \$stack argument --\n";
+var_dump(array_push($array[3], 'a'));
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Pass array as $var argument --
+int(4)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ }
+}
+
+-- Pass sub-array as $stack argument --
+int(3)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(1) "a"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_push_variation4.phpt b/ext/standard/tests/array/array_push_variation4.phpt
new file mode 100644
index 000000000..1048d80cf
--- /dev/null
+++ b/ext/standard/tests/array/array_push_variation4.phpt
@@ -0,0 +1,134 @@
+--TEST--
+Test array_push() function : usage variations - referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_push when:
+ * 1. passed referenced variables as $var arguments
+ * 2. $var argument is a reference to $stack argument
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+$var1 = 'a';
+$var2 = 'b';
+$var3 = 'c';
+$var4 = 'x';
+$var5 = 'y';
+$var6 = 'z';
+
+$array = array(1, 2, 3);
+
+echo "\n-- Pass array_push referenced varialbes as \$var arguments --\n";
+var_dump(array_push($array, &$var1, &$var2, &$var3, &$var4, &$var5, &$var6));
+var_dump($array);
+
+echo "\n-- Pass \$var argument which is a reference to \$stack argument --\n";
+var_dump(array_push($array, &$array));
+var_dump($array);
+
+/* break cycle */
+$array[9] = null;
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Pass array_push referenced varialbes as $var arguments --
+int(9)
+array(9) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ &string(1) "a"
+ [4]=>
+ &string(1) "b"
+ [5]=>
+ &string(1) "c"
+ [6]=>
+ &string(1) "x"
+ [7]=>
+ &string(1) "y"
+ [8]=>
+ &string(1) "z"
+}
+
+-- Pass $var argument which is a reference to $stack argument --
+int(10)
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ &string(1) "a"
+ [4]=>
+ &string(1) "b"
+ [5]=>
+ &string(1) "c"
+ [6]=>
+ &string(1) "x"
+ [7]=>
+ &string(1) "y"
+ [8]=>
+ &string(1) "z"
+ [9]=>
+ &array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ &string(1) "a"
+ [4]=>
+ &string(1) "b"
+ [5]=>
+ &string(1) "c"
+ [6]=>
+ &string(1) "x"
+ [7]=>
+ &string(1) "y"
+ [8]=>
+ &string(1) "z"
+ [9]=>
+ &array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ &string(1) "a"
+ [4]=>
+ &string(1) "b"
+ [5]=>
+ &string(1) "c"
+ [6]=>
+ &string(1) "x"
+ [7]=>
+ &string(1) "y"
+ [8]=>
+ &string(1) "z"
+ [9]=>
+ *RECURSION*
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_push_variation5.phpt b/ext/standard/tests/array/array_push_variation5.phpt
new file mode 100644
index 000000000..4b6f39975
--- /dev/null
+++ b/ext/standard/tests/array/array_push_variation5.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_push() function : usage variations - position of internal array pointer
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check the position of the internal array pointer after calling array_push()
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+$stack = array ('one' => 'un', 'two' => 'deux');
+$var0 = 'zero';
+
+echo "\n-- Call array_push() --\n";
+var_dump($result = array_push($stack, $var0));
+
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($stack) . " => " . current ($stack) . "\n";
+
+echo "Done";
+?>
+--EXPECTF--
+
+*** Testing array_push() : usage variations ***
+
+-- Call array_push() --
+int(3)
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done
diff --git a/ext/standard/tests/array/array_push_variation6.phpt b/ext/standard/tests/array/array_push_variation6.phpt
new file mode 100644
index 000000000..19afebb74
--- /dev/null
+++ b/ext/standard/tests/array/array_push_variation6.phpt
@@ -0,0 +1,159 @@
+--TEST--
+Test array_push() function : usage variations - array keys are different data types
+--FILE--
+<?php
+/* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
+ * Description: Pushes elements onto the end of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass array_push arrays where the keys are different data types.
+ */
+
+echo "*** Testing array_push() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$var = 'value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays of different data types as keys to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*3*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*4*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*5*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*6*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*8*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*9*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_push()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ echo "Before : ";
+ var_dump(count($input));
+ echo "After : ";
+ var_dump( array_push($input, $var) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_push() : usage variations ***
+
+-- Iteration 1 : int data --
+Before : int(4)
+After : int(5)
+
+-- Iteration 2 : float data --
+Before : int(3)
+After : int(4)
+
+-- Iteration 3 : extreme floats data --
+Before : int(2)
+After : int(3)
+
+-- Iteration 4 : null uppercase data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 5 : null lowercase data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 6 : bool lowercase data --
+Before : int(2)
+After : int(3)
+
+-- Iteration 7 : bool uppercase data --
+Before : int(2)
+After : int(3)
+
+-- Iteration 8 : empty double quotes data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 9 : empty single quotes data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 10 : string data --
+Before : int(3)
+After : int(4)
+
+-- Iteration 11 : undefined data --
+Before : int(1)
+After : int(2)
+
+-- Iteration 12 : unset data --
+Before : int(1)
+After : int(2)
+Done
diff --git a/ext/standard/tests/array/array_reverse_variation5.phpt b/ext/standard/tests/array/array_reverse_variation5.phpt
index 2d22be035..6c4c95224 100644
--- a/ext/standard/tests/array/array_reverse_variation5.phpt
+++ b/ext/standard/tests/array/array_reverse_variation5.phpt
@@ -1,5 +1,7 @@
--TEST--
Test array_reverse() function : usage variations - assoc. array with diff. value for 'array' argument
+--INI--
+precision=12
--FILE--
<?php
/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
@@ -179,7 +181,7 @@ array(1) {
- default argument -
array(4) {
["f4"]=>
- float(33333333.333333)
+ float(33333333.3333)
[0]=>
float(4.8999992284)
["f2"]=>
@@ -190,7 +192,7 @@ array(4) {
- $preserve keys = true -
array(4) {
["f4"]=>
- float(33333333.333333)
+ float(33333333.3333)
[3]=>
float(4.8999992284)
["f2"]=>
@@ -201,7 +203,7 @@ array(4) {
- $preserve_keys = false -
array(4) {
["f4"]=>
- float(33333333.333333)
+ float(33333333.3333)
[0]=>
float(4.8999992284)
["f2"]=>
diff --git a/ext/standard/tests/array/array_shift_basic.phpt b/ext/standard/tests/array/array_shift_basic.phpt
new file mode 100644
index 000000000..2bb4ae93a
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_basic.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test array_shift() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_shift()
+ */
+
+echo "*** Testing array_shift() : basic functionality ***\n";
+
+$array = array('zero', 'one', '3' => 'three', 'four' => 4);
+echo "\n-- Before shift: --\n";
+var_dump($array);
+
+echo "\n-- After shift: --\n";
+echo "Returned value:\t";
+var_dump(array_shift($array));
+echo "New array:\n";
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : basic functionality ***
+
+-- Before shift: --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+
+-- After shift: --
+Returned value: string(4) "zero"
+New array:
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_error.phpt b/ext/standard/tests/array/array_shift_error.phpt
new file mode 100644
index 000000000..bbf62de5b
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_shift() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to array_shift() to test behaviour
+ */
+
+echo "*** Testing array_shift() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_shift() function with Zero arguments --\n";
+var_dump( array_shift() );
+
+//Test array_shift with one more than the expected number of arguments
+echo "\n-- Testing array_shift() function with more than expected no. of arguments --\n";
+$stack = array(1, 2);
+$extra_arg = 10;
+var_dump( array_shift($stack, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : error conditions ***
+
+-- Testing array_shift() function with Zero arguments --
+
+Warning: Wrong parameter count for array_shift() in %s on line %d
+NULL
+
+-- Testing array_shift() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_shift() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation1.phpt b/ext/standard/tests/array/array_shift_variation1.phpt
new file mode 100644
index 000000000..eafe7a90e
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation1.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test array_shift() function : usage variations - Pass different data types as $stack arg
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $stack argument to array_shift() to test behaviour
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+//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 $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of array_shift()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_shift($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_shift(): The 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_shift_variation2.phpt b/ext/standard/tests/array/array_shift_variation2.phpt
new file mode 100644
index 000000000..2b3adc605
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation2.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test array_shift() function : usage variations - Pass arrays of different data types
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where values are of one data type to test behaviour of array_shift()
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+
+//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");
+
+// arrays of different data types to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_shift
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_shift($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+fclose($fp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Iteration 1: int data --
+int(0)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(12345)
+ [2]=>
+ int(-2345)
+}
+
+-- Iteration 2: float data --
+float(10.5)
+array(4) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ float(123456789000)
+ [2]=>
+ float(1.23456789E-9)
+ [3]=>
+ float(0.5)
+}
+
+-- Iteration 3: null data --
+NULL
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 4: bool data --
+bool(true)
+array(3) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+}
+
+-- Iteration 5: empty string data --
+string(0) ""
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 6: empty array data --
+NULL
+array(0) {
+}
+
+-- Iteration 7: string data --
+string(6) "string"
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(11) "hello world"
+}
+
+-- Iteration 8: object data --
+object(classA)#%d (0) {
+}
+array(0) {
+}
+
+-- Iteration 9: undefined data --
+NULL
+array(0) {
+}
+
+-- Iteration 10: unset data --
+NULL
+array(0) {
+}
+
+-- Iteration 11: resource data --
+resource(%d) of type (stream)
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation3.phpt b/ext/standard/tests/array/array_shift_variation3.phpt
new file mode 100644
index 000000000..cc260c630
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation3.phpt
@@ -0,0 +1,188 @@
+--TEST--
+Test array_shift() function : usage variations - Pass array with different data types as keys
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays with different data types as keys to test how array_shift() re-assigns keys
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $stack argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_shift()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ var_dump( array_shift($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Iteration 1 : int data --
+string(4) "zero"
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(8) "positive"
+ [2]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 : float data --
+string(8) "positive"
+array(2) {
+ [0]=>
+ string(8) "negative"
+ [1]=>
+ string(4) "half"
+}
+
+-- Iteration 3 : extreme floats data --
+string(5) "large"
+array(1) {
+ [0]=>
+ string(5) "small"
+}
+
+-- Iteration 4 : null uppercase data --
+string(6) "null 1"
+array(0) {
+}
+
+-- Iteration 5 : null lowercase data --
+string(6) "null 2"
+array(0) {
+}
+
+-- Iteration 6 : bool lowercase data --
+string(6) "lowert"
+array(1) {
+ [0]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7 : bool uppercase data --
+string(6) "uppert"
+array(1) {
+ [0]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8 : empty double quotes data --
+string(6) "emptyd"
+array(0) {
+}
+
+-- Iteration 9 : empty single quotes data --
+string(6) "emptys"
+array(0) {
+}
+
+-- Iteration 10 : string data --
+string(7) "stringd"
+array(2) {
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11 : undefined data --
+string(9) "undefined"
+array(0) {
+}
+
+-- Iteration 12 : unset data --
+string(5) "unset"
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation4.phpt b/ext/standard/tests/array/array_shift_variation4.phpt
new file mode 100644
index 000000000..f27681561
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation4.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test array_shift() function : usage variations - multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test popping elements from a sub-array and popping an array from an array
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+$stack_first = array(array(1, 2, 3), 'one', 'two');
+$stack_last = array ('zero', 'one', array (1, 2, 3));
+echo "\n-- Before shift: --\n";
+echo "---- \$stack_first:\n";
+var_dump($stack_first);
+echo "---- \$stack_last:\n";
+var_dump($stack_last);
+
+echo "\n-- After shift: --\n";
+echo "---- Pop array from array:\n";
+echo "Returned value:\t";
+var_dump(array_shift($stack_first));
+echo "New array:\n";
+var_dump($stack_first);
+
+echo "---- Pop element from array within array:\n";
+echo "Returned value:\t";
+var_dump(array_shift($stack_last[2]));
+echo "New array:\n";
+var_dump($stack_last);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Before shift: --
+---- $stack_first:
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+---- $stack_last:
+array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- After shift: --
+---- Pop array from array:
+Returned value: array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+New array:
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+---- Pop element from array within array:
+Returned value: int(1)
+New array:
+array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation5.phpt b/ext/standard/tests/array/array_shift_variation5.phpt
new file mode 100644
index 000000000..2ac15da6b
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation5.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test array_shift() function : usage variations - call recursively
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Use the result of one call to array_shift
+ * as the the $stack argument of another call to array_shift()
+ * When done in one statement causes strict error messages.
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+$stack = array ( array ( array ('zero', 'one', 'two'), 'un', 'deux'), 'eins', 'zwei');
+
+// not following strict standards
+echo "\n-- Incorrect Method: --\n";
+var_dump(array_shift(array_shift(array_shift($stack))));
+
+$stack = array (array( array('zero', 'one', 'two'), 'un', 'deux'), 'eins', 'zwei');
+// correct way of doing above:
+echo "\n-- Correct Method: --\n";
+$result1 = array_shift($stack);
+$result2 = array_shift($result1);
+var_dump(array_shift($result2));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Incorrect Method: --
+
+Strict Standards: Only variables should be passed by reference in %s on line %d
+
+Strict Standards: Only variables should be passed by reference in %s on line %d
+string(4) "zero"
+
+-- Correct Method: --
+string(4) "zero"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation6.phpt b/ext/standard/tests/array/array_shift_variation6.phpt
new file mode 100644
index 000000000..9033e7d17
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation6.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test array_shift() function : usage variations - Referenced arrays
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how array_shift when passed:
+ * 1. a variable that is referenced to an array
+ * 2. an array that contains a referenced array
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+echo "\n-- Variable is referenced array --\n";
+$original_array = array('zero', 'one', 'two');
+$copied_array = &$original_array;
+
+echo "Result: ";
+var_dump(array_shift($copied_array));
+echo "\n\$original_array:\n";
+var_dump($original_array);
+echo "\n\$copied_array:\n";
+var_dump($copied_array);
+
+echo "\n-- Element is referenced array --\n";
+$new_array = array (&$copied_array, 1, 'two');
+echo "Result: ";
+var_dump(array_shift($new_array[0]));
+echo "\n\$new_array:\n";
+var_dump($new_array);
+echo "\n\$copied_array\n";
+var_dump($copied_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Variable is referenced array --
+Result: string(4) "zero"
+
+$original_array:
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+
+$copied_array:
+array(2) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+}
+
+-- Element is referenced array --
+Result: string(3) "one"
+
+$new_array:
+array(3) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ string(3) "two"
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ string(3) "two"
+}
+
+$copied_array
+array(1) {
+ [0]=>
+ string(3) "two"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation7.phpt b/ext/standard/tests/array/array_shift_variation7.phpt
new file mode 100644
index 000000000..9367cacbc
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation7.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test array_shift() function : usage variations - position of internal pointer
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test that the internal pointer is reset after calling array_shift()
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+$stack = array ('one' => 'un', 'two' => 'deux');
+
+echo "\n-- Call array_shift() --\n";
+var_dump($result = array_shift($stack));
+
+echo "\n-- Position of Internal Pointer in Passed Array: --\n";
+echo key($stack) . " => " . current ($stack) . "\n";
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Call array_shift() --
+string(2) "un"
+
+-- Position of Internal Pointer in Passed Array: --
+two => deux
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shift_variation8.phpt b/ext/standard/tests/array/array_shift_variation8.phpt
new file mode 100644
index 000000000..717d98fad
--- /dev/null
+++ b/ext/standard/tests/array/array_shift_variation8.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test array_shift() function : usage variations - maintaining referenced elements
+--FILE--
+<?php
+/* Prototype : mixed array_shift(array &$stack)
+ * Description: Pops an element off the beginning of the array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * From a comment left by Traps on 09-Jul-2007 on the array_shift documentation page:
+ * For those that may be trying to use array_shift() with an array containing references
+ * (e.g. working with linked node trees), beware that array_shift() may not work as you expect:
+ * it will return a *copy* of the first element of the array,
+ * and not the element itself, so your reference will be lost.
+ * The solution is to reference the first element before removing it with array_shift():
+ */
+
+echo "*** Testing array_shift() : usage variations ***\n";
+
+// using only array_shift:
+echo "\n-- Reference result of array_shift: --\n";
+$a = 1;
+$array = array(&$a);
+$b =& array_shift($array);
+$b = 2;
+echo "a = $a, b = $b\n";
+
+// solution: referencing the first element first:
+echo "\n-- Reference first element before array_shift: --\n";
+$a = 1;
+$array = array(&$a);
+$b =& $array[0];
+array_shift($array);
+$b = 2;
+echo "a = $a, b = $b\n";
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_shift() : usage variations ***
+
+-- Reference result of array_shift: --
+
+Strict Standards: Only variables should be assigned by reference in %s on line %d
+a = 1, b = 2
+
+-- Reference first element before array_shift: --
+a = 2, b = 2
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_shuffle_basic.phpt b/ext/standard/tests/array/array_shuffle_basic.phpt
new file mode 100644
index 000000000..fdf932605
--- /dev/null
+++ b/ext/standard/tests/array/array_shuffle_basic.phpt
@@ -0,0 +1,99 @@
+--TEST--
+array_shuffle(): Test return type and value for expected input
+--FILE--
+<?php
+/*
+* proto bool shuffle ( array &$array )
+* Function is implemented in ext/standard/array.c
+*/
+$numbers = range(1, 20);
+echo "*** testing array_shuffle \n";
+$a = array();
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(1);
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(2 => 1);
+var_dump(shuffle($a));
+var_dump($a);
+$a = array("a" => 1);
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(array(1, 2, 3));
+var_dump(shuffle($a));
+var_dump($a);
+$a = array(1, 1, 1, 1);
+var_dump(shuffle($a));
+var_dump($a);
+$arr1 = array(5 => 1, 6 => 2, 7 => 3, 8 => 9);
+$arr2 = array(5 => 1, 6 => 2, 7 => 3, 8 => 9);
+shuffle($arr1);
+echo "this should be 0->...." . count(array_diff($arr1, $arr2)) . "\n";
+echo "this should be 4->...." . count(array_intersect($arr1, $arr2)) . "\n";
+$bigarray = range(1, 400);
+shuffle($bigarray);
+echo "this should be 400->...." . count($bigarray) . "\n";
+echo "*** testing pass by reference \n";
+$original = $bigarray;
+shuffle($bigarray);
+$diffarray = array_diff_assoc($original, $bigarray);
+if (count($diffarray) < 350) {
+ // with 400 entries, the probability that 50 entries or more get the same
+ // key-> value association should be so close to zero it wont happen in the lifetime of the
+ // universe.
+ echo "shuffled array seems to be similar to original\n";
+ var_dump($original);
+ var_dump($bigarray);
+} else {
+ echo "test passed \n";
+}
+?>
+--EXPECT--
+*** testing array_shuffle
+bool(true)
+array(0) {
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+}
+this should be 0->....0
+this should be 4->....4
+this should be 400->....400
+*** testing pass by reference
+test passed \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_basic.phpt b/ext/standard/tests/array/array_slice_basic.phpt
new file mode 100644
index 000000000..a4cbe4675
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test array_slice() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_slice()
+ */
+
+echo "*** Testing array_slice() : basic functionality ***\n";
+
+
+$input = array('one' => 1, 'two' => 2, 3, 23 => 4);
+$offset = 2;
+$length = 2;
+$preserve_keys = true;
+
+// Calling array_slice() with all possible arguments
+echo "\n-- All arguments --\n";
+var_dump( array_slice($input, $offset, $length, $preserve_keys) );
+
+// Calling array_slice() with mandatory arguments
+echo "\n-- Mandatory arguments --\n";
+var_dump( array_slice($input, $offset) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : basic functionality ***
+
+-- All arguments --
+array(2) {
+ [0]=>
+ int(3)
+ [23]=>
+ int(4)
+}
+
+-- Mandatory arguments --
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_error.phpt b/ext/standard/tests/array/array_slice_error.phpt
new file mode 100644
index 000000000..0e8f1c757
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test array_slice() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : error conditions ***\n";
+
+//Test array_slice with one more than the expected number of arguments
+echo "\n-- Testing array_slice() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$offset = 10;
+$length = 10;
+$preserve_keys = true;
+$extra_arg = 10;
+var_dump( array_slice($input, $offset, $length, $preserve_keys, $extra_arg) );
+
+// Testing array_slice with one less than the expected number of arguments
+echo "\n-- Testing array_slice() function with less than expected no. of arguments --\n";
+var_dump( array_slice($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_slice() : error conditions ***
+
+-- Testing array_slice() function with more than expected no. of arguments --
+
+Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+
+-- Testing array_slice() function with less than expected no. of arguments --
+
+Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt
new file mode 100644
index 000000000..4c7a148c8
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation1.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test array_slice() function : usage variations - Pass different data types as $input arg
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different arguments as $input argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$offset = 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 $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input, $offset) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_slice() expects parameter 1 to be array, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_slice() expects parameter 1 to be array, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_slice() expects parameter 1 to be array, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+array(0) {
+}
+
+-- Iteration 19 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_slice() expects parameter 1 to be array, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_slice() expects parameter 1 to be array, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_slice() expects parameter 1 to be array, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation10.phpt b/ext/standard/tests/array/array_slice_variation10.phpt
new file mode 100644
index 000000000..85c521d6d
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation10.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test array_slice() function : usage variations - position of internal array pointer
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check position of internal array pointer after calling array_slice()
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 23 => 'twenty-three', 'zero');
+
+echo "\n-- Call array_slice() --\n";
+var_dump($result = array_slice($input, 2));
+
+echo "-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Call array_slice() --
+array(2) {
+ [0]=>
+ string(12) "twenty-three"
+ [1]=>
+ string(4) "zero"
+}
+-- Position of Internal Pointer in Result: --
+0 => twenty-three
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt
new file mode 100644
index 000000000..d293ce58d
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation2.phpt
@@ -0,0 +1,309 @@
+--TEST--
+Test array_slice() function : usage variations - Pass different data types as $offset arg
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $offset argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$input_array = array('one' => 1, 2, 'three' => 3, 4);
+
+//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 $offset argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input_array, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 2 --
+array(3) {
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 3 --
+array(0) {
+}
+
+-- Iteration 4 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 5 --
+array(0) {
+}
+
+-- Iteration 6 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 7 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 8 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 9 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 10 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 11 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 12 --
+array(3) {
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 13 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 14 --
+array(3) {
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 15 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 16 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_slice() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_slice() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+
+-- Iteration 23 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation3.phpt b/ext/standard/tests/array/array_slice_variation3.phpt
new file mode 100644
index 000000000..0aafa645e
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation3.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Test array_slice() function : usage variations - Pass different data types as $length arg
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $length argument to array_slice to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$input_array = array('one' => 1, 2, 'three' => 3, 4);
+$offset = 2;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $length argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_slice
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input_array, $offset, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+array(0) {
+}
+
+-- Iteration 2 --
+array(1) {
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 3 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+
+-- Iteration 4 --
+array(0) {
+}
+
+-- Iteration 5 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+
+-- Iteration 6 --
+array(0) {
+}
+
+-- Iteration 7 --
+array(0) {
+}
+
+-- Iteration 8 --
+array(0) {
+}
+
+-- Iteration 9 --
+array(0) {
+}
+
+-- Iteration 10 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+
+-- Iteration 11 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+
+-- Iteration 12 --
+array(1) {
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 13 --
+array(0) {
+}
+
+-- Iteration 14 --
+array(1) {
+ ["three"]=>
+ int(3)
+}
+
+-- Iteration 15 --
+array(0) {
+}
+
+-- Iteration 16 --
+array(0) {
+}
+
+-- Iteration 17 --
+array(0) {
+}
+
+-- Iteration 18 --
+array(0) {
+}
+
+-- Iteration 19 --
+array(0) {
+}
+
+-- Iteration 20 --
+array(0) {
+}
+
+-- Iteration 21 --
+array(0) {
+}
+
+-- Iteration 22 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+
+-- Iteration 23 --
+array(2) {
+ ["three"]=>
+ int(3)
+ [0]=>
+ int(4)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation4.phpt b/ext/standard/tests/array/array_slice_variation4.phpt
new file mode 100644
index 000000000..f093d2db8
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation4.phpt
@@ -0,0 +1,327 @@
+--TEST--
+Test array_slice() function : usage variations - Pass different data types as $preserve_keys arg
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $preserve_keys argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$input_array = array('one' => 1, 2, 99 => 3, 4);
+$offset = 0;
+$length = 3;
+
+//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;
+
+// unexpected values to be passed to $preserve_keys argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_slice($input_array, $offset, $length, $input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 2 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 3 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 4 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 5 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 6 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 7 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 9 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 11 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 12 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 13 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 14 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 15 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 16 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 17 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 18 --
+
+Warning: array_slice() expects parameter 4 to be boolean, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 20 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 21 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [99]=>
+ int(3)
+}
+
+-- Iteration 22 --
+
+Warning: array_slice() expects parameter 4 to be boolean, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- Iteration 24 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation5.phpt b/ext/standard/tests/array/array_slice_variation5.phpt
new file mode 100644
index 000000000..ed5c82f18
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation5.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test array_slice() function : usage variations - Pass different integers as $offset argument
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different integers as $offset argument to test how array_slice() behaves
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10);
+
+for ($i = -7; $i <= 7; $i++) {
+ echo "\n-- \$offset is $i --\n";
+ var_dump(array_slice($input, $i));
+}
+echo "\n-- \$offset is maximum integer value --\n";
+var_dump(array_slice($input, PHP_INT_MAX));
+
+echo "\n-- \$offset is minimum integer value --\n";
+var_dump(array_slice($input, -PHP_INT_MAX));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- $offset is -7 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -6 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -5 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -4 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -3 --
+array(3) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -2 --
+array(2) {
+ [0]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is -1 --
+array(1) {
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 0 --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 1 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 2 --
+array(3) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 3 --
+array(2) {
+ [0]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 4 --
+array(1) {
+ ["ten"]=>
+ int(10)
+}
+
+-- $offset is 5 --
+array(0) {
+}
+
+-- $offset is 6 --
+array(0) {
+}
+
+-- $offset is 7 --
+array(0) {
+}
+
+-- $offset is maximum integer value --
+array(0) {
+}
+
+-- $offset is minimum integer value --
+array(5) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation6.phpt b/ext/standard/tests/array/array_slice_variation6.phpt
new file mode 100644
index 000000000..e210b4dd2
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation6.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test array_slice() function : usage variations - pass different int values as $length arg
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different integer values as $length argument to array_slice() to test behaviour
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10);
+$offset = 1;
+
+for ($i = -6; $i <= 6; $i++) {
+ echo "\n-- \$length is $i --\n";
+ var_dump(array_slice($input, $offset, $i));
+}
+echo "\n-- \$length is maximum integer value --\n";
+var_dump(array_slice($input, $offset, PHP_INT_MAX));
+
+echo "\n-- \$length is minimum integer value --\n";
+var_dump(array_slice($input, $offset, -PHP_INT_MAX));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- $length is -6 --
+array(0) {
+}
+
+-- $length is -5 --
+array(0) {
+}
+
+-- $length is -4 --
+array(0) {
+}
+
+-- $length is -3 --
+array(1) {
+ [0]=>
+ string(3) "two"
+}
+
+-- $length is -2 --
+array(2) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+}
+
+-- $length is -1 --
+array(3) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+}
+
+-- $length is 0 --
+array(0) {
+}
+
+-- $length is 1 --
+array(1) {
+ [0]=>
+ string(3) "two"
+}
+
+-- $length is 2 --
+array(2) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+}
+
+-- $length is 3 --
+array(3) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+}
+
+-- $length is 4 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is 5 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is 6 --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is maximum integer value --
+array(4) {
+ [0]=>
+ string(3) "two"
+ [1]=>
+ string(5) "three"
+ [2]=>
+ string(4) "nine"
+ ["ten"]=>
+ int(10)
+}
+
+-- $length is minimum integer value --
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation7.phpt b/ext/standard/tests/array/array_slice_variation7.phpt
new file mode 100644
index 000000000..abf517d1f
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation7.phpt
@@ -0,0 +1,300 @@
+--TEST--
+Test array_slice() function : usage variations - different data types as keys in an array
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as keys in an array to array_slice()
+ * to test how $preserve_keys treats them
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$offset = 0;
+$length = 10; // to ensure all elements are displayed
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays of different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_slice()
+$iterator = 1;
+foreach($inputs as $type => $input) {
+ echo "\n-- Iteration $iterator : key type is $type --\n";
+ echo "\$preserve_keys = TRUE\n";
+ var_dump( array_slice($input, $offset, $length, true) );
+ echo "\$preserve_keys = FALSE\n";
+ var_dump( array_slice($input, $offset, $length, false) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Iteration 1 : key type is int --
+$preserve_keys = TRUE
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [-2345]=>
+ string(8) "negative"
+}
+$preserve_keys = FALSE
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+}
+
+-- Iteration 2 : key type is float --
+$preserve_keys = TRUE
+array(3) {
+ [10]=>
+ string(8) "positive"
+ [-10]=>
+ string(8) "negative"
+ [0]=>
+ string(4) "half"
+}
+$preserve_keys = FALSE
+array(3) {
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+}
+
+-- Iteration 3 : key type is extreme floats --
+$preserve_keys = TRUE
+array(2) {
+ [12345678]=>
+ string(5) "large"
+ [0]=>
+ string(5) "small"
+}
+$preserve_keys = FALSE
+array(2) {
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+}
+
+-- Iteration 4 : key type is null uppercase --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5 : key type is null lowercase --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6 : key type is bool lowercase --
+$preserve_keys = TRUE
+array(2) {
+ [1]=>
+ string(6) "lowert"
+ [0]=>
+ string(6) "lowerf"
+}
+$preserve_keys = FALSE
+array(2) {
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7 : key type is bool uppercase --
+$preserve_keys = TRUE
+array(2) {
+ [1]=>
+ string(6) "uppert"
+ [0]=>
+ string(6) "upperf"
+}
+$preserve_keys = FALSE
+array(2) {
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8 : key type is empty double quotes --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9 : key type is empty single quotes --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10 : key type is string --
+$preserve_keys = TRUE
+array(3) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+$preserve_keys = FALSE
+array(3) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["strings"]=>
+ string(7) "strings"
+ ["hello world"]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11 : key type is undefined --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12 : key type is unset --
+$preserve_keys = TRUE
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+$preserve_keys = FALSE
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation8.phpt b/ext/standard/tests/array/array_slice_variation8.phpt
new file mode 100644
index 000000000..aece410c0
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation8.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test array_slice() function : usage variations - multidimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_slice when passed
+ * 1. a two-dimensional array as $input argument
+ * 2. a sub-array as $input argument
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$input = array ('zero', 'one', array('zero', 'un', 'deux'), 9 => 'nine');
+
+echo "\n-- Slice a two-dimensional array --\n";
+var_dump(array_slice($input, 1, 3));
+
+echo "\n-- \$input is a sub-array --\n";
+var_dump(array_slice($input[2], 1, 2));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Slice a two-dimensional array --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(2) "un"
+ [2]=>
+ string(4) "deux"
+ }
+ [2]=>
+ string(4) "nine"
+}
+
+-- $input is a sub-array --
+array(2) {
+ [0]=>
+ string(2) "un"
+ [1]=>
+ string(4) "deux"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_slice_variation9.phpt b/ext/standard/tests/array/array_slice_variation9.phpt
new file mode 100644
index 000000000..030d4bd73
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation9.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test array_slice() function : usage variations - referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_slice() when:
+ * 1. Passed an array of referenced variables
+ * 2. $input argument is passed by reference
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+$val1 = 'one';
+$val2 = 'two';
+$val3 = 'three';
+
+echo "\n-- Array of referenced variables (\$preserve_keys = default) --\n";
+$input = array(3 => &$val1, 2 => &$val2, 1 => &$val3);
+var_dump(array_slice($input, 1, 2));
+
+echo "-- Change \$val2 (\$preserve_keys = TRUE) --\n";
+$val2 = 'hello, world';
+var_dump(array_slice($input, 1, 2, true));
+
+echo "\n-- Pass array by reference --\n";
+$new_input = array (1, 2, 3);
+var_dump(array_slice(&$new_input, 1));
+echo "-- Check passed array: --\n";
+var_dump($new_input);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_slice() : usage variations ***
+
+-- Array of referenced variables ($preserve_keys = default) --
+array(2) {
+ [0]=>
+ &string(3) "two"
+ [1]=>
+ &string(5) "three"
+}
+-- Change $val2 ($preserve_keys = TRUE) --
+array(2) {
+ [2]=>
+ &string(12) "hello, world"
+ [1]=>
+ &string(5) "three"
+}
+
+-- Pass array by reference --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+-- Check passed array: --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_sum_basic.phpt b/ext/standard/tests/array/array_sum_basic.phpt
new file mode 100644
index 000000000..c178853d7
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test array_sum() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array &input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_sum() : basic functionality ***\n";
+
+// array with integer values
+$input = array(1, 2, 3, 4, 5);
+echo "-- array_sum() with integer array entries --\n";
+var_dump( array_sum($input) );
+
+// array with float values
+$input = array(1.0, 2.2, 3.4, 4.6);
+echo "-- array_sum() with float array entries --\n";
+var_dump( array_sum($input) );
+
+// array with integer and float values
+$input = array(1, 2.3, 4, 0.6, 10);
+echo "-- array_sum() with integer/float array entries --\n";
+var_dump( array_sum($input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : basic functionality ***
+-- array_sum() with integer array entries --
+int(15)
+-- array_sum() with float array entries --
+float(11.2)
+-- array_sum() with integer/float array entries --
+float(17.9)
+Done
diff --git a/ext/standard/tests/array/array_sum_error.phpt b/ext/standard/tests/array/array_sum_error.phpt
new file mode 100644
index 000000000..ffa7e5b6d
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test array_sum() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array &input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_sum() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing array_sum() function with zero arguments --\n";
+var_dump( array_sum() );
+
+// One more than the expected number of arguments
+echo "-- Testing array_sum() function with more than expected no. of arguments --\n";
+$input = array(1, 2, 3, 4);
+$extra_arg = 10;
+var_dump( array_sum($input, $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : error conditions ***
+-- Testing array_sum() function with zero arguments --
+
+Warning: Wrong parameter count for array_sum() in %s on line %d
+NULL
+-- Testing array_sum() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_sum() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_sum_variation1.phpt b/ext/standard/tests/array/array_sum_variation1.phpt
new file mode 100644
index 000000000..df6238670
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_variation1.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test array_sum() function : usage variations - unexpected values for 'input' argument
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different scalar/nonscalar values as 'input' argument to array_sum()
+*/
+
+echo "*** Testing array_sum() : unexpected values for 'input' ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// Class definition
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+// different scalar/non scalar values for 'input' argument
+$input_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .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
+/*21*/ $fp = fopen(__FILE__,'r'),
+
+ // undefined data
+/*22*/ @$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_sum($input_values[$count]) );
+};
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : unexpected values for 'input' ***
+-- Iteration 1 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: array_sum(): The argument should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_sum_variation2.phpt b/ext/standard/tests/array/array_sum_variation2.phpt
new file mode 100644
index 000000000..a697a15fc
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_variation2.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test array_sum() function : usage variations - array with different integer value
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array &input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with different types of integer arrays containing data of following type:
+* integer, octal, hexadecimal, maximum and minimum integer values & mixed of all integers
+*/
+
+echo "*** Testing array_sum() : different integer array ***\n";
+
+// Int array
+$int_values = array(3, 2, 100, 150, 25, 350, 0, -3, -1200);
+echo "-- Sum of Integer array --\n";
+var_dump( array_sum($int_values) );
+
+// Octal array
+$octal_values = array(056, 023, 090, 015, -045, 01, -078);
+echo "-- Sum of Octal array --\n";
+var_dump( array_sum($octal_values) );
+
+// Hexadecimal array
+$hex_values = array(0xAE, 0x2B, 0X10, -0xCF, 0X12, -0XF2);
+echo "-- Sum of Hex array --\n";
+var_dump( array_sum($hex_values) );
+
+// Mixed values int, octal & hex
+$mixed_int_value = array(2, 5, -1, 054, 0X3E, 0, -014, -0x2A);
+echo "-- Sum of mixed integer values --\n";
+var_dump( array_sum($mixed_int_value) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : different integer array ***
+-- Sum of Integer array --
+int(-573)
+-- Sum of Octal array --
+int(35)
+-- Sum of Hex array --
+int(-198)
+-- Sum of mixed integer values --
+int(58)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation3.phpt b/ext/standard/tests/array/array_sum_variation3.phpt
new file mode 100644
index 000000000..9d32c2c38
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_variation3.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test array_sum() function : usage variations - array with different float values
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * sum of array containing different float values
+*/
+
+echo "*** Testing array_sum() : array with different float values ***\n";
+
+// Simple float array
+$float_input = array( 1.1, 2.3, 0.0, 0.5, -2.3, -0.8, .5);
+echo "-- simple float array --\n";
+var_dump( array_sum($float_input) );
+
+// float array with scientific notations
+$float_input = array( 1.2e2, 23.4e3, -4.1e2, 0.2e2, 2.1e-2, .5e3);
+echo "-- float array with scientific notations e and E --\n";
+var_dump( array_sum($float_input) );
+$float_input = array( 1.2E2, 23.4E3, -4.1E2, 0.2E2, 2.1E-2, .5E3);
+var_dump( array_sum($float_input) );
+
+// Mixed float array
+$float_input = array(
+ 1.2,
+ 0.5
+ -5.8,
+ 6.334,
+ -0.65,
+ 1.2e3,
+ -2.3e2,
+ 5.56E3,
+ -3.82E-2
+);
+echo "-- Mixed float array --\n";
+var_dump( array_sum($float_input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with different float values ***
+-- simple float array --
+float(1.3)
+-- float array with scientific notations e and E --
+float(23630.021)
+float(23630.021)
+-- Mixed float array --
+float(6531.5458)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation4.phpt b/ext/standard/tests/array/array_sum_variation4.phpt
new file mode 100644
index 000000000..4959deee7
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_variation4.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test array_sum() function : usage variations - array with duplicate values
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Checking array_sum() with integer and float array containing duplicate values
+*/
+
+echo "*** Testing array_sum() : array with duplicate values ***\n";
+
+// integer array with duplicate values
+$int_input = array( 2, 5, 7, 5, 0, -4, 2, 100);
+echo "-- With integer array --\n";
+var_dump( array_sum($int_input) );
+
+// float array with duplicate values
+$float_input = array( 2.3, 1.9, -4.1, 0.5, 1.9, -4.1, 3.6, 0.5);
+echo "-- With float array --\n";
+var_dump( array_sum($float_input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with duplicate values ***
+-- With integer array --
+int(117)
+-- With float array --
+float(2.5)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation5.phpt b/ext/standard/tests/array/array_sum_variation5.phpt
new file mode 100644
index 000000000..9068c4565
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_variation5.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test array_sum() function : usage variations - array with reference variables as elements
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with 'input' having reference variables as elements
+*/
+
+echo "*** Testing array_sum() : array with elements as reference ***\n";
+
+$value1 = -5;
+$value2 = 100;
+$value3 = 0;
+$value4 = &$value1;
+
+// input array containing elements as reference variables
+$input = array(
+ 0 => 10,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => 200,
+ 4 => &$value3,
+);
+
+var_dump( array_sum($input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with elements as reference ***
+int(305)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation6.phpt b/ext/standard/tests/array/array_sum_variation6.phpt
new file mode 100644
index 000000000..ba67cfd49
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_variation6.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test array_sum() function : usage variations - associative array
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with associative array as 'input' argument
+*/
+
+echo "*** Testing array_sum() : with associative array ***\n";
+
+// array with numeric keys
+$input = array(0 => 1, 1 => 10, 2 => 0, 3 => -2, 4 => 23.56);
+echo "-- with numeric keys --\n";
+var_dump( array_sum($input) );
+
+// array with string keys
+$input = array('a' => 20, "b" => 50, 'c' => 0, 'd' => -30, "e" => 100);
+echo "-- with string keys --\n";
+var_dump( array_sum($input) );
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : with associative array ***
+-- with numeric keys --
+float(32.56)
+-- with string keys --
+int(140)
+Done
diff --git a/ext/standard/tests/array/array_sum_variation7.phpt b/ext/standard/tests/array/array_sum_variation7.phpt
new file mode 100644
index 000000000..d30987535
--- /dev/null
+++ b/ext/standard/tests/array/array_sum_variation7.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test array_sum() function : usage variations - 'input' array with unexpected values as array element
+--FILE--
+<?php
+/* Prototype : mixed array_sum(array $input)
+ * Description: Returns the sum of the array entries
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_sum() with array having other than numeric entries
+* strings, bool, null, subarrays & objects
+*/
+
+echo "*** Testing array_sum() : array with unexpected entries ***\n";
+
+// empty array
+$input = array();
+echo "-- empty array --\n";
+var_dump( array_sum($input) );
+
+// string array
+$input = array('Apple', 'Banana', 'Carrot', 'Mango', 'Orange');
+echo "-- array with string values --\n";
+var_dump( array_sum($input) );
+
+// bool array
+$input = array( true, true, false, true, false);
+echo "-- array with bool values --\n";
+var_dump( array_sum($input) );
+
+// array with null entry
+$input = array(null, NULL);
+echo "-- array with null values --\n";
+var_dump( array_sum($input) );
+
+// array with subarray
+$input = array(
+ array(1, 2),
+ array(),
+ array(0)
+);
+echo "-- array with subarrays --\n";
+var_dump( array_sum($input) );
+
+class MyClass
+{
+ public $value;
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+}
+// array of objects
+$input = array(
+ new MyClass(2),
+ new MyClass(5),
+ new MyClass(10),
+ new MyClass(0)
+);
+echo "-- array with object values --\n";
+var_dump( array_sum($input) );
+
+// Mixed values
+$input = array( 5, -8, 7.2, -1.2, "10", "apple", 'Mango', true, false, null, NULL, array( array(1,2), array(0), array()));
+echo "-- array with mixed values --\n";
+var_dump( array_sum($input) );
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_sum() : array with unexpected entries ***
+-- empty array --
+int(0)
+-- array with string values --
+int(0)
+-- array with bool values --
+int(3)
+-- array with null values --
+int(0)
+-- array with subarrays --
+int(0)
+-- array with object values --
+int(0)
+-- array with mixed values --
+float(14)
+Done
diff --git a/ext/standard/tests/array/array_udiff_assoc_basic.phpt b/ext/standard/tests/array/array_udiff_assoc_basic.phpt
new file mode 100644
index 000000000..9670eef5d
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_assoc_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+array_udiff_assoc(): Test return type and value for expected input
+--FILE--
+<?php
+/*
+* proto array array_udiff_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(3) {
+ ["0.1"]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(9)
+ }
+ ["0.5"]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(12)
+ }
+ [0]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(23)
+ }
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_udiff_basic.phpt b/ext/standard/tests/array/array_udiff_basic.phpt
new file mode 100644
index 000000000..636e3abf3
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+array_udiff():Test return type and value for expected input
+--FILE--
+<?php
+/*
+* proto array array_udiff ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_udiff($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(2) {
+ ["0.5"]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(12)
+ }
+ [0]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(23)
+ }
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_udiff_uassoc_basic.phpt b/ext/standard/tests/array/array_udiff_uassoc_basic.phpt
new file mode 100644
index 000000000..0e6d6154d
--- /dev/null
+++ b/ext/standard/tests/array/array_udiff_uassoc_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+array_udiff_uassoc(): Test return type and value for expected input
+--FILE--
+<?php
+/*
+* proto array array_udiff_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+ static function comp_func_key($a, $b) {
+ if ($a === $b) return 0;
+ return ($a > $b) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
+var_dump($result);
+?>
+--EXPECTF--
+array(3) {
+ ["0.1"]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(9)
+ }
+ ["0.5"]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(12)
+ }
+ [0]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(23)
+ }
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_uintersect_assoc_basic.phpt b/ext/standard/tests/array/array_uintersect_assoc_basic.phpt
new file mode 100644
index 000000000..644109ab6
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_assoc_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+array_uintersect_assoc(): Test return type and value for expected input
+--FILE--
+<?php
+/*
+* proto array array_uintersect_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_uintersect_assoc($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(2) {
+ [1]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(4)
+ }
+ [2]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(-15)
+ }
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_uintersect_basic.phpt b/ext/standard/tests/array/array_uintersect_basic.phpt
new file mode 100644
index 000000000..1c80a959b
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+array_uintersect(): Test return type and value for expected input
+--FILE--
+<?php
+/*
+* proto array array_uintersect ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_uintersect($a, $b, array("cr", "comp_func_cr"));
+var_dump($result);
+?>
+--EXPECTF--
+array(3) {
+ ["0.1"]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(9)
+ }
+ [1]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(4)
+ }
+ [2]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(-15)
+ }
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_basic.phpt b/ext/standard/tests/array/array_uintersect_uassoc_basic.phpt
new file mode 100644
index 000000000..a0bd055e8
--- /dev/null
+++ b/ext/standard/tests/array/array_uintersect_uassoc_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+array_uintersect_uassoc(): Test return type and value for expected input
+--FILE--
+<?php
+/*
+* proto array array_uintersect_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
+* Function is implemented in ext/standard/array.c
+*/
+class cr {
+ private $priv_member;
+ function cr($val) {
+ $this->priv_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member) ? 1 : -1;
+ }
+ static function comp_func_key($a, $b) {
+ if ($a === $b) return 0;
+ return ($a > $b) ? 1 : -1;
+ }
+}
+$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
+$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
+$result = array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
+var_dump($result);
+?>
+--EXPECTF--
+array(2) {
+ [1]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(4)
+ }
+ [2]=>
+ object(cr)#%d (1) {
+ ["priv_member:private"]=>
+ int(-15)
+ }
+} \ No newline at end of file
diff --git a/ext/standard/tests/array/array_unique_basic.phpt b/ext/standard/tests/array/array_unique_basic.phpt
new file mode 100644
index 000000000..58d3acf1b
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_basic.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test array_unique() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_unique() : basic functionality ***\n";
+
+// array with default keys
+$input = array(1, 2, "1", '2');
+var_dump( array_unique($input) );
+
+// associative array
+$input = array("1" => "one", 1 => "one", 2 => "two", '2' => "two");
+var_dump( array_unique($input) );
+
+// mixed array
+$input = array("1" => "one", "two", "one", 2 => "two", "three");
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : basic functionality ***
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(5) "three"
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_error.phpt b/ext/standard/tests/array/array_unique_error.phpt
new file mode 100644
index 000000000..59d458a2a
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_unique() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_unique() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_unique() function with zero arguments --\n";
+var_dump( array_unique() );
+
+//Test array_unique with one more than the expected number of arguments
+echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$extra_arg = 10;
+var_dump( array_unique($input, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : error conditions ***
+
+-- Testing array_unique() function with zero arguments --
+
+Warning: Wrong parameter count for array_unique() in %s on line %d
+NULL
+
+-- Testing array_unique() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_unique() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_unique_variation1.phpt b/ext/standard/tests/array/array_unique_variation1.phpt
new file mode 100644
index 000000000..3a9ae10dd
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation1.phpt
@@ -0,0 +1,194 @@
+--TEST--
+Test array_unique() function : usage variations - unexpected values for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing non array values to 'input' argument of array_unique() and see
+ * that the function outputs proper warning messages wherever expected.
+*/
+
+echo "*** Testing array_unique() : Passing non array values to \$input argument ***\n";
+
+//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 $input argument
+$inputs = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs and check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_unique($input) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : Passing non array values to $input argument ***
+-- Iteration 1 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 21 --
+array(0) {
+}
+-- Iteration 22 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: array_unique(): The argument should be an array in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_unique_variation2.phpt b/ext/standard/tests/array/array_unique_variation2.phpt
new file mode 100644
index 000000000..5cdb43a8e
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation2.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test array_unique() function : usage variations - different arrays for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different arrays to $input argument and testing whether
+* array_unique() behaves in an expected way.
+*/
+
+echo "*** Testing array_unique() : Passing different arrays to \$input argument ***\n";
+
+/* Different heredoc strings passed as argument to arrays */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world
+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 passed to $input argument
+$inputs = array (
+/*1*/ array(1, 2, 2, 1), // with default keys and numeric values
+ array(1.1, 2.2, 1.1), // with default keys & float values
+ array(false, true, false), // with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL, null), // with NULL
+ array("a\v\f", "aaaa\r", "b", "aaaa\r", "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings
+ array('a\v\f', 'aaaa\r', 'b', 'aaaa\r', '\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings
+ array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $blank_line), // with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two", 2 => "two"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "1" => 1 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 5 => 10), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "10" => "ten"), // 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),
+/*18*/ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_unique($input) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : Passing different arrays to $input argument ***
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iteration 4 --
+array(0) {
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(3) "a "
+ [1]=>
+ string(5) "aaaa "
+ [2]=>
+ string(1) "b"
+ [4]=>
+ string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ string(5) "a\v\f"
+ [1]=>
+ string(6) "aaaa\r"
+ [2]=>
+ string(1) "b"
+ [4]=>
+ string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+}
+-- Iteration 8 --
+array(3) {
+ ["h1"]=>
+ string(1) "
+"
+ ["h2"]=>
+ string(88) "hello world
+The quick brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["h3"]=>
+ string(87) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+-- Iteration 9 --
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+-- Iteration 10 --
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+-- Iteration 11 --
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(20)
+ [4]=>
+ int(40)
+}
+-- Iteration 12 --
+array(2) {
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+}
+-- Iteration 13 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 14 --
+array(2) {
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+}
+-- Iteration 15 --
+array(4) {
+ [1]=>
+ string(4) "true"
+ [0]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- Iteration 16 --
+array(2) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+}
+-- Iteration 17 --
+array(2) {
+ [1]=>
+ string(0) ""
+ [6]=>
+ bool(true)
+}
+-- Iteration 18 --
+array(3) {
+ [""]=>
+ int(4)
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt
new file mode 100644
index 000000000..49103c815
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation3.phpt
@@ -0,0 +1,134 @@
+--TEST--
+Test array_unique() function : usage variations - associative array with different keys
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing different
+ * associative arrays having different keys to $input argument.
+*/
+
+echo "*** Testing array_unique() : assoc. array with diff. keys passed to \$input 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 associative arrays to be passed to $input argument
+$inputs = array (
+/*1*/ // arrays with integer keys
+ array(0 => "0", 1 => "0"),
+ array(1 => "1", 2 => "2", 3 => 1, 4 => "4"),
+
+ // arrays with float keys
+/*3*/ array(2.3333 => "float", 44.44 => "float"),
+ array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f1", 3333333.333333 => "f4"),
+
+ // arrays with string keys
+/*5*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 111),
+ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 111),
+ array("hello", $heredoc => "string", "string"),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource', 11, "hello"),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_unique($input) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : assoc. array with diff. keys passed to $input argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 2 --
+array(3) {
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+ [4]=>
+ string(1) "4"
+}
+-- Iteration 3 --
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+-- Iteration 4 --
+array(3) {
+ [1]=>
+ string(2) "f1"
+ [3]=>
+ string(2) "f2"
+ [3333333]=>
+ string(2) "f4"
+}
+-- Iteration 5 --
+array(3) {
+ ["\tHello"]=>
+ int(111)
+ ["re\td"]=>
+ string(5) "color"
+ ["\v\fworld"]=>
+ float(2.2)
+}
+-- Iteration 6 --
+array(3) {
+ [" Hello"]=>
+ int(111)
+ ["re d"]=>
+ string(5) "color"
+ [" world"]=>
+ float(2.2)
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(6) "string"
+}
+-- Iteration 8 --
+array(2) {
+ [""]=>
+ string(5) "hello"
+ [0]=>
+ int(11)
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation4.phpt b/ext/standard/tests/array/array_unique_variation4.phpt
new file mode 100644
index 000000000..a1fc13e94
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation4.phpt
@@ -0,0 +1,131 @@
+--TEST--
+Test array_unique() function : usage variations - associative array with different values
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing different
+ * associative arrays having different values to $input argument.
+*/
+
+echo "*** Testing array_unique() : assoc. array with diff. values to \$input 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;
+
+// associative arrays with different values
+$inputs = array (
+ // arrays with integer values
+/*1*/ array('0' => 0, '1' => 0),
+ array("one" => 1, 'two' => 2, "three" => 1, 4 => 1),
+
+ // arrays with float values
+/*3*/ array("float1" => 2.3333, "float2" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2),
+
+ // arrays with string values
+/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'),
+ array(1 => "hello", "heredoc" => $heredoc, $heredoc),
+
+ // array with object, unset variable and resource variable
+/*8*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp, new classA(), $fp),
+);
+
+// loop through each sub-array of $inputs to check the behavior of array_unique()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_unique($input) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : assoc. array with diff. values to $input argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 2 --
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+-- Iteration 3 --
+array(1) {
+ ["float1"]=>
+ float(2.3333)
+}
+-- Iteration 4 --
+array(3) {
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [3]=>
+ float(4.8999992284)
+}
+-- Iteration 5 --
+array(3) {
+ [111]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(7) " world"
+}
+-- Iteration 6 --
+array(3) {
+ [111]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(9) "\v\fworld"
+}
+-- Iteration 7 --
+array(2) {
+ [1]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iteration 8 --
+array(3) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation5.phpt b/ext/standard/tests/array/array_unique_variation5.phpt
new file mode 100644
index 000000000..5e3f7c36d
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation5.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test array_unique() function : usage variations - array with duplicate keys
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing
+ * array having duplicate keys as values.
+*/
+
+echo "*** Testing array_unique() : array with duplicate keys for \$input argument ***\n";
+
+// initialize the array having duplicate keys
+$input = array( 1 => "one", 2 => "two", 2 => "2", 3 => "three", 1 => "1", "1", "2");
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : array with duplicate keys for $input argument ***
+array(3) {
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(5) "three"
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation6.phpt b/ext/standard/tests/array/array_unique_variation6.phpt
new file mode 100644
index 000000000..fd8b226fa
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation6.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test array_unique() function : usage variations - array with reference variables
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing
+ * array having reference variables as values.
+*/
+
+echo "*** Testing array_unique() : array with reference variables for \$input argument ***\n";
+
+$value1 = 10;
+$value2 = "hello";
+$value3 = 0;
+$value4 = &$value2;
+
+// input array containing elements as reference variables
+$input = array(
+ 0 => 0,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => "hello",
+ 4 => &$value3,
+ 5 => $value4
+);
+
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : array with reference variables for $input argument ***
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ &string(5) "hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation7.phpt b/ext/standard/tests/array/array_unique_variation7.phpt
new file mode 100644
index 000000000..e998a73c6
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation7.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test array_unique() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing an array having binary values.
+*/
+
+echo "*** Testing array_unique() : array with binary data for \$input argument ***\n";
+
+// array with binary values
+$input = array( b"1", b"hello", "world", "str1" => "hello", "str2" => "world");
+
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : array with binary data for $input argument ***
+array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_unique_variation8.phpt b/ext/standard/tests/array/array_unique_variation8.phpt
new file mode 100644
index 000000000..ae6e8bb5c
--- /dev/null
+++ b/ext/standard/tests/array/array_unique_variation8.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test array_unique() function : usage variations - two dimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_unique(array $input)
+ * Description: Removes duplicate values from array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unique() by passing
+ * two dimensional arrays for $input argument.
+*/
+
+echo "*** Testing array_unique() : two dimensional array for \$input argument ***\n";
+
+// initialize the 2-d array
+$input = array(
+ array(1, 2, 3, 1),
+ array("hello", "world", "str1" => "hello", "str2" => 'world'),
+ array(1 => "one", 2 => "two", "one", 'two'),
+ array(1, 2, 3, 1)
+);
+
+var_dump( array_unique($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unique() : two dimensional array for $input argument ***
+array(1) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(1)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation5.phpt b/ext/standard/tests/array/array_unshift_variation5.phpt
index ff6bf28f8..7f083694a 100644
--- a/ext/standard/tests/array/array_unshift_variation5.phpt
+++ b/ext/standard/tests/array/array_unshift_variation5.phpt
@@ -1,5 +1,7 @@
--TEST--
Test array_unshift() function : usage variations - assoc. array with diff values for 'array' argument
+--INI--
+precision=12
--FILE--
<?php
/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
@@ -209,7 +211,7 @@ array(5) {
[1]=>
float(4.8999992284)
["f4"]=>
- float(33333333.333333)
+ float(33333333.3333)
}
int(7)
array(7) {
@@ -226,7 +228,7 @@ array(7) {
[3]=>
float(4.8999992284)
["f4"]=>
- float(33333333.333333)
+ float(33333333.3333)
}
-- Iteration 7 --
int(5)
diff --git a/ext/standard/tests/array/array_values_basic.phpt b/ext/standard/tests/array/array_values_basic.phpt
new file mode 100644
index 000000000..9cbdf07b8
--- /dev/null
+++ b/ext/standard/tests/array/array_values_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_values() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_values()
+ */
+
+echo "*** Testing array_values() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$input = array('zero', 'one', 'two', 'three' => 3, 10 => 'ten');
+
+// Calling array_values() with all possible arguments
+var_dump( array_values($input) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : basic functionality ***
+array(5) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(3)
+ [4]=>
+ string(3) "ten"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_variation1.phpt b/ext/standard/tests/array/array_values_variation1.phpt
new file mode 100644
index 000000000..efe08c72b
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation1.phpt
@@ -0,0 +1,224 @@
+--TEST--
+Test array_values() function : usage variations - Pass different data types as $input arg
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $input argument to array_values() to test behaviour
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+//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 $input argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of array_values()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( array_values($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+array(0) {
+}
+
+-- Iteration 19 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: array_values(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: array_values(): The 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_values_variation2.phpt b/ext/standard/tests/array/array_values_variation2.phpt
new file mode 100644
index 000000000..c7e9ad3f7
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation2.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test array_values() function : usage variations - arrays of different data types
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of different data types as $input argument to array_values() to test behaviour
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+//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");
+
+// arrays of different data types to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_values()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_values($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+ [3]=>
+ int(-2345)
+}
+
+-- Iteration 2: float data --
+array(5) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(-10.5)
+ [2]=>
+ float(123456789000)
+ [3]=>
+ float(1.23456789E-9)
+ [4]=>
+ float(0.5)
+}
+
+-- Iteration 3: null data --
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+
+-- Iteration 4: bool data --
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+
+-- Iteration 5: empty string data --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+
+-- Iteration 6: empty array data --
+array(0) {
+}
+
+-- Iteration 7: string data --
+array(3) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "string"
+ [2]=>
+ string(11) "hello world"
+}
+
+-- Iteration 8: object data --
+array(1) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9: undefined data --
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 10: unset data --
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 11: resource data --
+array(1) {
+ [0]=>
+ resource(%d) of type (stream)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_variation3.phpt b/ext/standard/tests/array/array_values_variation3.phpt
new file mode 100644
index 000000000..5c74c0d47
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation3.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Test array_values() function : usage variations - array keys different data types
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where the keys are different data types as $input argument
+ * to array_values() to test behaviour
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed as $input
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e10 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of array_values()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( array_values($input) );
+ $iterator++;
+};
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(8) "positive"
+ [3]=>
+ string(8) "negative"
+}
+
+-- Iteration 2: float data --
+array(3) {
+ [0]=>
+ string(8) "positive"
+ [1]=>
+ string(8) "negative"
+ [2]=>
+ string(4) "half"
+}
+
+-- Iteration 3: extreme floats data --
+array(2) {
+ [0]=>
+ string(5) "large"
+ [1]=>
+ string(5) "small"
+}
+
+-- Iteration 4: null uppercase data --
+array(1) {
+ [0]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5: null lowercase data --
+array(1) {
+ [0]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6: bool lowercase data --
+array(2) {
+ [0]=>
+ string(6) "lowert"
+ [1]=>
+ string(6) "lowerf"
+}
+
+-- Iteration 7: bool uppercase data --
+array(2) {
+ [0]=>
+ string(6) "uppert"
+ [1]=>
+ string(6) "upperf"
+}
+
+-- Iteration 8: empty double quotes data --
+array(1) {
+ [0]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9: empty single quotes data --
+array(1) {
+ [0]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10: string data --
+array(3) {
+ [0]=>
+ string(7) "stringd"
+ [1]=>
+ string(7) "strings"
+ [2]=>
+ string(7) "stringh"
+}
+
+-- Iteration 11: undefined data --
+array(1) {
+ [0]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12: unset data --
+array(1) {
+ [0]=>
+ string(5) "unset"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_variation4.phpt b/ext/standard/tests/array/array_values_variation4.phpt
new file mode 100644
index 000000000..199d23dc9
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation4.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test array_values() function : usage variations - multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_values when:
+ * 1. Passed a two-dimensional array as $input argument
+ * 2. Passed a sub-array as $input argument
+ * 3. Passed an infinitely recursive multi-dimensional array
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+$input = array ('zero' => 'zero', 'un' => 'one', 'sub' => array (1, 2, 3));
+
+echo "\n-- Array values of a two-dimensional array --\n";
+var_dump(array_values($input));
+
+echo "\n-- Array values of a sub-array --\n";
+var_dump(array_values($input['sub']));
+
+// get an infinitely recursive array
+$input[] = &$input;
+echo "\n-- Array values of an infinitely recursive array --\n";
+var_dump(array_values($input));
+
+// break cycle
+$input[0] = null;
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Array values of a two-dimensional array --
+array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+-- Array values of a sub-array --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+
+-- Array values of an infinitely recursive array --
+array(4) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [3]=>
+ &array(4) {
+ ["zero"]=>
+ string(4) "zero"
+ ["un"]=>
+ string(3) "one"
+ ["sub"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [0]=>
+ &array(4) {
+ ["zero"]=>
+ string(4) "zero"
+ ["un"]=>
+ string(3) "one"
+ ["sub"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [0]=>
+ *RECURSION*
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_values_variation5.phpt b/ext/standard/tests/array/array_values_variation5.phpt
new file mode 100644
index 000000000..d65b4674d
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation5.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test array_values() function : usage variations - internal array pointer
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test the position of the internal array pointer after a call to array_values
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+$input = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois');
+
+echo "\n-- Call array_values() --\n";
+var_dump($result = array_values($input));
+
+echo "-- Position of Internal Pointer in Result: --\n";
+echo key($result) . " => " . current($result) . "\n";
+echo "\n-- Position of Internal Pointer in Original Array: --\n";
+echo key($input) . " => " . current ($input) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- Call array_values() --
+array(3) {
+ [0]=>
+ string(2) "un"
+ [1]=>
+ string(4) "deux"
+ [2]=>
+ string(5) "trois"
+}
+-- Position of Internal Pointer in Result: --
+0 => un
+
+-- Position of Internal Pointer in Original Array: --
+one => un
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_values_variation6.phpt b/ext/standard/tests/array/array_values_variation6.phpt
new file mode 100644
index 000000000..e56515076
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation6.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test array_values() function : usage variations - Referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test array_values() when:
+ * 1. Passed an array made up of referenced variables
+ * 2. Passed an array by reference
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+$val1 = 'one';
+$val2 = 'two';
+$val3 = 'three';
+
+echo "\n-- \$input is an array made up of referenced variables: --\n";
+$input = array(&$val1, &$val2, &$val3);
+var_dump($result1 = array_values($input));
+
+echo "Change \$val2 and check result of array_values():\n";
+$val2 = 'deux';
+var_dump($result1);
+
+echo "\n-- Pass \$input argument by reference --\n";
+$array = array(1, 2, 3);
+var_dump($result2 = array_values(&$array));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- $input is an array made up of referenced variables: --
+array(3) {
+ [0]=>
+ &string(3) "one"
+ [1]=>
+ &string(3) "two"
+ [2]=>
+ &string(5) "three"
+}
+Change $val2 and check result of array_values():
+array(3) {
+ [0]=>
+ &string(3) "one"
+ [1]=>
+ &string(4) "deux"
+ [2]=>
+ &string(5) "three"
+}
+
+-- Pass $input argument by reference --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_values_variation7.phpt b/ext/standard/tests/array/array_values_variation7.phpt
new file mode 100644
index 000000000..b71306456
--- /dev/null
+++ b/ext/standard/tests/array/array_values_variation7.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test array_values() function : usage variations - Internal order check
+--FILE--
+<?php
+/* Prototype : array array_values(array $input)
+ * Description: Return just the values from the input array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check that array_values is re-assigning keys according to the internal order of the array,
+ * and is not dependant on the \$input argument's keys
+ */
+
+echo "*** Testing array_values() : usage variations ***\n";
+
+// populate array with 'default' keys in reverse order
+$input = array(3 => 'three', 2 => 'two', 1 => 'one', 0 => 'zero');
+
+echo "\n-- \$input argument: --\n";
+var_dump($input);
+
+echo "\n-- Result of array_values() --\n";
+var_dump(array_values($input));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_values() : usage variations ***
+
+-- $input argument: --
+array(4) {
+ [3]=>
+ string(5) "three"
+ [2]=>
+ string(3) "two"
+ [1]=>
+ string(3) "one"
+ [0]=>
+ string(4) "zero"
+}
+
+-- Result of array_values() --
+array(4) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(3) "one"
+ [3]=>
+ string(4) "zero"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_walk_basic1.phpt b/ext/standard/tests/array/array_walk_basic1.phpt
new file mode 100644
index 000000000..34e8e88c7
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_basic1.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test array_walk() function : basic functionality - regular array
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk() : basic functionality ***\n";
+
+// regular array
+$fruits = array("lemon", "orange", "banana", "apple");
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - item in key/item pair
+ * key - key in key/item pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+function with_userdata($item, $key, $user_data)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($user_data); // user supplied data
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk() with default parameters to show array contents --\n";
+var_dump( array_walk($fruits, 'test_print'));
+
+echo "-- Using array_walk() with all parameters --\n";
+var_dump( array_walk($fruits, 'with_userdata', "Added"));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk() : basic functionality ***
+-- Using array_walk() with default parameters to show array contents --
+string(5) "lemon"
+int(0)
+
+string(6) "orange"
+int(1)
+
+string(6) "banana"
+int(2)
+
+string(5) "apple"
+int(3)
+
+bool(true)
+-- Using array_walk() with all parameters --
+string(5) "lemon"
+int(0)
+string(5) "Added"
+
+string(6) "orange"
+int(1)
+string(5) "Added"
+
+string(6) "banana"
+int(2)
+string(5) "Added"
+
+string(5) "apple"
+int(3)
+string(5) "Added"
+
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_walk_basic2.phpt b/ext/standard/tests/array/array_walk_basic2.phpt
new file mode 100644
index 000000000..e856b580b
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_basic2.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test array_walk() function : basic functionality - associative array
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk() : basic functionality ***\n";
+
+// associative array
+$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
+
+// User defined callback functions
+/* Prototype : test_alter(mixed $item, mixed $key, string $prefix)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * prefix - string to be added
+ * Description : alters the array values by appending prefix string
+ */
+function test_alter(&$item, $key, $prefix)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($prefix); // additional agument passed to callback function
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk with default parameters to show array contents --\n";
+var_dump(array_walk($fruits, 'test_print'));
+
+echo "-- Using array_walk with one optional parameter to modify contents --\n";
+var_dump (array_walk($fruits, 'test_alter', 'fruit'));
+
+echo "-- Using array_walk with default parameters to show modified array contents --\n";
+var_dump (array_walk($fruits, 'test_print'));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk() : basic functionality ***
+-- Using array_walk with default parameters to show array contents --
+string(5) "lemon"
+string(1) "d"
+
+string(6) "orange"
+string(1) "a"
+
+string(6) "banana"
+string(1) "b"
+
+string(5) "apple"
+string(1) "c"
+
+bool(true)
+-- Using array_walk with one optional parameter to modify contents --
+string(5) "lemon"
+string(1) "d"
+string(5) "fruit"
+
+string(6) "orange"
+string(1) "a"
+string(5) "fruit"
+
+string(6) "banana"
+string(1) "b"
+string(5) "fruit"
+
+string(5) "apple"
+string(1) "c"
+string(5) "fruit"
+
+bool(true)
+-- Using array_walk with default parameters to show modified array contents --
+string(5) "lemon"
+string(1) "d"
+
+string(6) "orange"
+string(1) "a"
+
+string(6) "banana"
+string(1) "b"
+
+string(5) "apple"
+string(1) "c"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_error1.phpt b/ext/standard/tests/array/array_walk_error1.phpt
new file mode 100644
index 000000000..014885a94
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_error1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test array_walk() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+$input = array(1, 2);
+
+/* Prototype : callback(mixed value, mixed key, mixed user_data)
+ * Parameters : value - value in key/value pair
+ * key - key in key/value pair
+ * user_data - extra parameter
+ */
+function callback ($value, $key, $user_data) {
+ echo "\ncallback() invoked \n";
+}
+
+echo "*** Testing array_walk() : error conditions ***\n";
+
+echo "-- Testing array_walk() function with zero arguments --\n";
+var_dump( array_walk() );
+
+echo "-- Testing array_walk() function with one argument --\n";
+var_dump( array_walk($input) );
+
+echo "-- Testing array_walk() function with non existent callback function --\n";
+var_dump( array_walk($input, "non_existent") );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk() : error conditions ***
+-- Testing array_walk() function with zero arguments --
+
+Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+-- Testing array_walk() function with one argument --
+
+Warning: array_walk() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+-- Testing array_walk() function with non existent callback function --
+
+Warning: array_walk(): Unable to call non_existent() - function does not exist in %s on line %d
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt
new file mode 100644
index 000000000..654637ab5
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_error2.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test array_walk() function : error conditions - callback parameters
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() by passing more number of parameters to callback function
+ */
+$input = array(1);
+
+function callback1($value, $key, $user_data ) {
+ echo "\ncallback1() invoked \n";
+}
+
+function callback2($value, $key, $user_data1, $user_data2) {
+ echo "\ncallback2() invoked \n";
+}
+echo "*** Testing array_walk() : error conditions - callback parameters ***\n";
+
+// expected: Missing argument Warning
+var_dump( array_walk($input, "callback1") );
+var_dump( array_walk($input, "callback2", 4) );
+
+// expected: Warning is supressed
+var_dump( @array_walk($input, "callback1") );
+var_dump( @array_walk($input, "callback2", 4) );
+
+echo "-- Testing array_walk() function with too many callback parameters --\n";
+var_dump( array_walk($input, "callback1", 20, 10) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk() : error conditions - callback parameters ***
+
+Warning: Missing argument 3 for callback1() in %s on line %d
+
+callback1() invoked
+bool(true)
+
+Warning: Missing argument 4 for callback2() in %s on line %d
+
+callback2() invoked
+bool(true)
+
+callback1() invoked
+bool(true)
+
+callback2() invoked
+bool(true)
+-- Testing array_walk() function with too many callback parameters --
+
+Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt
new file mode 100644
index 000000000..632b651c0
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_object1.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_walk_object2.phpt b/ext/standard/tests/array/array_walk_object2.phpt
new file mode 100644
index 000000000..61d052975
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_object2.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test array_walk() function : object functionality - array of objects
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_walk() with an array of objects
+*/
+
+echo "*** Testing array_walk() : array of objects ***\n";
+
+/*
+ * Prototype : callback(mixed $value, mixed $key, int $addvalue
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * $addvalue - value to be added
+ * Description : Function adds the addvalue to each element of an array
+*/
+function callback_private($value, $key, $addValue)
+{
+ echo "value : ";
+ var_dump($value->getValue());
+ echo "key : ";
+ var_dump($key);
+}
+
+function callback_public($value, $key)
+{
+ echo "value : ";
+ var_dump($value->pub_value);
+}
+function callback_protected($value, $key)
+{
+ echo "value : ";
+ var_dump($value->get_pro_value());
+}
+
+class MyClass
+{
+ private $pri_value;
+ public $pub_value;
+ protected $pro_value;
+ public function __construct($setVal)
+ {
+ $this->pri_value = $setVal;
+ $this->pub_value = $setVal;
+ $this->pro_value = $setVal;
+ }
+ public function getValue()
+ {
+ return $this->pri_value;
+ }
+ public function get_pro_value()
+ {
+ return $this->pro_value;
+ }
+};
+
+// array containing objects of MyClass
+$input = array (
+ new MyClass(3),
+ new MyClass(10),
+ new MyClass(20),
+ new MyClass(-10)
+);
+
+echo "-- For private member --\n";
+var_dump( array_walk($input, "callback_private", 1));
+echo "-- For public member --\n";
+var_dump( array_walk($input, "callback_public"));
+echo "-- For protected member --\n";
+var_dump( array_walk($input, "callback_protected"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : array of objects ***
+-- For private member --
+value : int(3)
+key : int(0)
+value : int(10)
+key : int(1)
+value : int(20)
+key : int(2)
+value : int(-10)
+key : int(3)
+bool(true)
+-- For public member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+-- For protected member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_basic1.phpt b/ext/standard/tests/array/array_walk_recursive_basic1.phpt
new file mode 100644
index 000000000..df192b6a7
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_basic1.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test array_walk_recursive() function : basic functionality - regular array
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk_recursive() : basic functionality ***\n";
+
+// regular array
+$fruits = array("lemon", array("orange", "banana"), array("apple"));
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - item in key/item pair
+ * key - key in key/item pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+function with_userdata($item, $key, $user_data)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($user_data); // user supplied data
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk_recursive() with default parameters to show array contents --\n";
+var_dump( array_walk_recursive($fruits, 'test_print'));
+
+echo "-- Using array_walk_recursive() with all parameters --\n";
+var_dump( array_walk_recursive($fruits, 'with_userdata', "Added"));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk_recursive() : basic functionality ***
+-- Using array_walk_recursive() with default parameters to show array contents --
+string(5) "lemon"
+int(0)
+
+string(6) "orange"
+int(0)
+
+string(6) "banana"
+int(1)
+
+string(5) "apple"
+int(0)
+
+bool(true)
+-- Using array_walk_recursive() with all parameters --
+string(5) "lemon"
+int(0)
+string(5) "Added"
+
+string(6) "orange"
+int(0)
+string(5) "Added"
+
+string(6) "banana"
+int(1)
+string(5) "Added"
+
+string(5) "apple"
+int(0)
+string(5) "Added"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_basic2.phpt b/ext/standard/tests/array/array_walk_recursive_basic2.phpt
new file mode 100644
index 000000000..c71d92b45
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_basic2.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test array_walk_recursive() function : basic functionality - associative array
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_walk_recursive() : basic functionality ***\n";
+
+// associative array
+$fruits = array("a" => "lemon", "b" => array( "c" => "orange", "d" => "banana"), "e" => array("f" => "apple"));
+
+// User defined callback functions
+/* Prototype : test_alter(mixed $item, mixed $key, string $prefix)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * prefix - string to be added
+ * Description : alters the array values by appending prefix string
+ */
+function test_alter(&$item, $key, $prefix)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ var_dump($prefix); // additional agument passed to callback function
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : test_print(mixed $item, mixed $key)
+ * Parameters : item - value in key/value pair
+ * key - key in key/value pair
+ * Description : prints the array values with keys
+ */
+function test_print($item, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($item); // value
+ var_dump($key); // key
+ echo "\n"; // new line to separate the output between each element
+}
+
+echo "-- Using array_walk_recursive with default parameters to show array contents --\n";
+var_dump(array_walk_recursive($fruits, 'test_print'));
+
+echo "-- Using array_walk_recursive with one optional parameter to modify contents --\n";
+var_dump (array_walk_recursive($fruits, 'test_alter', 'fruit'));
+
+echo "-- Using array_walk_recursive with default parameters to show modified array contents --\n";
+var_dump (array_walk_recursive($fruits, 'test_print'));
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_walk_recursive() : basic functionality ***
+-- Using array_walk_recursive with default parameters to show array contents --
+string(5) "lemon"
+string(1) "a"
+
+string(6) "orange"
+string(1) "c"
+
+string(6) "banana"
+string(1) "d"
+
+string(5) "apple"
+string(1) "f"
+
+bool(true)
+-- Using array_walk_recursive with one optional parameter to modify contents --
+string(5) "lemon"
+string(1) "a"
+string(5) "fruit"
+
+string(6) "orange"
+string(1) "c"
+string(5) "fruit"
+
+string(6) "banana"
+string(1) "d"
+string(5) "fruit"
+
+string(5) "apple"
+string(1) "f"
+string(5) "fruit"
+
+bool(true)
+-- Using array_walk_recursive with default parameters to show modified array contents --
+string(5) "lemon"
+string(1) "a"
+
+string(6) "orange"
+string(1) "c"
+
+string(6) "banana"
+string(1) "d"
+
+string(5) "apple"
+string(1) "f"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_error1.phpt b/ext/standard/tests/array/array_walk_recursive_error1.phpt
new file mode 100644
index 000000000..df7092c02
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_error1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test array_walk_recursive() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+$input = array(1, 2);
+
+/* Prototype : callback(mixed value, mixed key, mixed user_data)
+ * Parameters : value - value in key/value pair
+ * key - key in key/value pair
+ * user_data - extra parameter
+ */
+function callback ($value, $key, $user_data) {
+ echo "\ncallback() invoked \n";
+}
+
+echo "*** Testing array_walk_recursive() : error conditions ***\n";
+
+echo "-- Testing array_walk_recursive() function with zero arguments --\n";
+var_dump( array_walk_recursive() );
+
+echo "-- Testing array_walk_recursive() function with one argument --\n";
+var_dump( array_walk_recursive($input) );
+
+echo "-- Testing array_walk_recursive() function with non existent callback function --\n";
+var_dump( array_walk_recursive($input, "non_existent") );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : error conditions ***
+-- Testing array_walk_recursive() function with zero arguments --
+
+Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+-- Testing array_walk_recursive() function with one argument --
+
+Warning: array_walk_recursive() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+-- Testing array_walk_recursive() function with non existent callback function --
+
+Warning: array_walk_recursive(): Unable to call non_existent() - function does not exist in %s on line %d
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt
new file mode 100644
index 000000000..d628e9327
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test array_walk_recursive() function : error conditions - callback parameters
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() by passing more number of parameters to callback function
+ */
+$input = array(1);
+
+function callback1($value, $key, $user_data ) {
+ echo "\ncallback1() invoked \n";
+}
+
+function callback2($value, $key, $user_data1, $user_data2) {
+ echo "\ncallback2() invoked \n";
+}
+echo "*** Testing array_walk_recursive() : error conditions - callback parameters ***\n";
+
+// expected: Missing argument Warning
+var_dump( array_walk_recursive($input, "callback1") );
+var_dump( array_walk_recursive($input, "callback2", 4) );
+
+// expected: Warning is supressed
+var_dump( @array_walk_recursive($input, "callback1") );
+var_dump( @array_walk_recursive($input, "callback2", 4) );
+
+echo "-- Testing array_walk_recursive() function with too many callback parameters --\n";
+var_dump( array_walk_recursive($input, "callback1", 20, 10) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : error conditions - callback parameters ***
+
+Warning: Missing argument 3 for callback1() in %s on line %d
+
+callback1() invoked
+bool(true)
+
+Warning: Missing argument 4 for callback2() in %s on line %d
+
+callback2() invoked
+bool(true)
+
+callback1() invoked
+bool(true)
+
+callback2() invoked
+bool(true)
+-- Testing array_walk_recursive() function with too many callback parameters --
+
+Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_object1.phpt b/ext/standard/tests/array/array_walk_recursive_object1.phpt
new file mode 100644
index 000000000..30d03a70a
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_object1.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_walk_recursive_object2.phpt b/ext/standard/tests/array/array_walk_recursive_object2.phpt
new file mode 100644
index 000000000..aa12fe869
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_object2.phpt
@@ -0,0 +1,106 @@
+--TEST--
+Test array_walk_recursive() function : object functionality - array of objects
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_walk_recursive() with an array of objects
+*/
+
+echo "*** Testing array_walk_recursive() : array of objects ***\n";
+
+/*
+ * Prototype : callback(mixed $value, mixed $key, int $addvalue
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * $addvalue - value to be added
+ * Description : Function adds the addvalue to each element of an array
+*/
+function callback_private($value, $key, $addValue)
+{
+ echo "value : ";
+ var_dump($value->getValue());
+ echo "key : ";
+ var_dump($key);
+}
+
+function callback_public($value, $key)
+{
+ echo "value : ";
+ var_dump($value->pub_value);
+}
+function callback_protected($value, $key)
+{
+ echo "value : ";
+ var_dump($value->get_pro_value());
+}
+
+class MyClass
+{
+ private $pri_value;
+ public $pub_value;
+ protected $pro_value;
+ public function __construct($setVal)
+ {
+ $this->pri_value = $setVal;
+ $this->pub_value = $setVal;
+ $this->pro_value = $setVal;
+ }
+ public function getValue()
+ {
+ return $this->pri_value;
+ }
+ public function get_pro_value()
+ {
+ return $this->pro_value;
+ }
+};
+
+// array containing objects of MyClass
+$input = array (
+ array(
+ new MyClass(3),
+ new MyClass(10),
+ ),
+ new MyClass(20),
+ array(new MyClass(-10))
+);
+
+echo "-- For private member --\n";
+var_dump( array_walk_recursive($input, "callback_private", 1));
+echo "-- For public member --\n";
+var_dump( array_walk_recursive($input, "callback_public"));
+echo "-- For protected member --\n";
+var_dump( array_walk_recursive($input, "callback_protected"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : array of objects ***
+-- For private member --
+value : int(3)
+key : int(0)
+value : int(10)
+key : int(1)
+value : int(20)
+key : int(1)
+value : int(-10)
+key : int(0)
+bool(true)
+-- For public member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+-- For protected member --
+value : int(3)
+value : int(10)
+value : int(20)
+value : int(-10)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation1.phpt b/ext/standard/tests/array/array_walk_recursive_variation1.phpt
new file mode 100644
index 000000000..2673df99a
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation1.phpt
@@ -0,0 +1,250 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - unexpected values for 'input' argument
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'input' argument
+*/
+
+echo "*** Testing array_walk_recursive() : unexpected values for 'input' argument ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values given in input array
+ * $key - keys given in input array
+ * Description : Function prints each element of an array with key
+ */
+function callback($value, $key)
+{
+ echo "key : ";
+ var_dump($key);
+ echo "value : ";
+ var_dump($value);
+}
+
+// extra parameter passed to array_walk_recursive()
+$user_data = 10;
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get resource variable
+$fp = fopen(__FILE__, 'r');
+
+// different scalar/nonscalar values to be used in place of an 'input' argument
+$input_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // null data
+/* 10*/ NULL,
+ null,
+
+ // boolean data
+/* 12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 16*/ "",
+ '',
+
+ // string data
+/* 18*/ "string",
+ 'string',
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/* 22*/ @$unset_var,
+);
+
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk_recursive($input_values[$count], "callback") );
+ var_dump( array_walk_recursive($input_values[$count], "callback", $user_data) );
+}
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : unexpected values for 'input' argument ***
+-- Iteration 1 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation2.phpt b/ext/standard/tests/array/array_walk_recursive_variation2.phpt
new file mode 100644
index 000000000..d94647376
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation2.phpt
@@ -0,0 +1,271 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - unexpected values in place of 'funcname' argument(Bug#43543)
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'funcname' argument
+*/
+
+echo "*** Testing array_walk_recursive() : unexpected values for 'funcname' argument ***\n";
+
+$input = array(1, array(2, 3));
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+$user_data = 20;
+
+// get resource variable
+$fp = fopen(__FILE__, 'r');
+
+// class definition
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+// different scalar/nonscalar values to be used in place of callback function
+$funcname_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+/* 10*/ array(),
+ array(0),
+ array(1),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/* 14*/ NULL,
+ null,
+
+ // boolean data
+/* 16*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 20*/ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // resource data
+/* 23*/ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/* 25*/ @$unset_var,
+);
+
+for($count = 0; $count < count($funcname_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk_recursive($input, $funcname_values[$count]) );
+ var_dump( array_walk_recursive($input, $funcname_values[$count], $user_data ));
+}
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : unexpected values for 'funcname' argument ***
+-- Iteration 1 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 11 --
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 12 --
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 13 --
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk_recursive(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 14 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: array_walk_recursive(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk_recursive(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+-- Iteration 21 --
+
+Warning: array_walk_recursive(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk_recursive(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+-- Iteration 22 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 25 --
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk_recursive(): Wrong syntax for function name in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation3.phpt b/ext/standard/tests/array/array_walk_recursive_variation3.phpt
new file mode 100644
index 000000000..747ba3bb0
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation3.phpt
@@ -0,0 +1,123 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - 'input' array with different values
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() with following types of 'input' arrays:
+ * integer, float, string, bool, null, empty & mixed
+*/
+
+// callback function
+/*
+ * Prototype : print_value(mixed $value, int $key, int $count)
+ * Parameters : $value - array entries(values)
+ * $key - keys in given input array
+ * $count - extra parameter used as an index
+ * Description : prints the array values with keys and count value
+ */
+function print_value($value, $key, $count)
+{
+ echo $count." : ".$key." ".$value."\n";
+}
+
+echo "*** Testing array_walk_recursive() : 'input' array with different values***\n";
+
+// different arrays as input
+$input_values = array(
+
+ // integer values
+/*1*/ array(array(1, 0, -10), array(023, -041), array(0x5A, 0X1F, -0x6E)),
+
+ // float value
+ array(array(3.4, 0.8, -2.9), array(6.25e2, 8.20E-3)),
+
+ // string values
+ array('Mango', array("Apple", 'Orange', "Lemon")),
+
+ // bool values
+/*4*/ array( array(true, false), array(TRUE, FALSE)),
+
+ // null values
+ array( array(null), array(NULL)),
+
+ // empty array
+ array(),
+
+ // binary array
+ array(b"binary"),
+
+ // mixed array
+/*8*/ array(16, 8.345, array("Fruits"), array(true, null), array(FALSE), array(-98, 0.005, 'banana'))
+);
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk_recursive($input_values[$count], "print_value", $count+1));
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : 'input' array with different values***
+
+-- Iteration 1 --
+1 : 0 1
+1 : 1 0
+1 : 2 -10
+1 : 0 19
+1 : 1 -33
+1 : 0 90
+1 : 1 31
+1 : 2 -110
+bool(true)
+
+-- Iteration 2 --
+2 : 0 3.4
+2 : 1 0.8
+2 : 2 -2.9
+2 : 0 625
+2 : 1 0.0082
+bool(true)
+
+-- Iteration 3 --
+3 : 0 Mango
+3 : 0 Apple
+3 : 1 Orange
+3 : 2 Lemon
+bool(true)
+
+-- Iteration 4 --
+4 : 0 1
+4 : 1
+4 : 0 1
+4 : 1
+bool(true)
+
+-- Iteration 5 --
+5 : 0
+5 : 0
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+7 : 0 binary
+bool(true)
+
+-- Iteration 8 --
+8 : 0 16
+8 : 1 8.345
+8 : 0 Fruits
+8 : 0 1
+8 : 1
+8 : 0
+8 : 0 -98
+8 : 1 0.005
+8 : 2 banana
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation4.phpt b/ext/standard/tests/array/array_walk_recursive_variation4.phpt
new file mode 100644
index 000000000..4db34979a
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation4.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - 'input' array with subarray
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() with an array having subarrays as elements
+*/
+
+echo "*** Testing array_walk_recursive() : array with subarray ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values in given 'input' array
+ * $key - keys in given 'input' array
+ * Description : It prints the count of an array elements, passed as argument
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+$input = array(
+ array(),
+ array(1),
+ array(1,2,3),
+ array("Mango", "Orange"),
+ array(array(1, 2, 3), array(1))
+);
+
+var_dump( array_walk_recursive( $input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : array with subarray ***
+int(0)
+int(1)
+
+int(0)
+int(1)
+
+int(1)
+int(2)
+
+int(2)
+int(3)
+
+int(0)
+string(5) "Mango"
+
+int(1)
+string(6) "Orange"
+
+int(0)
+int(1)
+
+int(1)
+int(2)
+
+int(2)
+int(3)
+
+int(0)
+int(1)
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation5.phpt b/ext/standard/tests/array/array_walk_recursive_variation5.phpt
new file mode 100644
index 000000000..688da57f0
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation5.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - 'input' argument containing reference variables
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk_recursive() with an array having reference variables
+*/
+
+echo "*** Testing array_walk_recursive() : array with references ***\n";
+
+$value1 = 10;
+$value2 = -20;
+$value3 = &$value1;
+$value4 = 50;
+
+// 'input' array containing references to above variables
+$input = array(&$value1, array(&$value2, -35), array(&$value3, 0), array(&$value4));
+
+// callback function
+/* Prototype : callback(int $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : function checks for the value whether positive or negative and displays according to that
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+var_dump( array_walk_recursive($input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : array with references ***
+int(0)
+int(10)
+
+int(0)
+int(-20)
+
+int(1)
+int(-35)
+
+int(0)
+int(10)
+
+int(1)
+int(0)
+
+int(0)
+int(50)
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation6.phpt b/ext/standard/tests/array/array_walk_recursive_variation6.phpt
new file mode 100644
index 000000000..554ade4f4
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation6.phpt
@@ -0,0 +1,147 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - 'input' argument as diff. associative arrays
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing 'input' argument as an associative array
+ * with Numeric & string keys
+*/
+
+echo "*** Testing array_walk_recursive() : 'input' as an associative array ***\n";
+
+// callback functions
+/* Prototype : for_numeric( int $value, int $key, int $user_data)
+ * Parameters : $value - value from key/value pair of the array
+ * $key - key from key/value pair of the array
+ * $user_data - data to be added to 'value'
+ * Description : Function adds values with keys & user_data
+ */
+function for_numeric($value, $key, $user_data)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ var_dump($user_data);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_string( string $value, string $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function appends key to the value
+ */
+function for_string($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_mixed( mixed $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function displays each element of an array with keys
+ */
+function for_mixed($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+// Numeric keys
+$input = array( 0 => array(1 => 25, 5 => 12, 0 => -80), 1 => array(-2 => 100, 5 => 30));
+echo "-- Associative array with numeric keys --\n";
+var_dump( array_walk_recursive($input, "for_numeric", 10));
+
+// String keys
+$input = array( "a" => "Apple", 'z' => array('b' => 'Bananna', "c" => "carrot"), 'x' => array('o' => "Orange"));
+echo "-- Associative array with string keys --\n";
+var_dump( array_walk_recursive($input, "for_string"));
+
+// binary keys
+$input = array( b"a" => "Apple", b"b" => "Banana");
+echo "-- Associative array with binary keys --\n";
+var_dump( array_walk_recursive($input, "for_string"));
+
+// Mixed keys - numeric/string
+$input = array( 0 => array(0 => 1, 1 => 2), "x" => array("a" => "Apple", "b" => "Banana"), 2 =>3);
+echo "-- Associative array with numeric/string keys --\n";
+var_dump( array_walk_recursive($input, "for_mixed"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : 'input' as an associative array ***
+-- Associative array with numeric keys --
+int(1)
+int(25)
+int(10)
+
+int(5)
+int(12)
+int(10)
+
+int(0)
+int(-80)
+int(10)
+
+int(-2)
+int(100)
+int(10)
+
+int(5)
+int(30)
+int(10)
+
+bool(true)
+-- Associative array with string keys --
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(7) "Bananna"
+
+string(1) "c"
+string(6) "carrot"
+
+string(1) "o"
+string(6) "Orange"
+
+bool(true)
+-- Associative array with binary keys --
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(6) "Banana"
+
+bool(true)
+-- Associative array with numeric/string keys --
+int(0)
+int(1)
+
+int(1)
+int(2)
+
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(6) "Banana"
+
+int(2)
+int(3)
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
new file mode 100644
index 000000000..0cdd6d248
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - anonymous callback function
+--FILE--
+<?php
+/* Prototype : proto bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing anonymous(run-time) callback function with following variations:
+* with one parameter
+* two parameters
+* three parameters
+* extra parameters
+* without parameters
+*/
+
+echo "*** Testing array_walk_recursive() : anonymous function as callback ***\n";
+
+$input = array( array(2, 5), array(10, 0));
+
+echo "-- Anonymous function with one argument --\n";
+var_dump( array_walk_recursive($input, create_function('$value', 'var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with two arguments --\n";
+var_dump( array_walk_recursive($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with three arguments --\n";
+var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10));
+
+echo "-- Anonymous function with one more argument --\n";
+var_dump( array_walk_recursive($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30));
+
+echo "-- Anonymous function with null argument --\n";
+var_dump( array_walk_recursive( $input, create_function(null, 'echo "1\n";')));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : anonymous function as callback ***
+-- Anonymous function with one argument --
+int(2)
+
+int(5)
+
+int(10)
+
+int(0)
+
+bool(true)
+-- Anonymous function with two arguments --
+int(0)
+int(2)
+
+int(1)
+int(5)
+
+int(0)
+int(10)
+
+int(1)
+int(0)
+
+bool(true)
+-- Anonymous function with three arguments --
+int(0)
+int(2)
+int(10)
+
+int(1)
+int(5)
+int(10)
+
+int(0)
+int(10)
+int(10)
+
+int(1)
+int(0)
+int(10)
+
+bool(true)
+-- Anonymous function with one more argument --
+
+Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+-- Anonymous function with null argument --
+1
+1
+1
+1
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt
new file mode 100644
index 000000000..aa73912cf
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - buit-in function as callback
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different buit-in functionns as callback function
+ * pow function
+ * min function
+ * echo language construct
+*/
+
+echo "*** Testing array_walk_recursive() : built-in function as callback ***\n";
+
+$input = array(array(1, 2));
+
+echo "-- With 'pow' built-in function --\n";
+var_dump( array_walk_recursive($input, 'pow'));
+
+echo "-- With 'min' built-in function --\n";
+var_dump( array_walk_recursive($input, "min"));
+
+echo "-- With 'echo' language construct --\n";
+var_dump( array_walk_recursive($input, "echo"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : built-in function as callback ***
+-- With 'pow' built-in function --
+bool(true)
+-- With 'min' built-in function --
+bool(true)
+-- With 'echo' language construct --
+
+Warning: array_walk_recursive(): Unable to call echo() - function does not exist in %s on line %d
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation9.phpt b/ext/standard/tests/array/array_walk_recursive_variation9.phpt
new file mode 100644
index 000000000..f18fe248c
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive_variation9.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test array_walk_recursive() function : usage variations - different callback functions
+--FILE--
+<?php
+/* Prototype : bool array_walk_recursive(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different types of callback functions to array_walk_recursive()
+ * without parameters
+ * with less and more parameters
+*/
+
+echo "*** Testing array_walk_recursive() : callback function variation ***\n";
+
+$input = array(array('Apple', 'Banana'), 'Mango', array('Orange'));
+
+echo "-- callback function with both parameters --\n";
+function callback_two_parameter($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk_recursive($input, 'callback_two_parameter'));
+
+echo "-- callback function with only one parameter --\n";
+function callback_one_parameter($value)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk_recursive($input, 'callback_one_parameter'));
+
+echo "-- callback function without parameters --\n";
+function callback_no_parameter()
+{
+ echo "callback3() called\n";
+}
+var_dump( array_walk_recursive($input, 'callback_no_parameter'));
+
+echo "-- passing one more parameter to function with two parameters --\n";
+var_dump( array_walk_recursive($input, 'callback_two_parameter', 10));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk_recursive() : callback function variation ***
+-- callback function with both parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(1)
+string(5) "Mango"
+
+int(0)
+string(6) "Orange"
+
+bool(true)
+-- callback function with only one parameter --
+string(5) "Apple"
+
+string(6) "Banana"
+
+string(5) "Mango"
+
+string(6) "Orange"
+
+bool(true)
+-- callback function without parameters --
+callback3() called
+callback3() called
+callback3() called
+callback3() called
+bool(true)
+-- passing one more parameter to function with two parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(1)
+string(5) "Mango"
+
+int(0)
+string(6) "Orange"
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation1.phpt b/ext/standard/tests/array/array_walk_variation1.phpt
new file mode 100644
index 000000000..e08c0d711
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation1.phpt
@@ -0,0 +1,250 @@
+--TEST--
+Test array_walk() function : usage variations - unexpected values for 'input' argument
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'input' argument
+*/
+
+echo "*** Testing array_walk() : unexpected values for 'input' argument ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values given in input array
+ * $key - keys given in input array
+ * Description : Function prints each element of an array with key
+ */
+function callback($value, $key)
+{
+ echo "key : ";
+ var_dump($key);
+ echo "value : ";
+ var_dump($value);
+}
+
+// extra parameter passed to array_walk()
+$user_data = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get resource variable
+$fp = fopen(__FILE__, 'r');
+
+// different scalar/nonscalar values to be used in place of an 'input' argument
+$input_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // null data
+/* 10*/ NULL,
+ null,
+
+ // boolean data
+/* 12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 16*/ "",
+ '',
+
+ // string data
+/* 18*/ "string",
+ 'string',
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/* 22*/ @$unset_var,
+);
+
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk($input_values[$count], "callback") );
+ var_dump( array_walk($input_values[$count], "callback", $user_data) );
+}
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : unexpected values for 'input' argument ***
+-- Iteration 1 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation2.phpt b/ext/standard/tests/array/array_walk_variation2.phpt
new file mode 100644
index 000000000..88fbbf3d5
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation2.phpt
@@ -0,0 +1,271 @@
+--TEST--
+Test array_walk() function : usage variations - unexpected values in place of 'funcname' argument
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different scalar/nonscalar values in place of 'funcname' argument
+*/
+
+echo "*** Testing array_walk() : unexpected values for 'funcname' argument ***\n";
+
+$input = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+$user_data = 20;
+
+// get resource variable
+$fp = fopen(__FILE__, 'r');
+
+// class definition
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+// different scalar/nonscalar values to be used in place of callback function
+$funcname_values = array(
+
+ // int data
+/* 1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/* 5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // array data
+/* 10*/ array(),
+ array(0),
+ array(1),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/* 14*/ NULL,
+ null,
+
+ // boolean data
+/* 16*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 20*/ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // resource data
+/* 23*/ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/* 25*/ @$unset_var,
+);
+
+for($count = 0; $count < count($funcname_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk($input, $funcname_values[$count]) );
+ var_dump( array_walk($input, $funcname_values[$count], $user_data ));
+}
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : unexpected values for 'funcname' argument ***
+-- Iteration 1 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 11 --
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 12 --
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 13 --
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d
+bool(true)
+-- Iteration 14 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: array_walk(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+-- Iteration 21 --
+
+Warning: array_walk(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+
+Warning: array_walk(): Unable to call () - function does not exist in %s on line %d
+bool(true)
+-- Iteration 22 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+-- Iteration 25 --
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+
+Warning: array_walk(): Wrong syntax for function name in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation3.phpt b/ext/standard/tests/array/array_walk_variation3.phpt
new file mode 100644
index 000000000..ad2612353
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation3.phpt
@@ -0,0 +1,123 @@
+--TEST--
+Test array_walk() function : usage variations - 'input' array with different values
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() with following types of 'input' arrays:
+ * integer, float, string, bool, null, empty & mixed
+*/
+
+// callback function
+/*
+ * Prototype : print_value(mixed $value, int $key, int $count)
+ * Parameters : $value - array entries(values)
+ * $key - keys in given input array
+ * $count - extra parameter used as an index
+ * Description : prints the array values with keys and count value
+ */
+function print_value($value, $key, $count)
+{
+ echo $count." : ".$key." ".$value."\n";
+}
+
+echo "*** Testing array_walk() : 'input' array with different values***\n";
+
+// different arrays as input
+$input_values = array(
+
+ // integer values
+/*1*/ array(1, 0, -10, 023, -041, 0x5A, 0X1F, -0x6E),
+
+ // float value
+ array(3.4, 0.8, -2.9, 6.25e2, 8.20E-3),
+
+ // string values
+ array('Mango', "Apple", 'Orange', "Lemon"),
+
+ // bool values
+/*4*/ array(true, false, TRUE, FALSE),
+
+ // null values
+ array(null, NULL),
+
+ // empty array
+ array(),
+
+ // binary array
+ array(b"binary"),
+
+ // mixed array
+/*8*/ array(16, 8.345, "Fruits", true, null, FALSE, -98, 0.005, 'banana')
+);
+
+for($count = 0; $count < count($input_values); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --\n";
+ var_dump( array_walk($input_values[$count], "print_value", $count+1));
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : 'input' array with different values***
+
+-- Iteration 1 --
+1 : 0 1
+1 : 1 0
+1 : 2 -10
+1 : 3 19
+1 : 4 -33
+1 : 5 90
+1 : 6 31
+1 : 7 -110
+bool(true)
+
+-- Iteration 2 --
+2 : 0 3.4
+2 : 1 0.8
+2 : 2 -2.9
+2 : 3 625
+2 : 4 0.0082
+bool(true)
+
+-- Iteration 3 --
+3 : 0 Mango
+3 : 1 Apple
+3 : 2 Orange
+3 : 3 Lemon
+bool(true)
+
+-- Iteration 4 --
+4 : 0 1
+4 : 1
+4 : 2 1
+4 : 3
+bool(true)
+
+-- Iteration 5 --
+5 : 0
+5 : 1
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+7 : 0 binary
+bool(true)
+
+-- Iteration 8 --
+8 : 0 16
+8 : 1 8.345
+8 : 2 Fruits
+8 : 3 1
+8 : 4
+8 : 5
+8 : 6 -98
+8 : 7 0.005
+8 : 8 banana
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation4.phpt b/ext/standard/tests/array/array_walk_variation4.phpt
new file mode 100644
index 000000000..868732daa
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation4.phpt
@@ -0,0 +1,87 @@
+--TEST--
+Test array_walk() function : usage variations - 'input' array with subarray
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() with an array having subarrays as elements
+*/
+
+echo "*** Testing array_walk() : array with subarray ***\n";
+
+// callback function
+/* Prototype : callback(mixed $value, mixed $key)
+ * Parameters : $value - values in given 'input' array
+ * $key - keys in given 'input' array
+ * Description : It prints the count of an array elements, passed as argument
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+$input = array(
+ array(),
+ array(1),
+ array(1,2,3),
+ array("Mango", "Orange"),
+ array(array(1, 2, 3))
+);
+
+var_dump( array_walk( $input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : array with subarray ***
+int(0)
+array(0) {
+}
+
+int(1)
+array(1) {
+ [0]=>
+ int(1)
+}
+
+int(2)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+
+int(3)
+array(2) {
+ [0]=>
+ string(5) "Mango"
+ [1]=>
+ string(6) "Orange"
+}
+
+int(4)
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+}
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation5.phpt b/ext/standard/tests/array/array_walk_variation5.phpt
new file mode 100644
index 000000000..f42e0f11e
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation5.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test array_walk() function : usage variations - 'input' argument containing reference variables
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_walk() with an array having reference variables
+*/
+
+echo "*** Testing array_walk() : array with references ***\n";
+
+$value1 = 10;
+$value2 = -20;
+$value3 = &$value1;
+$value4 = 50;
+
+// 'input' array containing references to above variables
+$input = array(&$value1, &$value2, -35, &$value3, 0, &$value4);
+
+// callback function
+/* Prototype : callback(int $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : function checks for the value whether positive or negative and displays according to that
+ */
+function callback($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+
+var_dump( array_walk($input, "callback"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : array with references ***
+int(0)
+int(10)
+
+int(1)
+int(-20)
+
+int(2)
+int(-35)
+
+int(3)
+int(10)
+
+int(4)
+int(0)
+
+int(5)
+int(50)
+
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_walk_variation6.phpt b/ext/standard/tests/array/array_walk_variation6.phpt
new file mode 100644
index 000000000..c1f23233e
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation6.phpt
@@ -0,0 +1,143 @@
+--TEST--
+Test array_walk() function : usage variations - 'input' argument as diff. associative arrays
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing 'input' argument as an associative array
+ * with Numeric & string keys
+*/
+
+echo "*** Testing array_walk() : 'input' as an associative array ***\n";
+
+// callback functions
+/* Prototype : for_numeric( int $value, int $key, int $user_data)
+ * Parameters : $value - value from key/value pair of the array
+ * $key - key from key/value pair of the array
+ * $user_data - data to be added to 'value'
+ * Description : Function adds values with keys & user_data
+ */
+function for_numeric($value, $key, $user_data)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ var_dump($user_data);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_string( string $value, string $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function appends key to the value
+ */
+function for_string($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+/* Prototype : for_mixed( mixed $value, mixed $key)
+ * Parameters : $value - values in given input array
+ * $key - keys in given input array
+ * Description : Function displays each element of an array with keys
+ */
+function for_mixed($value, $key)
+{
+ // dump the input values to see if they are
+ // passed with correct type
+ var_dump($key);
+ var_dump($value);
+ echo "\n"; // new line to separate the output between each element
+}
+
+// Numeric keys
+$input = array( 1 => 25, 5 => 12, 0 => -80, -2 => 100, 5 => 30);
+echo "-- Associative array with numeric keys --\n";
+var_dump( array_walk($input, "for_numeric", 10));
+
+// String keys
+$input = array( "a" => "Apple", 'b' => 'Bananna', "c" => "carrot", 'o' => "Orange");
+echo "-- Associative array with string keys --\n";
+var_dump( array_walk($input, "for_string"));
+
+// binary keys
+$input = array( b"a" => "Apple", b"b" => "Banana");
+echo "-- Associative array with binary keys --\n";
+var_dump( array_walk($input, "for_string"));
+
+// Mixed keys - numeric/string
+$input = array( 0 => 1, 1 => 2, "a" => "Apple", "b" => "Banana", 2 =>3);
+echo "-- Associative array with numeric/string keys --\n";
+var_dump( array_walk($input, "for_mixed"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : 'input' as an associative array ***
+-- Associative array with numeric keys --
+int(1)
+int(25)
+int(10)
+
+int(5)
+int(30)
+int(10)
+
+int(0)
+int(-80)
+int(10)
+
+int(-2)
+int(100)
+int(10)
+
+bool(true)
+-- Associative array with string keys --
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(7) "Bananna"
+
+string(1) "c"
+string(6) "carrot"
+
+string(1) "o"
+string(6) "Orange"
+
+bool(true)
+-- Associative array with binary keys --
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(6) "Banana"
+
+bool(true)
+-- Associative array with numeric/string keys --
+int(0)
+int(1)
+
+int(1)
+int(2)
+
+string(1) "a"
+string(5) "Apple"
+
+string(1) "b"
+string(6) "Banana"
+
+int(2)
+int(3)
+
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt
new file mode 100644
index 000000000..da85958b8
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation7.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test array_walk() function : usage variations - anonymous callback function
+--FILE--
+<?php
+/* Prototype : proto bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing anonymous(run-time) callback function with following variations:
+* with one parameter
+* two parameters
+* three parameters
+* extra parameters
+* without parameters
+*/
+
+echo "*** Testing array_walk() : anonymous function as callback ***\n";
+
+$input = array(2, 5, 10, 0);
+
+echo "-- Anonymous function with one argument --\n";
+var_dump( array_walk($input, create_function('$value', 'var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with two arguments --\n";
+var_dump( array_walk($input, create_function('$value, $key', 'var_dump($key); var_dump($value); echo "\n";')));
+
+echo "-- Anonymous function with three arguments --\n";
+var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 10));
+
+echo "-- Anonymous function with one more argument --\n";
+var_dump( array_walk($input, create_function('$value, $key, $user_data', 'var_dump($key); var_dump($value); var_dump($user_data); echo "\n";'), 20, 30));
+
+echo "-- Anonymous function with null argument --\n";
+var_dump( array_walk( $input, create_function(null, 'echo "1\n";')));
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : anonymous function as callback ***
+-- Anonymous function with one argument --
+int(2)
+
+int(5)
+
+int(10)
+
+int(0)
+
+bool(true)
+-- Anonymous function with two arguments --
+int(0)
+int(2)
+
+int(1)
+int(5)
+
+int(2)
+int(10)
+
+int(3)
+int(0)
+
+bool(true)
+-- Anonymous function with three arguments --
+int(0)
+int(2)
+int(10)
+
+int(1)
+int(5)
+int(10)
+
+int(2)
+int(10)
+int(10)
+
+int(3)
+int(0)
+int(10)
+
+bool(true)
+-- Anonymous function with one more argument --
+
+Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+-- Anonymous function with null argument --
+1
+1
+1
+1
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt
new file mode 100644
index 000000000..2086394dd
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation8.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test array_walk() function : usage variations - buit-in function as callback
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different buit-in functionns as callback function
+ * pow function
+ * min function
+ * echo language construct
+*/
+
+echo "*** Testing array_walk() : built-in function as callback ***\n";
+
+$input = array(2 => 1, 65, 98, 100, 6 => -4);
+
+echo "-- With 'pow' built-in function --\n";
+var_dump( array_walk($input, 'pow'));
+
+echo "-- With 'min' built-in function --\n";
+var_dump( array_walk($input, "min"));
+
+echo "-- With 'echo' language construct --\n";
+var_dump( array_walk($input, "echo"));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : built-in function as callback ***
+-- With 'pow' built-in function --
+bool(true)
+-- With 'min' built-in function --
+bool(true)
+-- With 'echo' language construct --
+
+Warning: array_walk(): Unable to call echo() - function does not exist in %s on line %d
+bool(true)
+Done
diff --git a/ext/standard/tests/array/array_walk_variation9.phpt b/ext/standard/tests/array/array_walk_variation9.phpt
new file mode 100644
index 000000000..42ae20d68
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_variation9.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test array_walk() function : usage variations - different callback functions
+--FILE--
+<?php
+/* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
+ * Description: Apply a user function to every member of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Passing different types of callback functions to array_walk()
+ * without parameters
+ * with less and more parameters
+*/
+
+echo "*** Testing array_walk() : callback function variation ***\n";
+
+$input = array('Apple', 'Banana', 'Mango', 'Orange');
+
+echo "-- callback function with both parameters --\n";
+function callback_two_parameter($value, $key)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($key); // key
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk($input, 'callback_two_parameter'));
+
+echo "-- callback function with only one parameter --\n";
+function callback_one_parameter($value)
+{
+ // dump the arguments to check that they are passed
+ // with proper type
+ var_dump($value); // value
+ echo "\n"; // new line to separate the output between each element
+}
+var_dump( array_walk($input, 'callback_one_parameter'));
+
+echo "-- callback function without parameters --\n";
+function callback_no_parameter()
+{
+ echo "callback3() called\n";
+}
+var_dump( array_walk($input, 'callback_no_parameter'));
+
+echo "-- passing one more parameter to function with two parameters --\n";
+var_dump( array_walk($input, 'callback_two_parameter', 10));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_walk() : callback function variation ***
+-- callback function with both parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(2)
+string(5) "Mango"
+
+int(3)
+string(6) "Orange"
+
+bool(true)
+-- callback function with only one parameter --
+string(5) "Apple"
+
+string(6) "Banana"
+
+string(5) "Mango"
+
+string(6) "Orange"
+
+bool(true)
+-- callback function without parameters --
+callback3() called
+callback3() called
+callback3() called
+callback3() called
+bool(true)
+-- passing one more parameter to function with two parameters --
+int(0)
+string(5) "Apple"
+
+int(1)
+string(6) "Banana"
+
+int(2)
+string(5) "Mango"
+
+int(3)
+string(6) "Orange"
+
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_error.phpt b/ext/standard/tests/array/arsort_error.phpt
new file mode 100644
index 000000000..676d8265e
--- /dev/null
+++ b/ext/standard/tests/array/arsort_error.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test arsort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool arsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing arsort() function with all possible error conditions
+*/
+
+echo "*** Testing arsort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing arsort() function with Zero arguments --\n";
+var_dump( arsort() );
+
+//Test arsort with more than the expected number of arguments
+echo "\n-- Testing arsort() 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( arsort($array_arg,$flag, $extra_arg) );
+
+ // dump the input array to ensure that it wasn't changed
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing arsort() : error conditions ***
+
+-- Testing arsort() function with Zero arguments --
+
+Warning: arsort() expects at least 1 parameter, 0 given in %sarsort_error.php on line %d
+bool(false)
+
+-- Testing arsort() function with more than expected no. of arguments --
+
+Sort flag = SORT_REGULAR
+
+Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_STRING
+
+Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_NUMERIC
+
+Warning: arsort() expects at most 2 parameters, 3 given in %sarsort_error.php on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation1.phpt b/ext/standard/tests/array/arsort_variation1.phpt
new file mode 100644
index 000000000..1545abe34
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation1.phpt
@@ -0,0 +1,399 @@
+--TEST--
+Test arsort() function : usage variations - unexpected values for 'array_arg' argument
+--FILE--
+<?php
+/* Prototype : bool arsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() 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 arsort() : 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 arsort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing arsort() 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( arsort($value) ); // expecting : bool(false)
+ var_dump( arsort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( arsort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( arsort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, integer given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, double given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, null given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, boolean given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, object given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, string given in %sarsort_variation1.php on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+
+Warning: arsort() expects parameter 1 to be array, resource given in %sarsort_variation1.php on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation10.phpt b/ext/standard/tests/array/arsort_variation10.phpt
new file mode 100644
index 000000000..ec483df3a
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation10.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test arsort() function : usage variations - sort octal values
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() 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 arsort() : 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 arsort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( arsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [669]=>
+ int(669)
+ [506]=>
+ int(506)
+ [229]=>
+ int(229)
+ [209]=>
+ int(209)
+ [63]=>
+ int(63)
+ [54]=>
+ int(54)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-54)
+ [-229]=>
+ int(-229)
+}
+
+-- Testing arsort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [669]=>
+ int(669)
+ [506]=>
+ int(506)
+ [229]=>
+ int(229)
+ [209]=>
+ int(209)
+ [63]=>
+ int(63)
+ [54]=>
+ int(54)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-54)
+ [-229]=>
+ int(-229)
+}
+
+-- Testing arsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [669]=>
+ int(669)
+ [506]=>
+ int(506)
+ [229]=>
+ int(229)
+ [209]=>
+ int(209)
+ [63]=>
+ int(63)
+ [54]=>
+ int(54)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-54)
+ [-229]=>
+ int(-229)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation11.phpt b/ext/standard/tests/array/arsort_variation11.phpt
new file mode 100644
index 000000000..e8bfd772e
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/arsort_variation2.phpt b/ext/standard/tests/array/arsort_variation2.phpt
new file mode 100644
index 000000000..ab04b4409
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation2.phpt
@@ -0,0 +1,308 @@
+--TEST--
+Test arsort() function : usage variations - unexpected values for 'sort_flags' argument
+--FILE--
+<?php
+/* Prototype : proto bool arsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing arsort() : 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 arsort()
+// when $flag arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing arsort() 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( arsort($temp_array, $value) );
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying different unexpected values for 'sort_flags' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 4 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 5 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 6 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 7 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 8 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 9 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 10 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 11 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 12 --
+bool(true)
+array(3) {
+ [3]=>
+ int(45)
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 13 --
+
+Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 14 --
+
+Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 15 --
+
+Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 16 --
+
+Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 17 --
+
+Warning: arsort() expects parameter 2 to be long, object given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 18 --
+
+Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 19 --
+
+Warning: arsort() expects parameter 2 to be long, string given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 20 --
+
+Warning: arsort() expects parameter 2 to be long, resource given in %sarsort_variation2.php on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation3.phpt b/ext/standard/tests/array/arsort_variation3.phpt
new file mode 100644
index 000000000..609155ca7
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation3.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test arsort() function : usage variations - sort integer/float values
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() 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 arsort() : 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 arsort() by supplying various integer/float arrays --\n";
+
+// loop through to test arsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(arsort($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(arsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [7]=>
+ int(0)
+ [2]=>
+ int(-11)
+ [4]=>
+ int(-21)
+ [6]=>
+ int(-31)
+ [10]=>
+ int(-41)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [7]=>
+ int(0)
+ [2]=>
+ int(-11)
+ [4]=>
+ int(-21)
+ [6]=>
+ int(-31)
+ [10]=>
+ int(-41)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [7]=>
+ int(0)
+ [2]=>
+ int(-11)
+ [4]=>
+ int(-21)
+ [6]=>
+ int(-31)
+ [10]=>
+ int(-41)
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(7) {
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [5]=>
+ float(0.5)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+ [7]=>
+ float(-0.1)
+ [2]=>
+ float(-10.5)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [5]=>
+ float(0.5)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+ [7]=>
+ float(-0.1)
+ [2]=>
+ float(-10.5)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [5]=>
+ float(0.5)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+ [7]=>
+ float(-0.1)
+ [2]=>
+ float(-10.5)
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [6]=>
+ float(0.09)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [5]=>
+ int(0)
+ [3]=>
+ float(-0.01)
+ [10]=>
+ float(-0.106)
+ [8]=>
+ float(-0.9)
+ [4]=>
+ int(-1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [6]=>
+ float(0.09)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [5]=>
+ int(0)
+ [3]=>
+ float(-0.01)
+ [10]=>
+ float(-0.106)
+ [8]=>
+ float(-0.9)
+ [4]=>
+ int(-1)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [6]=>
+ float(0.09)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [5]=>
+ int(0)
+ [3]=>
+ float(-0.01)
+ [10]=>
+ float(-0.106)
+ [8]=>
+ float(-0.9)
+ [4]=>
+ int(-1)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(7) {
+ [2]=>
+ %s(2147483648)
+ [1]=>
+ int(2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [3]=>
+ int(-2147483647)
+ [4]=>
+ %s(-2147483648)
+ [7]=>
+ %s(-2147483649)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [2]=>
+ %s(2147483648)
+ [1]=>
+ int(2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [3]=>
+ int(-2147483647)
+ [4]=>
+ %s(-2147483648)
+ [7]=>
+ %s(-2147483649)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [2]=>
+ %s(2147483648)
+ [1]=>
+ int(2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [3]=>
+ int(-2147483647)
+ [4]=>
+ %s(-2147483648)
+ [7]=>
+ %s(-2147483649)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation4.phpt b/ext/standard/tests/array/arsort_variation4.phpt
new file mode 100644
index 000000000..a76a180f4
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation4.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test arsort() function : usage variations - sort reference variables
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() 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 arsort() :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 arsort() by supplying reference variable array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( arsort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying reference variable array, 'flag' = SORT_REGULAR --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing arsort() by supplying reference variable array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() :usage variations ***
+
+-- Testing arsort() by supplying reference variable array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ [3]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+
+-- Testing arsort() by supplying reference variable array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [3]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+
+-- Testing arsort() by supplying reference variable array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(3) {
+ [3]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation5.phpt b/ext/standard/tests/array/arsort_variation5.phpt
new file mode 100644
index 000000000..e69c26988
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation5.phpt
@@ -0,0 +1,242 @@
+--TEST--
+Test arsort() function : usage variations - sort strings
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() 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 arsort() : 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 arsort() by supplying various string arrays --\n";
+
+// loop through to test arsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(arsort($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(arsort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(12) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\e"]=>
+ string(2) "\e"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\a"]=>
+ string(2) "\a"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(12) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\e"]=>
+ string(2) "\e"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\a"]=>
+ string(2) "\a"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+}
+- Sort_flag = SORT_STRING -
+bool(true)
+array(12) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\e"]=>
+ string(2) "\e"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\a"]=>
+ string(2) "\a"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(12) {
+ ["x"]=>
+ string(1) "x"
+ ["w"]=>
+ string(2) "ww"
+ ["t"]=>
+ string(3) "ttt"
+ ["o"]=>
+ string(6) "oraNGe"
+ ["l"]=>
+ string(5) "lemoN"
+ ["b"]=>
+ string(6) "banana"
+ ["a"]=>
+ string(5) "apple"
+ ["X"]=>
+ string(1) "X"
+ ["Te"]=>
+ string(4) "Test"
+ ["T"]=>
+ string(4) "TTTT"
+ ["O"]=>
+ string(6) "Orange"
+ ["B"]=>
+ string(6) "BANANA"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(12) {
+ ["x"]=>
+ string(1) "x"
+ ["w"]=>
+ string(2) "ww"
+ ["t"]=>
+ string(3) "ttt"
+ ["o"]=>
+ string(6) "oraNGe"
+ ["l"]=>
+ string(5) "lemoN"
+ ["b"]=>
+ string(6) "banana"
+ ["a"]=>
+ string(5) "apple"
+ ["X"]=>
+ string(1) "X"
+ ["Te"]=>
+ string(4) "Test"
+ ["T"]=>
+ string(4) "TTTT"
+ ["O"]=>
+ string(6) "Orange"
+ ["B"]=>
+ string(6) "BANANA"
+}
+- Sort_flag = SORT_STRING -
+bool(true)
+array(12) {
+ ["x"]=>
+ string(1) "x"
+ ["w"]=>
+ string(2) "ww"
+ ["t"]=>
+ string(3) "ttt"
+ ["o"]=>
+ string(6) "oraNGe"
+ ["l"]=>
+ string(5) "lemoN"
+ ["b"]=>
+ string(6) "banana"
+ ["a"]=>
+ string(5) "apple"
+ ["X"]=>
+ string(1) "X"
+ ["Te"]=>
+ string(4) "Test"
+ ["T"]=>
+ string(4) "TTTT"
+ ["O"]=>
+ string(6) "Orange"
+ ["B"]=>
+ string(6) "BANANA"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation6.phpt b/ext/standard/tests/array/arsort_variation6.phpt
new file mode 100644
index 000000000..687b20a71
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation6.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test arsort() function : usage variations - sort hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() 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 arsort() : 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 arsort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(arsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(arsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(arsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying hexadecimal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing arsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation7.phpt b/ext/standard/tests/array/arsort_variation7.phpt
new file mode 100644
index 000000000..97195b709
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation7.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test arsort() function : usage variations - sort bool values
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: This function arsorts an array.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() by providing bool value array for $array argument with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing arsort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (1 => true, 2 => false, 3 => TRUE, 4 => FALSE);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(arsort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying bool value array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+
+-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+
+-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+
+-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING --
+bool(true)
+array(4) {
+ [3]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation8.phpt b/ext/standard/tests/array/arsort_variation8.phpt
new file mode 100644
index 000000000..c2473160c
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation8.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test arsort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as default/SORT_REGULAR
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing arsort() 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 arsort() : 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 arsort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test arsort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ // testing arsort() function by supplying different arrays, flag value is default
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array) );
+ var_dump($temp_array);
+
+ // testing arsort() function by supplying different arrays, flag value = SORT_REGULAR
+ echo "- Sort_flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() 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) {
+ ["sub_array[2][0] "]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ ["data[2,0]"]=>
+ int(44)
+ ["data[2,1]"]=>
+ int(11)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["sub_array[2][0] "]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ ["data[2,0]"]=>
+ int(44)
+ ["data[2,1]"]=>
+ int(11)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(4) {
+ ["sub_array[3][0]"]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ ["sub_array[3][2]"]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ ["sub_array[3][1]"]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ ["sub_array[3][3]"]=>
+ array(0) {
+ }
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["sub_array[3][0]"]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ ["sub_array[3][2]"]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ ["sub_array[3][1]"]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ ["sub_array[3][3]"]=>
+ array(0) {
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/arsort_variation9.phpt b/ext/standard/tests/array/arsort_variation9.phpt
new file mode 100644
index 000000000..a034db5d9
--- /dev/null
+++ b/ext/standard/tests/array/arsort_variation9.phpt
@@ -0,0 +1,258 @@
+--TEST--
+Test arsort() function : usage variations - sorting arrays with/without keys, 'sort_flags' as default/SORT_REGULAR
+--FILE--
+<?php
+/* Prototype : bool arsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from highest to lowest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing arsort() 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 arsort() : 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 arsort() by supplying various arrays with key values --\n";
+
+// loop through to test arsort() 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(arsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort_flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(arsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing arsort() : usage variations ***
+
+-- Testing arsort() by supplying various arrays with key values --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(5) {
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [9]=>
+ int(11)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [9]=>
+ int(11)
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ ["a"]=>
+ string(6) "orange"
+ [0]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["a"]=>
+ string(6) "orange"
+ [0]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ [6]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+ [0]=>
+ string(5) "first"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [6]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+ [0]=>
+ string(5) "first"
+}
+
+-- Iteration 5 --
+- With default sort_flag -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 6 --
+- With default sort_flag -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+
+-- Iteration 7 --
+- With default sort_flag -
+bool(true)
+array(4) {
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+ ["a"]=>
+ int(1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+ ["a"]=>
+ int(1)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/bug26458.phpt b/ext/standard/tests/array/bug26458.phpt
index d24e1f151..ecd12ba84 100644
--- a/ext/standard/tests/array/bug26458.phpt
+++ b/ext/standard/tests/array/bug26458.phpt
Binary files differ
diff --git a/ext/standard/tests/array/bug42177.phpt b/ext/standard/tests/array/bug42177.phpt
new file mode 100644
index 000000000..63a9b71d9
--- /dev/null
+++ b/ext/standard/tests/array/bug42177.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #42177 (Warning "array_merge_recursive(): recursion detected" comes again...)
+--FILE--
+<?php
+
+$a1 = array( 'key1' => 1, 'key3' => 2 );
+$a2 = array();
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+unset( $a1, $a2 );
+
+$a1 = array();
+$a2 = array( 'key1' => 1, 'key3' => 2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+unset( $a1, $a2 );
+
+$a1 = array();
+$a2 = array( 'key1' => &$a1 );
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1['key1'] = null;
+unset( $a1, $a2 );
+
+$x = 'foo';
+$y =& $x;
+$a1 = array($x, $y, $x, $y);
+$a2 = array( 'key1' => $a1, $x, $y );
+$a1 = array_merge_recursive( $a1, $a2 );
+$a1 = array_merge_recursive( $a1, $a2 );
+unset( $a1, $a2 );
+
+?>
+--EXPECTF--
+Warning: array_merge_recursive(): recursion detected in %s on line 18
diff --git a/ext/standard/tests/array/bug42838.phpt b/ext/standard/tests/array/bug42838.phpt
new file mode 100644
index 000000000..1f895f31e
--- /dev/null
+++ b/ext/standard/tests/array/bug42838.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug#42838 - Wrong results in array_diff_uassoc
+--FILE--
+<?php
+
+function key_compare_func($a, $b)
+{
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $b)? 1:-1;
+}
+
+$array1 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red');
+$array2 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red');
+
+$result = array_diff_uassoc($array1, $array2, "key_compare_func");
+print_r($result);
+
+?>
+--EXPECT--
+Array
+(
+) \ No newline at end of file
diff --git a/ext/standard/tests/array/bug42850.phpt b/ext/standard/tests/array/bug42850.phpt
new file mode 100644
index 000000000..737cd170d
--- /dev/null
+++ b/ext/standard/tests/array/bug42850.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Bug #42850 array_walk_recursive() leaves references, #34982 array_walk_recursive() modifies elements outside function scope
+--FILE--
+<?php
+
+// Bug #42850
+$data = array ('key1' => 'val1', array('key2' => 'val2'));
+function apply_dumb($item, $key) {};
+var_dump($data);
+array_walk_recursive($data, 'apply_dumb');
+$data2 = $data;
+$data2[0] = 'altered';
+var_dump($data);
+var_dump($data2);
+
+// Bug #34982
+function myfunc($data) {
+ array_walk_recursive($data, 'apply_changed');
+}
+function apply_changed(&$input, $key) {
+ $input = 'changed';
+}
+myfunc($data);
+var_dump($data);
+
+--EXPECT--
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ array(1) {
+ ["key2"]=>
+ string(4) "val2"
+ }
+}
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ array(1) {
+ ["key2"]=>
+ string(4) "val2"
+ }
+}
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ string(7) "altered"
+}
+array(2) {
+ ["key1"]=>
+ string(4) "val1"
+ [0]=>
+ array(1) {
+ ["key2"]=>
+ string(4) "val2"
+ }
+}
diff --git a/ext/standard/tests/array/bug43495.phpt b/ext/standard/tests/array/bug43495.phpt
new file mode 100644
index 000000000..cd0fab141
--- /dev/null
+++ b/ext/standard/tests/array/bug43495.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #43495 (array_merge_recursive() crashes with recursive arrays)
+--FILE--
+<?php
+$a=array("key1"=>array("key2"=>array()));
+$a["key1"]["key2"]["key3"]=&$a;
+
+$b=array("key1"=>array("key2"=>array()));
+$b["key1"]["key2"]["key3"]=&$b;
+
+array_merge_recursive($a,$b);
+
+/* Break recursion */
+$a["key1"]["key2"]["key3"] = null;
+$b["key1"]["key2"]["key3"] = null;
+
+echo "Done.\n";
+?>
+--EXPECTF--
+Warning: array_merge_recursive(): recursion detected in %s/bug43495.php on line %d
+Done.
diff --git a/ext/standard/tests/array/bug43505.phpt b/ext/standard/tests/array/bug43505.phpt
new file mode 100644
index 000000000..219bbfe29
--- /dev/null
+++ b/ext/standard/tests/array/bug43505.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #43505 (Assign by reference bug)
+--INI--
+error_reporting=0
+--SKIPIF--
+<?php if (!extension_loaded('spl')) die("skip SPL is not available"); ?>
+--FILE--
+<?php
+class Test implements Countable {
+ public function count() {
+ return $some;
+ }
+}
+
+$obj = new Test();
+
+$a = array();
+$b =& $a['test'];
+var_dump($a);
+
+$t = count($obj);
+
+$a = array();
+$b =& $a['test'];
+var_dump($a);
+?>
+--EXPECT--
+array(1) {
+ ["test"]=>
+ &NULL
+}
+array(1) {
+ ["test"]=>
+ &NULL
+}
+
diff --git a/ext/standard/tests/array/compact_basic.phpt b/ext/standard/tests/array/compact_basic.phpt
new file mode 100644
index 000000000..53a946e12
--- /dev/null
+++ b/ext/standard/tests/array/compact_basic.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test compact() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto array compact(mixed var_names [, mixed ...])
+ * Description: Creates a hash containing variables and their values
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic functionality
+ */
+
+echo "*** Testing compact() : basic functionality ***\n";
+
+$a=1;
+$b=0.2;
+$c=true;
+$d=array("key"=>"val");
+$e=NULL;
+$f="string";
+
+// simple array test
+var_dump (compact(array("a", "b", "c", "d", "e", "f")));
+// simple parameter test
+var_dump (compact("a", "b", "c", "d", "e", "f"));
+var_dump (compact(array("keyval"=>"a", "b"=>"b", "c"=>1)));
+
+// cases which should not yield any output.
+var_dump (compact(array(10, 0.3, true, array(20), NULL)));
+var_dump (compact(10, 0.3, true, array(20), NULL));
+var_dump (compact(array("g")));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing compact() : basic functionality ***
+array(6) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ float(0.2)
+ ["c"]=>
+ bool(true)
+ ["d"]=>
+ array(1) {
+ ["key"]=>
+ string(3) "val"
+ }
+ ["e"]=>
+ NULL
+ ["f"]=>
+ string(6) "string"
+}
+array(6) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ float(0.2)
+ ["c"]=>
+ bool(true)
+ ["d"]=>
+ array(1) {
+ ["key"]=>
+ string(3) "val"
+ }
+ ["e"]=>
+ NULL
+ ["f"]=>
+ string(6) "string"
+}
+array(2) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ float(0.2)
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/compact_error.phpt b/ext/standard/tests/array/compact_error.phpt
new file mode 100644
index 000000000..d3d6e2cbb
--- /dev/null
+++ b/ext/standard/tests/array/compact_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test compact() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array compact(mixed var_names [, mixed ...])
+ * Description: Creates a hash containing variables and their values
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+/*
+ * Error -tests test compact with zero arguments.
+ */
+
+echo "*** Testing compact() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing compact() function with Zero arguments --\n";
+var_dump( compact() );
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing compact() : error conditions ***
+
+-- Testing compact() function with Zero arguments --
+
+Warning: Wrong parameter count for compact() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/count_basic.phpt b/ext/standard/tests/array/count_basic.phpt
new file mode 100644
index 000000000..45f63d6a4
--- /dev/null
+++ b/ext/standard/tests/array/count_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test count() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of count() using an array as $var argument
+ * and different values as $mode argument.
+ */
+
+echo "*** Testing count() : basic functionality ***\n";
+
+echo "\n-- One Dimensional Array: --\n";
+$array = array('zero', 'one', 'two');
+var_dump(count($array));
+
+echo "\n-- Two Dimensional Array: --\n";
+$array_multi = array('zero', array(1, 2, 3), 'two');
+echo "\$mode = COUNT_NORMAL: ";
+var_dump(count($array_multi, COUNT_NORMAL));
+echo "\$mode = 0: ";
+var_dump(count($array_multi, 0));
+echo "\$mode = COUNT_RECURSIVE: ";
+var_dump(count($array_multi, COUNT_RECURSIVE));
+echo "\$mode = 1: ";
+var_dump(count($array_multi, 1));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : basic functionality ***
+
+-- One Dimensional Array: --
+int(3)
+
+-- Two Dimensional Array: --
+$mode = COUNT_NORMAL: int(3)
+$mode = 0: int(3)
+$mode = COUNT_RECURSIVE: int(6)
+$mode = 1: int(6)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_error.phpt b/ext/standard/tests/array/count_error.phpt
new file mode 100644
index 000000000..76f721364
--- /dev/null
+++ b/ext/standard/tests/array/count_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test count() function : error conditions - pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : int count(mixed var [, int mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to count() to test behaviour
+ */
+
+echo "*** Testing count() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing count() function with Zero arguments --\n";
+var_dump( count() );
+
+//Test count with one more than the expected number of arguments
+echo "\n-- Testing count() function with more than expected no. of arguments --\n";
+$var = 1;
+$mode = 10;
+$extra_arg = 10;
+var_dump( count($var, $mode, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : error conditions ***
+
+-- Testing count() function with Zero arguments --
+
+Warning: count() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing count() function with more than expected no. of arguments --
+
+Warning: count() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_variation1.phpt b/ext/standard/tests/array/count_variation1.phpt
new file mode 100644
index 000000000..b40a2ab29
--- /dev/null
+++ b/ext/standard/tests/array/count_variation1.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test count() function : usage variations - Pass different data types as $var arg
+--FILE--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * aPass different data types as $var argument to count() to test behaviour
+ */
+
+echo "*** Testing count() : usage variations ***\n";
+
+//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 $var argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of count()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( count($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : usage variations ***
+
+-- Iteration 1 --
+int(1)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(1)
+
+-- Iteration 5 --
+int(1)
+
+-- Iteration 6 --
+int(1)
+
+-- Iteration 7 --
+int(1)
+
+-- Iteration 8 --
+int(1)
+
+-- Iteration 9 --
+int(1)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(1)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(1)
+
+-- Iteration 18 --
+int(1)
+
+-- Iteration 19 --
+int(1)
+
+-- Iteration 20 --
+int(1)
+
+-- Iteration 21 --
+int(1)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(1)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_variation2.phpt b/ext/standard/tests/array/count_variation2.phpt
new file mode 100644
index 000000000..86aecc07b
--- /dev/null
+++ b/ext/standard/tests/array/count_variation2.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test count() function : usage variations - Pass different data types as $mode arg
+--FILE--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $mode argument to count() to test behaviour
+ */
+
+echo "*** Testing count() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$var = array(1, 2, array ('one', 'two'));
+
+//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 $mode argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of count()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( count($var, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : usage variations ***
+
+-- Iteration 1 --
+int(3)
+
+-- Iteration 2 --
+int(5)
+
+-- Iteration 3 --
+int(3)
+
+-- Iteration 4 --
+int(3)
+
+-- Iteration 5 --
+int(3)
+
+-- Iteration 6 --
+int(3)
+
+-- Iteration 7 --
+int(3)
+
+-- Iteration 8 --
+int(3)
+
+-- Iteration 9 --
+int(3)
+
+-- Iteration 10 --
+int(3)
+
+-- Iteration 11 --
+int(3)
+
+-- Iteration 12 --
+int(5)
+
+-- Iteration 13 --
+int(3)
+
+-- Iteration 14 --
+int(5)
+
+-- Iteration 15 --
+int(3)
+
+-- Iteration 16 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: count() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: count() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 22 --
+int(3)
+
+-- Iteration 23 --
+int(3)
+
+-- Iteration 24 --
+
+Warning: count() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/count_variation3.phpt b/ext/standard/tests/array/count_variation3.phpt
new file mode 100644
index 000000000..7ec5667d3
--- /dev/null
+++ b/ext/standard/tests/array/count_variation3.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test count() function : usage variations - Infinitely recursive array
+--FILE--
+<?php
+/* Prototype : int count(mixed $var [, int $mode])
+ * Description: Count the number of elements in a variable (usually an array)
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass count() an infinitely recursive array as $var argument
+ * This will stop the script before it reaches the end.
+ */
+
+echo "*** Testing count() : usage variations ***\n";
+
+$array1 = array (1, 2, 'three');
+// get an infinitely recursive array
+$array1[] = &$array1;
+
+echo "\n-- \$mode not set: --\n";
+var_dump(count ($array1));
+
+echo "\n-- \$mode = 1: --\n";
+var_dump(count ($array1, 1));
+
+$array1[3] = null;
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing count() : usage variations ***
+
+-- $mode not set: --
+int(4)
+
+-- $mode = 1: --
+
+Warning: count(): recursion detected in %s on line %d
+int(12)
+Done
diff --git a/ext/standard/tests/array/current_basic.phpt b/ext/standard/tests/array/current_basic.phpt
new file mode 100644
index 000000000..cec695977
--- /dev/null
+++ b/ext/standard/tests/array/current_basic.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test current() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of current()
+ */
+
+echo "*** Testing current() : basic functionality ***\n";
+
+$array = array ('zero', 'one', 'two', 'three' => 3);
+var_dump(current($array));
+next($array);
+var_dump(current($array));
+end($array);
+var_dump(current($array));
+next($array);
+var_dump(current($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : basic functionality ***
+string(4) "zero"
+string(3) "one"
+int(3)
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/current_error.phpt b/ext/standard/tests/array/current_error.phpt
new file mode 100644
index 000000000..40362e779
--- /dev/null
+++ b/ext/standard/tests/array/current_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test current() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Pass incorrect number of arguments to current() to test behaviour
+ */
+
+echo "*** Testing current() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing current() function with Zero arguments --\n";
+var_dump( current() );
+
+//Test current with one more than the expected number of arguments
+echo "\n-- Testing current() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( current($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : error conditions ***
+
+-- Testing current() function with Zero arguments --
+
+Warning: Wrong parameter count for current() in %s on line %d
+NULL
+
+-- Testing current() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for current() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/current_variation1.phpt b/ext/standard/tests/array/current_variation1.phpt
new file mode 100644
index 000000000..cb21df27a
--- /dev/null
+++ b/ext/standard/tests/array/current_variation1.phpt
@@ -0,0 +1,217 @@
+--TEST--
+Test current() function : usage variations - Pass different data types as $array_arg arg
+--FILE--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Pass different data types as $array_arg argument to current() to test behaviour
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ var $var1;
+ 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 $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of current()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( current($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+NULL
+
+-- Iteration 22 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/current_variation2.phpt b/ext/standard/tests/array/current_variation2.phpt
new file mode 100644
index 000000000..49769cea3
--- /dev/null
+++ b/ext/standard/tests/array/current_variation2.phpt
@@ -0,0 +1,155 @@
+--TEST--
+Test current() function : usage variations - arrays containing different data types
+--FILE--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Pass arrays of different data types as $array_arg to current() to test behaviour
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+//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");
+
+// arrays of different data types to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of current()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ var_dump( current($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : usage variations ***
+
+-- Iteration 1 : int data --
+int(0)
+
+-- Iteration 2 : float data --
+float(10.5)
+
+-- Iteration 3 : null data --
+NULL
+
+-- Iteration 4 : bool data --
+bool(true)
+
+-- Iteration 5 : empty string data --
+string(0) ""
+
+-- Iteration 6 : empty array data --
+bool(false)
+
+-- Iteration 7 : string data --
+string(6) "string"
+
+-- Iteration 8 : object data --
+object(classA)#%d (0) {
+}
+
+-- Iteration 9 : undefined data --
+NULL
+
+-- Iteration 10 : unset data --
+NULL
+
+-- Iteration 11 : resource data --
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/array/current_variation3.phpt b/ext/standard/tests/array/current_variation3.phpt
new file mode 100644
index 000000000..bab5e6e0c
--- /dev/null
+++ b/ext/standard/tests/array/current_variation3.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test current() function : usage variations - referenced variables
+--FILE--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Test how the internal pointer is affected when two variables are referenced to each other
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(current($array1));
+next($array1);
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+echo "\n-- Position after calling next() --\n";
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : usage variations ***
+
+-- Initial position of internal pointer --
+string(4) "zero"
+
+-- Position after calling next() --
+$array1: string(3) "one"
+$array2: string(3) "one"
+===DONE===
diff --git a/ext/standard/tests/array/current_variation4.phpt b/ext/standard/tests/array/current_variation4.phpt
new file mode 100644
index 000000000..19864f584
--- /dev/null
+++ b/ext/standard/tests/array/current_variation4.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test current() function : usage variations - multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : mixed current(array $array_arg)
+ * Description: Return the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ * Alias to functions: pos
+ */
+
+/*
+ * Test how current() behaves with muti-dimensional and recursive arrays
+ */
+
+echo "*** Testing current() : usage variations ***\n";
+
+echo "\n-- Two Dimensional Array --\n";
+$multi_array = array ('zero', array (1, 2, 3), 'two');
+echo "Initial Position: ";
+var_dump(current($multi_array));
+
+echo "Next Position: ";
+next($multi_array);
+var_dump(current($multi_array));
+
+echo "End Position: ";
+end($multi_array);
+var_dump(current($multi_array));
+
+echo "\n-- Access an Array Within an Array --\n";
+//accessing an array within an array
+echo "Initial Position: ";
+var_dump(current($multi_array[1]));
+
+echo "\n-- Recursive, Multidimensional Array --\n";
+//create a recursive array
+$multi_array[] = &$multi_array;
+
+//See where internal pointer is after adding more elements
+echo "Current Position: ";
+var_dump(current($multi_array));
+
+//see if internal pointer is in same position as referenced array
+var_dump(current($multi_array[3][3][3]));
+// see if internal pointer is in the same position from when accessing this inner array
+var_dump(current($multi_array[3][3][3][1]));
+$multi_array[3] = null;
+?>
+===DONE===
+--EXPECTF--
+*** Testing current() : usage variations ***
+
+-- Two Dimensional Array --
+Initial Position: string(4) "zero"
+Next Position: array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+End Position: string(3) "two"
+
+-- Access an Array Within an Array --
+Initial Position: int(1)
+
+-- Recursive, Multidimensional Array --
+Current Position: string(3) "two"
+string(3) "two"
+int(1)
+===DONE===
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt
new file mode 100644
index 000000000..350b40f9a
--- /dev/null
+++ b/ext/standard/tests/array/each_basic.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test each() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test basic functionality of each()
+ */
+
+echo "*** Testing each() : basic functionality ***\n";
+
+$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty');
+echo "\n-- Passed array: --\n";
+var_dump($arr);
+
+echo "\n-- Initial position: --\n";
+var_dump(each($arr));
+
+echo "\n-- End position: --\n";
+end($arr);
+var_dump(each($arr));
+
+echo "\n-- Passed the end of array: --\n";
+var_dump(each($arr));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing each() : basic functionality ***
+
+-- Passed array: --
+array(4) {
+ ["one"]=>
+ int(1)
+ [0]=>
+ string(4) "zero"
+ ["two"]=>
+ string(4) "deux"
+ [20]=>
+ string(6) "twenty"
+}
+
+-- Initial position: --
+array(4) {
+ [1]=>
+ int(1)
+ ["value"]=>
+ int(1)
+ [0]=>
+ string(3) "one"
+ ["key"]=>
+ string(3) "one"
+}
+
+-- End position: --
+array(4) {
+ [1]=>
+ string(6) "twenty"
+ ["value"]=>
+ string(6) "twenty"
+ [0]=>
+ int(20)
+ ["key"]=>
+ int(20)
+}
+
+-- Passed the end of array: --
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt
new file mode 100644
index 000000000..02c8ef9c0
--- /dev/null
+++ b/ext/standard/tests/array/each_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test each() function : error conditions - pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to each() to test behaviour
+ */
+
+echo "*** Testing each() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing each() function with Zero arguments --\n";
+var_dump( each() );
+
+//Test each with one more than the expected number of arguments
+echo "\n-- Testing each() function with more than expected no. of arguments --\n";
+$arr = array(1, 2);
+$extra_arg = 10;
+var_dump( each($arr, $extra_arg) );
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : error conditions ***
+
+-- Testing each() function with Zero arguments --
+
+Warning: Wrong parameter count for each() in %s on line %d
+NULL
+
+-- Testing each() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for each() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt
new file mode 100644
index 000000000..0afef3143
--- /dev/null
+++ b/ext/standard/tests/array/each_variation1.phpt
@@ -0,0 +1,222 @@
+--TEST--
+Test each() function : usage variations - Pass different data types as $arr arg
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass different data types as $arr arg to each() to test behaviour
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+//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 $arr argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of each()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( each($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: Variable passed to each() is not an array or object in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt
new file mode 100644
index 000000000..3f7211c89
--- /dev/null
+++ b/ext/standard/tests/array/each_variation2.phpt
@@ -0,0 +1,248 @@
+--TEST--
+Test each() function : usage variations - arrays of different data types
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass arrays of different data types as $arr argument to each() to test behaviour
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+//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");
+
+// arrays of different data types to be passed as $arr
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of each()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( each($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [1]=>
+ int(0)
+ ["value"]=>
+ int(0)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 2: float data --
+array(4) {
+ [1]=>
+ float(10.5)
+ ["value"]=>
+ float(10.5)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 3: null data --
+array(4) {
+ [1]=>
+ NULL
+ ["value"]=>
+ NULL
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 4: bool data --
+array(4) {
+ [1]=>
+ bool(true)
+ ["value"]=>
+ bool(true)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 5: empty string data --
+array(4) {
+ [1]=>
+ string(0) ""
+ ["value"]=>
+ string(0) ""
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 6: empty array data --
+bool(false)
+
+-- Iteration 7: string data --
+array(4) {
+ [1]=>
+ string(6) "string"
+ ["value"]=>
+ string(6) "string"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 8: object data --
+array(4) {
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ ["value"]=>
+ object(classA)#%d (0) {
+ }
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 9: undefined data --
+array(4) {
+ [1]=>
+ NULL
+ ["value"]=>
+ NULL
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 10: unset data --
+array(4) {
+ [1]=>
+ NULL
+ ["value"]=>
+ NULL
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 11: resource data --
+array(4) {
+ [1]=>
+ resource(%d) of type (stream)
+ ["value"]=>
+ resource(%d) of type (stream)
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt
new file mode 100644
index 000000000..b31ddc61b
--- /dev/null
+++ b/ext/standard/tests/array/each_variation3.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test each() function : usage variations - keys of different data types
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Pass each() arrays where the keys are different data types to test behaviour
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed as $arr
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of each()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator: $key data --\n";
+ var_dump( each($input) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Iteration 1: int data --
+array(4) {
+ [1]=>
+ string(4) "zero"
+ ["value"]=>
+ string(4) "zero"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- Iteration 2: float data --
+array(4) {
+ [1]=>
+ string(8) "positive"
+ ["value"]=>
+ string(8) "positive"
+ [0]=>
+ int(10)
+ ["key"]=>
+ int(10)
+}
+
+-- Iteration 3: extreme floats data --
+array(4) {
+ [1]=>
+ string(5) "large"
+ ["value"]=>
+ string(5) "large"
+ [0]=>
+ int(12345678)
+ ["key"]=>
+ int(12345678)
+}
+
+-- Iteration 4: null uppercase data --
+array(4) {
+ [1]=>
+ string(6) "null 1"
+ ["value"]=>
+ string(6) "null 1"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 5: null lowercase data --
+array(4) {
+ [1]=>
+ string(6) "null 2"
+ ["value"]=>
+ string(6) "null 2"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 6: bool lowercase data --
+array(4) {
+ [1]=>
+ string(6) "lowert"
+ ["value"]=>
+ string(6) "lowert"
+ [0]=>
+ int(1)
+ ["key"]=>
+ int(1)
+}
+
+-- Iteration 7: bool uppercase data --
+array(4) {
+ [1]=>
+ string(6) "uppert"
+ ["value"]=>
+ string(6) "uppert"
+ [0]=>
+ int(1)
+ ["key"]=>
+ int(1)
+}
+
+-- Iteration 8: empty double quotes data --
+array(4) {
+ [1]=>
+ string(6) "emptyd"
+ ["value"]=>
+ string(6) "emptyd"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 9: empty single quotes data --
+array(4) {
+ [1]=>
+ string(6) "emptys"
+ ["value"]=>
+ string(6) "emptys"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 10: string data --
+array(4) {
+ [1]=>
+ string(7) "stringd"
+ ["value"]=>
+ string(7) "stringd"
+ [0]=>
+ string(7) "stringd"
+ ["key"]=>
+ string(7) "stringd"
+}
+
+-- Iteration 11: undefined data --
+array(4) {
+ [1]=>
+ string(9) "undefined"
+ ["value"]=>
+ string(9) "undefined"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+
+-- Iteration 12: unset data --
+array(4) {
+ [1]=>
+ string(5) "unset"
+ ["value"]=>
+ string(5) "unset"
+ [0]=>
+ string(0) ""
+ ["key"]=>
+ string(0) ""
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt
new file mode 100644
index 000000000..6ac57a736
--- /dev/null
+++ b/ext/standard/tests/array/each_variation4.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test each() function : usage variations - Referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test behaviour of each() when:
+ * 1. Passed an array made up of referenced variables
+ * 2. Passed an array as $arr argument by reference
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+echo "\n-- Array made up of referenced variables: --\n";
+$val1 = 'foo';
+$val2 = 'bar';
+
+$arr1 = array('one' => &$val1, &$val2);
+
+echo "-- Call each until at the end of the array: --\n";
+var_dump( each($arr1) );
+var_dump( each($arr1) );
+var_dump( each($arr1) );
+
+
+echo "\n-- Pass an array by reference to each(): --\n";
+$arr2 = array('zero', 'one', 'two');
+
+var_dump( each(&$arr2) );
+echo "-- Check original array: --\n";
+var_dump($arr2);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Array made up of referenced variables: --
+-- Call each until at the end of the array: --
+array(4) {
+ [1]=>
+ string(3) "foo"
+ ["value"]=>
+ string(3) "foo"
+ [0]=>
+ string(3) "one"
+ ["key"]=>
+ string(3) "one"
+}
+array(4) {
+ [1]=>
+ string(3) "bar"
+ ["value"]=>
+ string(3) "bar"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+bool(false)
+
+-- Pass an array by reference to each(): --
+array(4) {
+ [1]=>
+ string(4) "zero"
+ ["value"]=>
+ string(4) "zero"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+-- Check original array: --
+array(3) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+Done
diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt
new file mode 100644
index 000000000..941ad5e3a
--- /dev/null
+++ b/ext/standard/tests/array/each_variation5.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test each() function : usage variations - Multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test behaviour of each() when passed:
+ * 1. a two-dimensional array
+ * 2. a sub-array
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+$arr = array ('zero',
+ array(1, 2, 3),
+ 'one' => 'un',
+ array('a', 'b', 'c')
+ );
+
+echo "\n-- Pass each() a two-dimensional array --\n";
+for ($i = 1; $i < count($arr); $i++) {
+ var_dump( each($arr) );
+}
+
+echo "\n-- Pass each() a sub-array --\n";
+var_dump( each($arr[2]));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Pass each() a two-dimensional array --
+array(4) {
+ [1]=>
+ string(4) "zero"
+ ["value"]=>
+ string(4) "zero"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+array(4) {
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ ["value"]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [0]=>
+ int(1)
+ ["key"]=>
+ int(1)
+}
+array(4) {
+ [1]=>
+ string(2) "un"
+ ["value"]=>
+ string(2) "un"
+ [0]=>
+ string(3) "one"
+ ["key"]=>
+ string(3) "one"
+}
+
+-- Pass each() a sub-array --
+array(4) {
+ [1]=>
+ string(1) "a"
+ ["value"]=>
+ string(1) "a"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt
new file mode 100644
index 000000000..445d63f31
--- /dev/null
+++ b/ext/standard/tests/array/each_variation6.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test each() function : usage variations - Internal array pointer
+--FILE--
+<?php
+/* Prototype : array each(array $arr)
+ * Description: Return the currently pointed key..value pair in the passed array,
+ * and advance the pointer to the next element
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+/*
+ * Test the position of the internal array pointer after a call to each()
+ */
+
+echo "*** Testing each() : usage variations ***\n";
+
+$arr = array('zero', 'one', 'two', 'abc', 'xyz');
+
+echo "\n-- Current position: --\n";
+echo key($arr) . " => " . current($arr) . "\n";
+
+echo "\n-- Call to each(): --\n";
+var_dump( each($arr) );
+
+echo "\n-- New position: --\n";
+echo key($arr) . " => " . current($arr) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing each() : usage variations ***
+
+-- Current position: --
+0 => zero
+
+-- Call to each(): --
+array(4) {
+ [1]=>
+ string(4) "zero"
+ ["value"]=>
+ string(4) "zero"
+ [0]=>
+ int(0)
+ ["key"]=>
+ int(0)
+}
+
+-- New position: --
+1 => one
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/end_basic.phpt b/ext/standard/tests/array/end_basic.phpt
new file mode 100644
index 000000000..5a6606d38
--- /dev/null
+++ b/ext/standard/tests/array/end_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test end() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of end()
+ */
+
+echo "*** Testing end() : basic functionality ***\n";
+
+$array = array('zero', 'one', 200 => 'two');
+
+echo "\n-- Initial Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Call to end() --\n";
+var_dump(end($array));
+
+echo "\n-- Current Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Add a new element to array --\n";
+$array[2] = 'foo';
+var_dump(end($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : basic functionality ***
+
+-- Initial Position: --
+0 => zero
+
+-- Call to end() --
+string(3) "two"
+
+-- Current Position: --
+200 => two
+
+-- Add a new element to array --
+string(3) "foo"
+===DONE===
diff --git a/ext/standard/tests/array/end_error.phpt b/ext/standard/tests/array/end_error.phpt
new file mode 100644
index 000000000..1efc5ac54
--- /dev/null
+++ b/ext/standard/tests/array/end_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test end() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to end() to test behaviour
+ */
+
+echo "*** Testing end() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing end() function with Zero arguments --\n";
+var_dump( end() );
+
+//Test end with one more than the expected number of arguments
+echo "\n-- Testing end() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( end($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : error conditions ***
+
+-- Testing end() function with Zero arguments --
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+-- Testing end() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/end_variation1.phpt b/ext/standard/tests/array/end_variation1.phpt
new file mode 100644
index 000000000..4ed70aeb2
--- /dev/null
+++ b/ext/standard/tests/array/end_variation1.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test end() function : usage variations - Pass different data types as $array_arg
+--FILE--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg to test behaviour of end()
+ */
+
+echo "*** Testing end() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ var $foo = 'hello, world';
+ 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 $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of end()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( end($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+string(12) "hello, world"
+
+-- Iteration 23 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/end_variation2.phpt b/ext/standard/tests/array/end_variation2.phpt
new file mode 100644
index 000000000..180f7cdfb
--- /dev/null
+++ b/ext/standard/tests/array/end_variation2.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test end() function : usage variations - Multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test end() when passed:
+ * 1. a two-dimensional array
+ * 2. a sub-array
+ * as $array_arg argument.
+ */
+
+echo "*** Testing end() : usage variations ***\n";
+
+$array_arg = array ('a' => 'z', array(9, 8, 7));
+
+echo "\n-- Pass a two-dimensional array as \$array_arg --\n";
+var_dump(end($array_arg));
+
+echo "\n-- Pass a sub-array as \$array_arg --\n";
+var_dump(end($array_arg[0]));
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : usage variations ***
+
+-- Pass a two-dimensional array as $array_arg --
+array(3) {
+ [0]=>
+ int(9)
+ [1]=>
+ int(8)
+ [2]=>
+ int(7)
+}
+
+-- Pass a sub-array as $array_arg --
+int(7)
+===DONE===
diff --git a/ext/standard/tests/array/end_variation3.phpt b/ext/standard/tests/array/end_variation3.phpt
new file mode 100644
index 000000000..cd1e2d0ec
--- /dev/null
+++ b/ext/standard/tests/array/end_variation3.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test end() function : usage variations - Referenced variables
+--FILE--
+<?php
+/* Prototype : mixed end(array $array_arg)
+ * Description: Advances array argument's internal pointer to the last element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how the internal pointer is affected when two variables are referenced to each other
+ */
+
+echo "*** Testing end() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(current($array1));
+end($array1);
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+echo "\n-- Position after calling end() --\n";
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing end() : usage variations ***
+
+-- Initial position of internal pointer --
+string(4) "zero"
+
+-- Position after calling end() --
+$array1: string(3) "two"
+$array2: string(3) "two"
+===DONE===
diff --git a/ext/standard/tests/array/key_basic.phpt b/ext/standard/tests/array/key_basic.phpt
new file mode 100644
index 000000000..8fdca1966
--- /dev/null
+++ b/ext/standard/tests/array/key_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test key() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of key()
+ */
+
+echo "*** Testing key() : basic functionality ***\n";
+
+$array = array ('zero', 99 => 'one', 'two', 'three' => 3);
+echo "\n-- Initial Position: --\n";
+var_dump(key($array));
+
+echo "\n-- Next Position: --\n";
+next($array);
+var_dump(key($array));
+
+echo "\n-- End Position: --\n";
+end($array);
+var_dump(key($array));
+
+echo "\n-- Past end of the array --\n";
+next($array);
+var_dump(key($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : basic functionality ***
+
+-- Initial Position: --
+int(0)
+
+-- Next Position: --
+int(99)
+
+-- End Position: --
+string(5) "three"
+
+-- Past end of the array --
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/key_error.phpt b/ext/standard/tests/array/key_error.phpt
new file mode 100644
index 000000000..ae63bff07
--- /dev/null
+++ b/ext/standard/tests/array/key_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test key() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to key() to test behaviour
+ */
+
+echo "*** Testing key() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing key() function with Zero arguments --\n";
+var_dump( key() );
+
+//Test current with one more than the expected number of arguments
+echo "\n-- Testing key() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( key($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : error conditions ***
+
+-- Testing key() function with Zero arguments --
+
+Warning: Wrong parameter count for key() in %s on line %d
+NULL
+
+-- Testing key() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for key() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/key_variation1.phpt b/ext/standard/tests/array/key_variation1.phpt
new file mode 100644
index 000000000..5b4a367ed
--- /dev/null
+++ b/ext/standard/tests/array/key_variation1.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test key() function : usage variations - Pass different data types as $array_arg arg.
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to test behaviour of key()
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ var $var1;
+ 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 $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of key()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( key($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+NULL
+
+-- Iteration 19 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+string(4) "var1"
+
+-- Iteration 23 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt
new file mode 100644
index 000000000..35389062b
--- /dev/null
+++ b/ext/standard/tests/array/key_variation2.phpt
@@ -0,0 +1,155 @@
+--TEST--
+Test key() function : usage variations
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where keys are different data types as $array_arg to key() to test behaviour
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed as $array_arg
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+);
+
+// loop through each element of $inputs to check the behavior of key()
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator : $key data --\n";
+ while (key($input) !== NULL) {
+ var_dump(key($input));
+ next($input);
+ }
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : usage variations ***
+
+-- Iteration 1 : int data --
+int(0)
+int(1)
+int(12345)
+int(-2345)
+
+-- Iteration 2 : float data --
+int(10)
+int(-10)
+int(0)
+
+-- Iteration 3 : extreme floats data --
+int(12345678)
+int(0)
+
+-- Iteration 4 : null uppercase data --
+string(0) ""
+
+-- Iteration 5 : null lowercase data --
+string(0) ""
+
+-- Iteration 6 : bool lowercase data --
+int(1)
+int(0)
+
+-- Iteration 7 : bool uppercase data --
+int(1)
+int(0)
+
+-- Iteration 8 : empty double quotes data --
+string(0) ""
+
+-- Iteration 9 : empty single quotes data --
+string(0) ""
+
+-- Iteration 10 : string data --
+string(7) "stringd"
+string(7) "strings"
+string(11) "hello world"
+
+-- Iteration 11 : undefined data --
+string(0) ""
+
+-- Iteration 12 : unset data --
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/array/key_variation3.phpt b/ext/standard/tests/array/key_variation3.phpt
new file mode 100644
index 000000000..a23191781
--- /dev/null
+++ b/ext/standard/tests/array/key_variation3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test key() function : usage variations
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how the internal pointer is affected when two variables are referenced to each other
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(key($array1));
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+
+next($array1);
+
+echo "\n-- Position after calling next() --\n";
+echo "\$array1: ";
+var_dump(key($array1));
+echo "\$array2: ";
+var_dump(key($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : usage variations ***
+
+-- Initial position of internal pointer --
+int(0)
+
+-- Position after calling next() --
+$array1: int(1)
+$array2: int(1)
+===DONE===
diff --git a/ext/standard/tests/array/key_variation4.phpt b/ext/standard/tests/array/key_variation4.phpt
new file mode 100644
index 000000000..0ddf05742
--- /dev/null
+++ b/ext/standard/tests/array/key_variation4.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test key() function : usage variations
+--FILE--
+<?php
+/* Prototype : mixed key(array $array_arg)
+ * Description: Return the key of the element currently pointed to by the internal array pointer
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test how key() behaves with muti-dimensional and recursive arrays
+ */
+
+echo "*** Testing key() : usage variations ***\n";
+
+echo "\n-- Two Dimensional Array --\n";
+$multi_array = array ('zero', array (1, 2, 3), 'two');
+echo "Initial Position: ";
+var_dump(key($multi_array));
+
+echo "Next Position: ";
+next($multi_array);
+var_dump(key($multi_array));
+
+echo "End Position: ";
+end($multi_array);
+var_dump(key($multi_array));
+
+echo "\n-- Access an Array Within an Array --\n";
+//accessing an array within an array
+echo "Initial Position: ";
+var_dump(key($multi_array[1]));
+
+echo "\n-- Recursive, Multidimensional Array --\n";
+//create a recursive array
+$multi_array[] = &$multi_array;
+
+//See where internal pointer is after adding more elements
+echo "Current Position: ";
+var_dump(key($multi_array));
+
+//see if internal pointer is in same position as referenced array
+var_dump(key($multi_array[3][3][3]));
+// see if internal pointer is in the same position from when accessing this inner array
+var_dump(key($multi_array[3][3][3][1]));
+$multi_array[3] = null;
+?>
+===DONE===
+--EXPECTF--
+*** Testing key() : usage variations ***
+
+-- Two Dimensional Array --
+Initial Position: int(0)
+Next Position: int(1)
+End Position: int(2)
+
+-- Access an Array Within an Array --
+Initial Position: int(0)
+
+-- Recursive, Multidimensional Array --
+Current Position: int(2)
+int(2)
+int(0)
+===DONE===
diff --git a/ext/standard/tests/array/krsort_basic.phpt b/ext/standard/tests/array/krsort_basic.phpt
new file mode 100644
index 000000000..913256897
--- /dev/null
+++ b/ext/standard/tests/array/krsort_basic.phpt
@@ -0,0 +1,132 @@
+--TEST--
+Test krsort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing array of integer/string values to check the basic functionality
+ * 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 krsort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$unsorted_strings = array( "lemon" => "l", "orange" => "o", "banana" => "b" );
+// an array containing unsorted numeric values with indices
+$unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 );
+
+echo "\n-- Testing krsort() by supplying string array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_strings;
+var_dump( krsort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing krsort() by supplying numeric array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( krsort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing krsort() by supplying string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_strings;
+var_dump( krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing krsort() by supplying numeric array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_numerics;
+var_dump( krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing krsort() by supplying string array, 'flag' = SORT_STRING --\n";
+$temp_array = $unsorted_strings;
+var_dump( krsort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing krsort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = $unsorted_numerics;
+var_dump( krsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : basic functionality ***
+
+-- Testing krsort() by supplying string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ ["orange"]=>
+ string(1) "o"
+ ["lemon"]=>
+ string(1) "l"
+ ["banana"]=>
+ string(1) "b"
+}
+
+-- Testing krsort() by supplying numeric array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [555]=>
+ int(2)
+ [100]=>
+ int(4)
+ [33]=>
+ int(3)
+ [22]=>
+ int(1)
+}
+
+-- Testing krsort() by supplying string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["orange"]=>
+ string(1) "o"
+ ["lemon"]=>
+ string(1) "l"
+ ["banana"]=>
+ string(1) "b"
+}
+
+-- Testing krsort() by supplying numeric array, 'flag' = SORT_REGULAR --
+bool(true)
+array(4) {
+ [555]=>
+ int(2)
+ [100]=>
+ int(4)
+ [33]=>
+ int(3)
+ [22]=>
+ int(1)
+}
+
+-- Testing krsort() by supplying string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["orange"]=>
+ string(1) "o"
+ ["lemon"]=>
+ string(1) "l"
+ ["banana"]=>
+ string(1) "b"
+}
+
+-- Testing krsort() by supplying numeric array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(4) {
+ [555]=>
+ int(2)
+ [100]=>
+ int(4)
+ [33]=>
+ int(3)
+ [22]=>
+ int(1)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_error.phpt b/ext/standard/tests/array/krsort_error.phpt
new file mode 100644
index 000000000..1bca5f928
--- /dev/null
+++ b/ext/standard/tests/array/krsort_error.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test krsort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool krsort(array &array_arg [, int asort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing krsort() function with all possible error conditions
+*/
+
+echo "*** Testing krsort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing krsort() function with zero arguments --\n";
+var_dump( krsort() );
+
+//Test krsort with more than the expected number of arguments
+echo "\n-- Testing krsort() function with more than expected no. of arguments --\n";
+$array_arg = array(1 => 1, 2 => 2);
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC);
+$extra_arg = 10;
+
+// loop through $flag_value array and call krsort with all possible sort flag values
+foreach($flags as $key => $flag){
+ echo "\n- Sort flag = $key -\n";
+ $temp_array = $array_arg;
+ var_dump( krsort($temp_array,$flag, $extra_arg) );
+ var_dump($temp_array);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing krsort() : error conditions ***
+
+-- Testing krsort() function with zero arguments --
+
+Warning: krsort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing krsort() function with more than expected no. of arguments --
+
+- Sort flag = SORT_REGULAR -
+
+Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_STRING -
+
+Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_NUMERIC -
+
+Warning: krsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_object.phpt b/ext/standard/tests/array/krsort_object.phpt
new file mode 100644
index 000000000..36d8589a8
--- /dev/null
+++ b/ext/standard/tests/array/krsort_object.phpt
@@ -0,0 +1,242 @@
+--TEST--
+Test krsort() function : object functionality - sort objects
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+/*
+ * testing krsort() by providing array of integer/string objects with following flag values:
+ * 1.Defualt flag value
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing krsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class Integer
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+}
+
+// class declaration for string objects
+class String
+{
+ 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 with different key values
+$unsorted_int_obj = array (
+ 10 => new Integer(11), 20 => new Integer(66),
+ 3 => new Integer(23), 4 => new Integer(-5),
+ 50 => new Integer(0.001), 6 => new Integer(0)
+);
+
+// array of string objects with different key values
+$unsorted_str_obj = array (
+ "axx" => new String("axx"), "t" => new String("t"),
+ "w" => new String("w"), "py" => new String("py"),
+ "apple" => new String("apple"), "Orange" => new String("Orange"),
+ "Lemon" => new String("Lemon"), "aPPle" => new String("aPPle")
+);
+
+
+echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing krsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(krsort($temp_array) );
+var_dump($temp_array);
+
+// testing krsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(krsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing krsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(krsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing krsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(krsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : object functionality ***
+
+-- Testing krsort() by supplying various object arrays, 'flag' value is defualt --
+bool(true)
+array(6) {
+ [50]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [20]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [10]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [6]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [4]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [3]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+}
+bool(true)
+array(8) {
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+
+-- Testing krsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(6) {
+ [50]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [20]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [10]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [6]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [4]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [3]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+}
+bool(true)
+array(8) {
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation1.phpt b/ext/standard/tests/array/krsort_variation1.phpt
new file mode 100644
index 000000000..e4cbaf8d2
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation1.phpt
@@ -0,0 +1,397 @@
+--TEST--
+Test krsort() function : usage variations - unexpected values for 'array' argument
+--FILE--
+<?php
+/* Prototype : bool krsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() 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 krsort() : usage variations ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+$unexpected_values = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e3,
+ 10.6E-2,
+ 0.5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*15*/ "",
+ '',
+
+ // string data
+/*17*/ "string",
+ '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 krsort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing krsort() 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( krsort($value) ); // expecting : bool(false)
+ var_dump( krsort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( krsort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( krsort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: krsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/krsort_variation10.phpt b/ext/standard/tests/array/krsort_variation10.phpt
new file mode 100644
index 000000000..f56d2870b
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation10.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test krsort() function : usage variations - sort heredoc strings
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of heredoc strings for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// Different heredoc strings to be sorted
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+$array = array (
+ $simple_heredoc1 => "Heredoc",
+ $simple_heredoc2 => "HEREDOC",
+ $multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!"
+);
+
+echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' value is defualt --\n";
+$temp_array = $array;
+var_dump(krsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $array;
+var_dump(krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_STRING --\n";
+$temp_array = $array;
+var_dump(krsort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying heredoc string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+}
+
+-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+}
+
+-- Testing krsort() by supplying heredoc string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation11.phpt b/ext/standard/tests/array/krsort_variation11.phpt
new file mode 100644
index 000000000..0cfa4821a
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation11.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test krsort() function : usage variations - sort bool values
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of boolean values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(krsort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is defualt --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+
+-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --
+bool(true)
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/krsort_variation2.phpt b/ext/standard/tests/array/krsort_variation2.phpt
new file mode 100644
index 000000000..c567f766c
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation2.phpt
@@ -0,0 +1,307 @@
+--TEST--
+Test krsort() function : usage variations - unexpected values for 'sort_flags' argument
+--FILE--
+<?php
+/* Prototype : bool krsort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// an array for checking unexpected behavior
+$unsorted_values = array(10 => 10, 2 => 2, 45 => 45);
+
+//array of unexpected 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 krsort()
+// when 'sort_flags' arugment is supplied with different values
+echo "\n-- Testing krsort() 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( krsort($temp_array, $value) );
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying different unexpected values for 'sort_flags' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 4 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 5 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 6 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 7 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 8 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 9 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 10 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 11 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 12 --
+bool(true)
+array(3) {
+ [45]=>
+ int(45)
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+}
+-- Iteration 13 --
+
+Warning: krsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 14 --
+
+Warning: krsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 15 --
+
+Warning: krsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 16 --
+
+Warning: krsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 17 --
+
+Warning: krsort() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 18 --
+
+Warning: krsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 19 --
+
+Warning: krsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 20 --
+
+Warning: krsort() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation3.phpt b/ext/standard/tests/array/krsort_variation3.phpt
new file mode 100644
index 000000000..8f411a973
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation3.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test krsort() function : usage variations - sort integer/float values
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing array of integer/float/mixed 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
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// diff. associative arrays to sort
+$various_arrays = array(
+ // negative/posative integer key value array
+ array(1 => 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41),
+
+ // float key values
+ array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1),
+
+ // mixed value array with different types of keys
+ 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)
+);
+
+// set of possible flag values
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing krsort() by supplying various integer/float arrays --\n";
+
+// loop through to test krsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flags array and call krsort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [7]=>
+ int(0)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [-2]=>
+ int(-11)
+ [-4]=>
+ int(-21)
+ [-6]=>
+ int(-31)
+ [-10]=>
+ int(-41)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [7]=>
+ int(0)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [-2]=>
+ int(-11)
+ [-4]=>
+ int(-21)
+ [-6]=>
+ int(-31)
+ [-10]=>
+ int(-41)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [8]=>
+ int(41)
+ [7]=>
+ int(0)
+ [5]=>
+ int(31)
+ [3]=>
+ int(21)
+ [1]=>
+ int(11)
+ [-2]=>
+ int(-11)
+ [-4]=>
+ int(-21)
+ [-6]=>
+ int(-31)
+ [-10]=>
+ int(-41)
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [0]=>
+ float(0.5)
+ [-7]=>
+ float(-0.1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [0]=>
+ float(0.5)
+ [-7]=>
+ float(-0.1)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(6) {
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [3]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [0]=>
+ float(0.5)
+ [-7]=>
+ float(-0.1)
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [6]=>
+ float(0.09)
+ [5]=>
+ int(0)
+ [4]=>
+ int(-1)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [-3]=>
+ float(-0.01)
+ [-8]=>
+ float(-0.9)
+ [-10]=>
+ float(-0.106)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [6]=>
+ float(0.09)
+ [5]=>
+ int(0)
+ [4]=>
+ int(-1)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [-3]=>
+ float(-0.01)
+ [-8]=>
+ float(-0.9)
+ [-10]=>
+ float(-0.106)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [11]=>
+ int(33)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [6]=>
+ float(0.09)
+ [5]=>
+ int(0)
+ [4]=>
+ int(-1)
+ [2]=>
+ float(0.0021)
+ [1]=>
+ float(0.0001)
+ [-3]=>
+ float(-0.01)
+ [-8]=>
+ float(-0.9)
+ [-10]=>
+ float(-0.106)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation4.phpt b/ext/standard/tests/array/krsort_variation4.phpt
new file mode 100644
index 000000000..3df924ac8
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation4.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test krsort() function : usage variations - sort octal values
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of octal 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
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array (
+ 01235 => 01, 0321 => 02, 0345 => 03, 066 => 04, 0772 => 05,
+ 077 => 06, -066 => -01, -0345 => -02, 0 => 0
+);
+
+echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( krsort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( krsort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( krsort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [669]=>
+ int(1)
+ [506]=>
+ int(5)
+ [229]=>
+ int(3)
+ [209]=>
+ int(2)
+ [63]=>
+ int(6)
+ [54]=>
+ int(4)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-1)
+ [-229]=>
+ int(-2)
+}
+
+-- Testing krsort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [669]=>
+ int(1)
+ [506]=>
+ int(5)
+ [229]=>
+ int(3)
+ [209]=>
+ int(2)
+ [63]=>
+ int(6)
+ [54]=>
+ int(4)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-1)
+ [-229]=>
+ int(-2)
+}
+
+-- Testing krsort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [669]=>
+ int(1)
+ [506]=>
+ int(5)
+ [229]=>
+ int(3)
+ [209]=>
+ int(2)
+ [63]=>
+ int(6)
+ [54]=>
+ int(4)
+ [0]=>
+ int(0)
+ [-54]=>
+ int(-1)
+ [-229]=>
+ int(-2)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation5.phpt b/ext/standard/tests/array/krsort_variation5.phpt
new file mode 100644
index 000000000..59621654c
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation5.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test krsort() function : usage variations - sort strings
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of string values for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+$various_arrays = array (
+ // diff. escape sequence chars with key values
+ 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 containing different strings with key values
+ array ( 'Lemon' => "lemoN", 'o' => "Orange", 'B' => "banana", 'Apple' => "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 krsort() by supplying various string arrays --\n";
+
+// loop through to test krsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array) ); // expecting : bool(true)
+ var_dump($temp_array);
+
+ // loop through $flags array and call krsort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(krsort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\e"]=>
+ string(2) "\e"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\a"]=>
+ string(2) "\a"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ [""]=>
+ NULL
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\e"]=>
+ string(2) "\e"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\a"]=>
+ string(2) "\a"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ [""]=>
+ NULL
+}
+- Sort flag = SORT_STRING -
+bool(true)
+array(11) {
+ ["\xhh"]=>
+ string(4) "\xhh"
+ ["\e"]=>
+ string(2) "\e"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\a"]=>
+ string(2) "\a"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ [""]=>
+ NULL
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ ["x"]=>
+ string(1) "X"
+ ["te"]=>
+ string(4) "Test"
+ ["t"]=>
+ string(4) "TTTT"
+ ["o"]=>
+ string(6) "Orange"
+ ["X"]=>
+ string(1) "x"
+ ["W"]=>
+ string(2) "ww"
+ ["T"]=>
+ string(3) "ttt"
+ ["O"]=>
+ string(6) "oraNGe"
+ ["Lemon"]=>
+ string(5) "lemoN"
+ ["B"]=>
+ string(6) "BANANA"
+ ["Apple"]=>
+ string(5) "apple"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ ["x"]=>
+ string(1) "X"
+ ["te"]=>
+ string(4) "Test"
+ ["t"]=>
+ string(4) "TTTT"
+ ["o"]=>
+ string(6) "Orange"
+ ["X"]=>
+ string(1) "x"
+ ["W"]=>
+ string(2) "ww"
+ ["T"]=>
+ string(3) "ttt"
+ ["O"]=>
+ string(6) "oraNGe"
+ ["Lemon"]=>
+ string(5) "lemoN"
+ ["B"]=>
+ string(6) "BANANA"
+ ["Apple"]=>
+ string(5) "apple"
+}
+- Sort flag = SORT_STRING -
+bool(true)
+array(11) {
+ ["x"]=>
+ string(1) "X"
+ ["te"]=>
+ string(4) "Test"
+ ["t"]=>
+ string(4) "TTTT"
+ ["o"]=>
+ string(6) "Orange"
+ ["X"]=>
+ string(1) "x"
+ ["W"]=>
+ string(2) "ww"
+ ["T"]=>
+ string(3) "ttt"
+ ["O"]=>
+ string(6) "oraNGe"
+ ["Lemon"]=>
+ string(5) "lemoN"
+ ["B"]=>
+ string(6) "BANANA"
+ ["Apple"]=>
+ string(5) "apple"
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation6.phpt b/ext/standard/tests/array/krsort_variation6.phpt
new file mode 100644
index 000000000..167d0ee7d
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation6.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test krsort() function : usage variations - sort hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing array of hexa-decimal 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
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// an array containing unsorted hexadecimal values with keys
+$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 krsort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(krsort( $temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(krsort( $temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(krsort( $temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying hexadecimal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+
+-- Testing krsort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [4095]=>
+ int(4095)
+ [682]=>
+ int(682)
+ [427]=>
+ int(427)
+ [255]=>
+ int(255)
+ [187]=>
+ int(187)
+ [15]=>
+ int(15)
+ [0]=>
+ int(0)
+ [-255]=>
+ int(-255)
+ [-682]=>
+ int(-682)
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation7.phpt b/ext/standard/tests/array/krsort_variation7.phpt
new file mode 100644
index 000000000..9ba3fc544
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation7.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test krsort() function : usage variations - sort array with diff. sub arrays
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing krsort() by providing arrays contains sub arrays for $array argument
+ * with flowing flag values
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing krsort() : usage variations ***\n";
+
+// array with diff sub arrays to be sorted
+$various_arrays = array (
+ // null array
+ 1 => array(),
+
+ // array contains null sub array
+ 2 => array( 1 => array() ),
+
+ // array of arrays along with some values
+ 3 => array(4 => 44, 1 => 11, 3 => array(64,61) ),
+
+ // array contains sub arrays
+ 4 => array ( 3 => array(33,-5,6), 1 => array(11),
+ 2 => array(22,-55), 0 => array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing krsort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test krsort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() 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) {
+ [1]=>
+ array(0) {
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(1) {
+ [1]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ [4]=>
+ int(44)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(11)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [4]=>
+ int(44)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(11)
+}
+
+-- Iteration 4 --
+- With defualt sort flag -
+bool(true)
+array(4) {
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [0]=>
+ array(0) {
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [0]=>
+ array(0) {
+ }
+}
+Done
diff --git a/ext/standard/tests/array/krsort_variation8.phpt b/ext/standard/tests/array/krsort_variation8.phpt
new file mode 100644
index 000000000..20276ade6
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/array/krsort_variation9.phpt b/ext/standard/tests/array/krsort_variation9.phpt
new file mode 100644
index 000000000..d7d8343b0
--- /dev/null
+++ b/ext/standard/tests/array/krsort_variation9.phpt
@@ -0,0 +1,257 @@
+--TEST--
+Test krsort() function : usage variations - sort array with/without key values
+--FILE--
+<?php
+/* Prototype : bool krsort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key in reverse order, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing krsort() by providing arrays with/without key values for $array argument
+ * with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ */
+
+echo "*** Testing krsort() : 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", 1 => "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 krsort() by supplying various arrays with/without key values --\n";
+
+// loop through to test krsort() with different arrays,
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( krsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing krsort() : usage variations ***
+
+-- Testing krsort() by supplying various arrays with/without key values --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(5) {
+ [9]=>
+ int(11)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [9]=>
+ int(11)
+ [8]=>
+ int(33)
+ [7]=>
+ int(22)
+ [6]=>
+ int(66)
+ [5]=>
+ int(55)
+}
+
+-- Iteration 2 --
+- With defualt 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 defualt sort flag -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [5]=>
+ int(6)
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 4 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ [5]=>
+ string(6) "second"
+ [1]=>
+ string(5) "third"
+ [0]=>
+ string(5) "first"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [5]=>
+ string(6) "second"
+ [1]=>
+ string(5) "third"
+ [0]=>
+ string(5) "first"
+}
+
+-- Iteration 5 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [8]=>
+ int(1)
+ [4]=>
+ int(1)
+ [3]=>
+ int(13)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [9]=>
+ int(19)
+ [8]=>
+ int(1)
+ [4]=>
+ int(1)
+ [3]=>
+ int(13)
+ [1]=>
+ int(1)
+ [0]=>
+ int(1)
+}
+
+-- Iteration 6 --
+- With defualt sort flag -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(2) {
+ ["foo"]=>
+ int(1)
+ ["bar"]=>
+ string(3) "baz"
+}
+
+-- Iteration 7 --
+- With defualt sort flag -
+bool(true)
+array(4) {
+ ["d"]=>
+ int(5)
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["a"]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["d"]=>
+ int(5)
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["a"]=>
+ int(1)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_basic.phpt b/ext/standard/tests/array/ksort_basic.phpt
new file mode 100644
index 000000000..fdc8bd8dc
--- /dev/null
+++ b/ext/standard/tests/array/ksort_basic.phpt
@@ -0,0 +1,131 @@
+--TEST--
+Test ksort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing array of integer/string values to check the basic functionality 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 ksort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$unsorted_strings = array( "lemon" => "l", "orange" => "o", "banana" => "b" );
+// an array containing unsorted numeric values with indices
+$unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 );
+
+echo "\n-- Testing ksort() by supplying string array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_strings;
+var_dump( ksort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing ksort() by supplying numeric array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( ksort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing ksort() by supplying string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_strings;
+var_dump( ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing ksort() by supplying numeric array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_numerics;
+var_dump( ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing ksort() by supplying string array, 'flag' = SORT_STRING --\n";
+$temp_array = $unsorted_strings;
+var_dump( ksort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing ksort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = $unsorted_numerics;
+var_dump( ksort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : basic functionality ***
+
+-- Testing ksort() by supplying string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ ["banana"]=>
+ string(1) "b"
+ ["lemon"]=>
+ string(1) "l"
+ ["orange"]=>
+ string(1) "o"
+}
+
+-- Testing ksort() by supplying numeric array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [22]=>
+ int(1)
+ [33]=>
+ int(3)
+ [100]=>
+ int(4)
+ [555]=>
+ int(2)
+}
+
+-- Testing ksort() by supplying string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["banana"]=>
+ string(1) "b"
+ ["lemon"]=>
+ string(1) "l"
+ ["orange"]=>
+ string(1) "o"
+}
+
+-- Testing ksort() by supplying numeric array, 'flag' = SORT_REGULAR --
+bool(true)
+array(4) {
+ [22]=>
+ int(1)
+ [33]=>
+ int(3)
+ [100]=>
+ int(4)
+ [555]=>
+ int(2)
+}
+
+-- Testing ksort() by supplying string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["banana"]=>
+ string(1) "b"
+ ["lemon"]=>
+ string(1) "l"
+ ["orange"]=>
+ string(1) "o"
+}
+
+-- Testing ksort() by supplying numeric array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(4) {
+ [22]=>
+ int(1)
+ [33]=>
+ int(3)
+ [100]=>
+ int(4)
+ [555]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_error.phpt b/ext/standard/tests/array/ksort_error.phpt
new file mode 100644
index 000000000..f2b102ae0
--- /dev/null
+++ b/ext/standard/tests/array/ksort_error.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test ksort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool ksort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing ksort() function with all possible error conditions
+*/
+
+echo "*** Testing ksort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing ksort() function with Zero arguments --\n";
+var_dump( ksort() );
+
+//Test ksort with more than the expected number of arguments
+echo "\n-- Testing ksort() function with more than expected no. of arguments --\n";
+$array_arg = array(1 => 1, 2 => 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 call krsort with all possible sort flag values
+foreach($flag_value as $key => $flag){
+ echo "\n- Sort flag = $key -\n";
+ $temp_array = $array_arg;
+ var_dump( ksort($temp_array,$flag, $extra_arg) );
+ var_dump( $temp_array);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ksort() : error conditions ***
+
+-- Testing ksort() function with Zero arguments --
+
+Warning: ksort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing ksort() function with more than expected no. of arguments --
+
+- Sort flag = SORT_REGULAR -
+
+Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_STRING -
+
+Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+
+- Sort flag = SORT_NUMERIC -
+
+Warning: ksort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_object.phpt b/ext/standard/tests/array/ksort_object.phpt
new file mode 100644
index 000000000..20e8ba26e
--- /dev/null
+++ b/ext/standard/tests/array/ksort_object.phpt
@@ -0,0 +1,241 @@
+--TEST--
+Test ksort() function : object functionality - sort objects
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+/*
+ * testing ksort() by providing array ofinteger/string objects with following flag values:
+ * 1.SORT_NUMERIC - compare items numerically
+ * 2.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : object functionality ***\n";
+
+// class declaration for integer objects
+class Integer
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+}
+
+// class declaration for string objects
+class String
+{
+ 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 (
+ 11 => new Integer(11), 66 => new Integer(66),
+ 23 => new Integer(23), -5 => new Integer(-5),
+ 1 => new Integer(0.001), 0 => new Integer(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "axx" => new String("axx"), "t" => new String("t"),
+ "w" => new String("w"), "py" => new String("py"),
+ "apple" => new String("apple"), "Orange" => new String("Orange"),
+ "Lemon" => new String("Lemon"), "aPPle" => new String("aPPle")
+);
+echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing ksort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(ksort($temp_array) );
+var_dump($temp_array);
+
+// testing ksort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(ksort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing ksort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(ksort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing ksort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(ksort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : object functionality ***
+
+-- Testing ksort() by supplying various object arrays, 'flag' value is defualt --
+bool(true)
+array(6) {
+ [-5]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [0]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [1]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [11]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [23]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [66]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+
+-- Testing ksort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(6) {
+ [-5]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [0]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [1]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [11]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [23]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [66]=>
+ object(Integer)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ ["Lemon"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ ["Orange"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["aPPle"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["apple"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["axx"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["py"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["t"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["w"]=>
+ object(String)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation1.phpt b/ext/standard/tests/array/ksort_variation1.phpt
new file mode 100644
index 000000000..d8c037fa9
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation1.phpt
@@ -0,0 +1,397 @@
+--TEST--
+Test ksort() function : usage variations - unexpected values for 'array' argument
+--FILE--
+<?php
+/* Prototype : bool ksort(array &array [, int sort_flags])
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() 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 ksort() : usage variations ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+$unexpected_values = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e3,
+ 10.6E-2,
+ 0.5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*11*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*15*/ "",
+ '',
+
+ // string data
+/*17*/ "string",
+ '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 ksort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing ksort() 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( ksort($value) ); // expecting : bool(false)
+ var_dump( ksort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( ksort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( ksort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: ksort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/ksort_variation10.phpt b/ext/standard/tests/array/ksort_variation10.phpt
new file mode 100644
index 000000000..051bc3061
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation10.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Test ksort() function : usage variations - sort octal values
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of octal 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
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array (
+ 01235 => 01, 0321 => 02, 0345 => 03, 066 => 04, 0772 => 05,
+ 077 => 06, -066 => -01, -0345 => -02, 0 => 0
+);
+
+echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( ksort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( ksort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-2)
+ [-54]=>
+ int(-1)
+ [0]=>
+ int(0)
+ [54]=>
+ int(4)
+ [63]=>
+ int(6)
+ [209]=>
+ int(2)
+ [229]=>
+ int(3)
+ [506]=>
+ int(5)
+ [669]=>
+ int(1)
+}
+
+-- Testing ksort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-2)
+ [-54]=>
+ int(-1)
+ [0]=>
+ int(0)
+ [54]=>
+ int(4)
+ [63]=>
+ int(6)
+ [209]=>
+ int(2)
+ [229]=>
+ int(3)
+ [506]=>
+ int(5)
+ [669]=>
+ int(1)
+}
+
+-- Testing ksort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-2)
+ [-54]=>
+ int(-1)
+ [0]=>
+ int(0)
+ [54]=>
+ int(4)
+ [63]=>
+ int(6)
+ [209]=>
+ int(2)
+ [229]=>
+ int(3)
+ [506]=>
+ int(5)
+ [669]=>
+ int(1)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation11.phpt b/ext/standard/tests/array/ksort_variation11.phpt
new file mode 100644
index 000000000..347df65c4
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation11.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test ksort() function : usage variations - sort heredoc strings
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of heredoc strings for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// Different heredoc strings to be sorted
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+$array = array (
+ $simple_heredoc1 => "Heredoc",
+ $simple_heredoc2 => "HEREDOC",
+ $multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!"
+);
+
+echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' value is defualt --\n";
+$temp_array = $array;
+var_dump(ksort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $array;
+var_dump(ksort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_STRING --\n";
+$temp_array = $array;
+var_dump(ksort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying heredoc string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+}
+
+-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+}
+
+-- Testing ksort() by supplying heredoc string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["HEREDOC"]=>
+ string(7) "HEREDOC"
+ ["Heredoc"]=>
+ string(7) "Heredoc"
+ ["heredoc string with!@# and 123
+Test this!!!"]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation2.phpt b/ext/standard/tests/array/ksort_variation2.phpt
new file mode 100644
index 000000000..f765977d2
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation2.phpt
@@ -0,0 +1,307 @@
+--TEST--
+Test ksort() function : usage variations - unexpected values for 'sort_flags' argument
+--FILE--
+<?php
+/* Prototype : bool ksort(array &array_arg [, int sort_flags])
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// an array for checking unexpected behavior
+$unsorted_values = array(10 => 10, 2 => 2, 45 => 45);
+
+//array of unexpected 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 ksort()
+// when 'sort_flags' arugment is supplied with different values
+echo "\n-- Testing ksort() 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( ksort($temp_array, $value) );
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying different unexpected values for 'sort_flags' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 4 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 5 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 6 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 7 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 8 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 9 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 10 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 11 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 12 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [10]=>
+ int(10)
+ [45]=>
+ int(45)
+}
+-- Iteration 13 --
+
+Warning: ksort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 14 --
+
+Warning: ksort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 15 --
+
+Warning: ksort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 16 --
+
+Warning: ksort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 17 --
+
+Warning: ksort() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 18 --
+
+Warning: ksort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 19 --
+
+Warning: ksort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+-- Iteration 20 --
+
+Warning: ksort() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+array(3) {
+ [10]=>
+ int(10)
+ [2]=>
+ int(2)
+ [45]=>
+ int(45)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation3.phpt b/ext/standard/tests/array/ksort_variation3.phpt
new file mode 100644
index 000000000..4029b9b8d
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation3.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test ksort() function : usage variations - sort integer/float values
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing array of integer/float/mixed 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
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// diff. associative arrays to sort
+$various_arrays = array(
+ // negative/posative integer key value array
+ array(1 => 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41),
+
+ // float key values
+ array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1),
+
+ // mixed value array with different types of keys
+ 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)
+);
+
+// set of possible flag values
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing ksort() by supplying various integer/float arrays --\n";
+
+// loop through to test ksort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flags array and call ksort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(9) {
+ [-10]=>
+ int(-41)
+ [-6]=>
+ int(-31)
+ [-4]=>
+ int(-21)
+ [-2]=>
+ int(-11)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [7]=>
+ int(0)
+ [8]=>
+ int(41)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [-10]=>
+ int(-41)
+ [-6]=>
+ int(-31)
+ [-4]=>
+ int(-21)
+ [-2]=>
+ int(-11)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [7]=>
+ int(0)
+ [8]=>
+ int(41)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [-10]=>
+ int(-41)
+ [-6]=>
+ int(-31)
+ [-4]=>
+ int(-21)
+ [-2]=>
+ int(-11)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [7]=>
+ int(0)
+ [8]=>
+ int(41)
+}
+
+-- Iteration 2 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [-7]=>
+ float(-0.1)
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [-7]=>
+ float(-0.1)
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(6) {
+ [-7]=>
+ float(-0.1)
+ [0]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+ [4]=>
+ float(0.106)
+ [6]=>
+ float(0.0001)
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ [-10]=>
+ float(-0.106)
+ [-8]=>
+ float(-0.9)
+ [-3]=>
+ float(-0.01)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [4]=>
+ int(-1)
+ [5]=>
+ int(0)
+ [6]=>
+ float(0.09)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [11]=>
+ int(33)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [-10]=>
+ float(-0.106)
+ [-8]=>
+ float(-0.9)
+ [-3]=>
+ float(-0.01)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [4]=>
+ int(-1)
+ [5]=>
+ int(0)
+ [6]=>
+ float(0.09)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [11]=>
+ int(33)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [-10]=>
+ float(-0.106)
+ [-8]=>
+ float(-0.9)
+ [-3]=>
+ float(-0.01)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [4]=>
+ int(-1)
+ [5]=>
+ int(0)
+ [6]=>
+ float(0.09)
+ [7]=>
+ int(2)
+ [9]=>
+ float(0.106)
+ [11]=>
+ int(33)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation4.phpt b/ext/standard/tests/array/ksort_variation4.phpt
new file mode 100644
index 000000000..d6b3f482b
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation4.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test ksort() function : usage variations - sort bool values
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of boolean values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(ksort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is defualt --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+
+-- Testing ksort() by supplying boolean value array, 'flag' value is SORT_STRING --
+bool(true)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation5.phpt b/ext/standard/tests/array/ksort_variation5.phpt
new file mode 100644
index 000000000..958476c01
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation5.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test ksort() function : usage variations - sort strings
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of string values for $array argument with
+ * following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+$various_arrays = array (
+ // diff. escape sequence chars with key values
+ 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 containing different strings with key values
+ array ( 'Lemon' => "lemoN", 'o' => "Orange", 'B' => "banana", 'Apple' => "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 ksort() by supplying various string arrays --\n";
+
+// loop through to test ksort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array) ); // expecting : bool(true)
+ var_dump($temp_array);
+
+ // loop through $flags array and call ksort() with all possible sort flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(ksort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(11) {
+ [""]=>
+ 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(11) {
+ [""]=>
+ 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(11) {
+ [""]=>
+ 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 defualt sort flag -
+bool(true)
+array(11) {
+ ["Apple"]=>
+ string(5) "apple"
+ ["B"]=>
+ string(6) "BANANA"
+ ["Lemon"]=>
+ string(5) "lemoN"
+ ["O"]=>
+ string(6) "oraNGe"
+ ["T"]=>
+ string(3) "ttt"
+ ["W"]=>
+ string(2) "ww"
+ ["X"]=>
+ string(1) "x"
+ ["o"]=>
+ string(6) "Orange"
+ ["t"]=>
+ string(4) "TTTT"
+ ["te"]=>
+ string(4) "Test"
+ ["x"]=>
+ string(1) "X"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ ["Apple"]=>
+ string(5) "apple"
+ ["B"]=>
+ string(6) "BANANA"
+ ["Lemon"]=>
+ string(5) "lemoN"
+ ["O"]=>
+ string(6) "oraNGe"
+ ["T"]=>
+ string(3) "ttt"
+ ["W"]=>
+ string(2) "ww"
+ ["X"]=>
+ string(1) "x"
+ ["o"]=>
+ string(6) "Orange"
+ ["t"]=>
+ string(4) "TTTT"
+ ["te"]=>
+ string(4) "Test"
+ ["x"]=>
+ string(1) "X"
+}
+- Sort flag = SORT_STRING -
+bool(true)
+array(11) {
+ ["Apple"]=>
+ string(5) "apple"
+ ["B"]=>
+ string(6) "BANANA"
+ ["Lemon"]=>
+ string(5) "lemoN"
+ ["O"]=>
+ string(6) "oraNGe"
+ ["T"]=>
+ string(3) "ttt"
+ ["W"]=>
+ string(2) "ww"
+ ["X"]=>
+ string(1) "x"
+ ["o"]=>
+ string(6) "Orange"
+ ["t"]=>
+ string(4) "TTTT"
+ ["te"]=>
+ string(4) "Test"
+ ["x"]=>
+ string(1) "X"
+}
+Done
diff --git a/ext/standard/tests/array/ksort_variation6.phpt b/ext/standard/tests/array/ksort_variation6.phpt
new file mode 100644
index 000000000..1243ab123
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation6.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test ksort() function : usage variations - sort hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing array of hexa-decimal 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
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// an array containng unsorted hexadecimal values with keys
+// 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 ksort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(ksort( $temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(ksort( $temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(ksort( $temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() 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 ksort() 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 ksort() 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/ksort_variation7.phpt b/ext/standard/tests/array/ksort_variation7.phpt
new file mode 100644
index 000000000..a0f454bbd
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation7.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test ksort() function : usage variations - sort array with diff. sub arrays
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing ksort() by providing arrays containing sub arrays for $array argument
+ * with flowing flag values:
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing ksort() : usage variations ***\n";
+
+// array with diff sub arrays to be sorted
+$various_arrays = array (
+ // null array
+ 1 => array(),
+
+ // array contains null sub array
+ 2 => array( 1 => array() ),
+
+ // array of arrays along with some values
+ 3 => array(4 => 44, 1 => 11, 3 => array(64,61) ),
+
+ // array contains sub arrays
+ 4 => array ( 3 => array(33,-5,6), 1 => array(11),
+ 2 => array(22,-55), 0 => array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing ksort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test ksort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() 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) {
+ [1]=>
+ array(0) {
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(1) {
+ [1]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+- With defualt sort flag -
+bool(true)
+array(3) {
+ [1]=>
+ int(11)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [4]=>
+ int(44)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [1]=>
+ int(11)
+ [3]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [4]=>
+ int(44)
+}
+
+-- 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/ksort_variation8.phpt b/ext/standard/tests/array/ksort_variation8.phpt
new file mode 100644
index 000000000..787e71d61
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/array/ksort_variation9.phpt b/ext/standard/tests/array/ksort_variation9.phpt
new file mode 100644
index 000000000..ed406e20b
--- /dev/null
+++ b/ext/standard/tests/array/ksort_variation9.phpt
@@ -0,0 +1,256 @@
+--TEST--
+Test ksort() function : usage variations - sorting arrays with/without keys
+--FILE--
+<?php
+/* Prototype : bool ksort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array by key, maintaining key to data correlation.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing ksort() by providing arrays with/without key values for $array argument with following flag values:
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ */
+
+echo "*** Testing ksort() : 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", 1 => "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 ksort() by supplying various arrays with/without key values --\n";
+
+// loop through to test ksort() with different arrays,
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump( ksort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ksort() : usage variations ***
+
+-- Testing ksort() by supplying various arrays with/without key values --
+
+-- Iteration 1 --
+- With defualt sort flag -
+bool(true)
+array(5) {
+ [5]=>
+ int(55)
+ [6]=>
+ int(66)
+ [7]=>
+ int(22)
+ [8]=>
+ int(33)
+ [9]=>
+ int(11)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [5]=>
+ int(55)
+ [6]=>
+ int(66)
+ [7]=>
+ int(22)
+ [8]=>
+ int(33)
+ [9]=>
+ int(11)
+}
+
+-- Iteration 2 --
+- With defualt 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 defualt 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 defualt sort flag -
+bool(true)
+array(3) {
+ [0]=>
+ string(5) "first"
+ [1]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [0]=>
+ string(5) "first"
+ [1]=>
+ string(5) "third"
+ [5]=>
+ string(6) "second"
+}
+
+-- Iteration 5 --
+- With defualt sort flag -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(19)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(13)
+ [4]=>
+ int(1)
+ [8]=>
+ int(1)
+ [9]=>
+ int(19)
+}
+
+-- Iteration 6 --
+- With defualt 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 defualt sort flag -
+bool(true)
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["d"]=>
+ int(5)
+}
+Done
diff --git a/ext/standard/tests/array/natcasesort_basic.phpt b/ext/standard/tests/array/natcasesort_basic.phpt
new file mode 100644
index 000000000..cf6cc5728
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_basic.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test natcasesort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of natcasesort()
+ */
+
+echo "*** Testing natcasesort() : basic functionality ***\n";
+
+$array = array ('A01', 'a1', 'b10', 'a01', 'b01');
+echo "\n-- Before sorting: --\n";
+var_dump($array);
+
+echo "\n-- After Sorting: --\n";
+var_dump(natcasesort($array));
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : basic functionality ***
+
+-- Before sorting: --
+array(5) {
+ [0]=>
+ string(3) "A01"
+ [1]=>
+ string(2) "a1"
+ [2]=>
+ string(3) "b10"
+ [3]=>
+ string(3) "a01"
+ [4]=>
+ string(3) "b01"
+}
+
+-- After Sorting: --
+bool(true)
+array(5) {
+ [3]=>
+ string(3) "a01"
+ [0]=>
+ string(3) "A01"
+ [1]=>
+ string(2) "a1"
+ [4]=>
+ string(3) "b01"
+ [2]=>
+ string(3) "b10"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_error.phpt b/ext/standard/tests/array/natcasesort_error.phpt
new file mode 100644
index 000000000..0f18677ca
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test natcasesort() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to natcasesort() to test behaviour
+ */
+
+echo "*** Testing natcasesort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing natcasesort() function with Zero arguments --\n";
+var_dump( natcasesort() );
+
+// Test natcasesort with one more than the expected number of arguments
+echo "\n-- Testing natcasesort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( natcasesort($array_arg, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : error conditions ***
+
+-- Testing natcasesort() function with Zero arguments --
+
+Warning: Wrong parameter count for natcasesort() in %s on line %d
+NULL
+
+-- Testing natcasesort() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for natcasesort() in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_object1.phpt b/ext/standard/tests/array/natcasesort_object1.phpt
new file mode 100644
index 000000000..aab98a45d
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_object1.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test natcasesort() function : object functionality - array of objects
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass natcasesort() an array of objects to test how it re-orders them
+ */
+
+echo "*** Testing natcasesort() : object functionality ***\n";
+
+// class declaration for string objects
+class for_string_natcasesort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->class_value;
+ }
+
+}
+
+
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_natcasesort("axx"), new for_string_natcasesort("t"),
+ new for_string_natcasesort("w"), new for_string_natcasesort("py"),
+ new for_string_natcasesort("apple"), new for_string_natcasesort("Orange"),
+ new for_string_natcasesort("Lemon"), new for_string_natcasesort("aPPle")
+);
+
+
+echo "\n-- Testing natcasesort() by supplying various object arrays --\n";
+
+// testing natcasesort() function by supplying string object array
+var_dump(natcasesort($unsorted_str_obj) );
+var_dump($unsorted_str_obj);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : object functionality ***
+
+-- Testing natcasesort() by supplying various object arrays --
+bool(true)
+array(8) {
+ [4]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [7]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [0]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [6]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ [5]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [3]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [1]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [2]=>
+ object(for_string_natcasesort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_object2.phpt b/ext/standard/tests/array/natcasesort_object2.phpt
new file mode 100644
index 000000000..2b4acec25
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_object2.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test natcasesort() function : object functionality - mixed visibility within objects
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass natcasesort() an array of objects which have properties of different
+ * visibilities to test how it re-orders the array.
+ */
+
+echo "*** Testing natcasesort() : object functionality ***\n";
+
+// class declaration for string objects
+class for_string_natcasesort
+{
+ 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->public_class_value;
+ }
+
+}
+
+// array of string objects
+$unsorted_str_obj = array (
+new for_string_natcasesort("axx","AXX","ass"),
+new for_string_natcasesort("t","eee","abb"),
+new for_string_natcasesort("w","W", "c"),
+new for_string_natcasesort("py","PY", "pt"),
+);
+
+
+echo "\n-- Testing natcasesort() by supplying object arrays --\n";
+
+// testing natcasesort() function by supplying string object array
+$temp_array = $unsorted_str_obj;
+var_dump(natcasesort($temp_array) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : object functionality ***
+
+-- Testing natcasesort() by supplying object arrays --
+bool(true)
+array(4) {
+ [0]=>
+ object(for_string_natcasesort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value:private"]=>
+ string(3) "AXX"
+ ["protected_class_value:protected"]=>
+ string(3) "ass"
+ }
+ [3]=>
+ object(for_string_natcasesort)#%d (3) {
+ ["public_class_value"]=>
+ string(2) "py"
+ ["private_class_value:private"]=>
+ string(2) "PY"
+ ["protected_class_value:protected"]=>
+ string(2) "pt"
+ }
+ [1]=>
+ object(for_string_natcasesort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "t"
+ ["private_class_value:private"]=>
+ string(3) "eee"
+ ["protected_class_value:protected"]=>
+ string(3) "abb"
+ }
+ [2]=>
+ object(for_string_natcasesort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "w"
+ ["private_class_value:private"]=>
+ string(1) "W"
+ ["protected_class_value:protected"]=>
+ string(1) "c"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation1.phpt b/ext/standard/tests/array/natcasesort_variation1.phpt
new file mode 100644
index 000000000..f6019508c
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation1.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test natcasesort() function : usage variations - Pass different data types as $array_arg arg
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to natcasesort() to test behaviour
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+//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 $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of natcasesort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Iteration 1 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+bool(true)
+
+-- Iteration 19 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+bool(true)
+
+-- Iteration 23 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: natcasesort(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: natcasesort(): The 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/natcasesort_variation10.phpt b/ext/standard/tests/array/natcasesort_variation10.phpt
new file mode 100644
index 000000000..cffa007b7
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation10.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test natcasesort() function : usage variations - position of internal array pointer
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check position of internal array pointer after calling natcasesort()
+ */
+
+echo "*** Testing natcasesort() : usage variations ***\n";
+
+$array_arg = array ('img13', 'img20', 'img2', 'img1');
+
+echo "\n-- Initial Position of Internal Pointer: --\n";
+echo key($array_arg) . " => " . current ($array_arg) . "\n";
+
+echo "\n-- Call natcasesort() --\n";
+var_dump(natcasesort($array_arg));
+var_dump($array_arg);
+
+echo "\n-- Position of Internal Pointer in Passed Array: --\n";
+echo key($array_arg) . " => " . current ($array_arg) . "\n";
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variations ***
+
+-- Initial Position of Internal Pointer: --
+0 => img13
+
+-- Call natcasesort() --
+bool(true)
+array(4) {
+ [3]=>
+ string(4) "img1"
+ [2]=>
+ string(4) "img2"
+ [0]=>
+ string(5) "img13"
+ [1]=>
+ string(5) "img20"
+}
+
+-- Position of Internal Pointer in Passed Array: --
+3 => img1
+Done
diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt
new file mode 100644
index 000000000..98158f15d
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation11.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test natcasesort() function : usage variations - Different array keys
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays where the keys are different data types to test behaviour of natcasesort()
+ */
+
+echo "*** Testing natcasesort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// arrays with keys as different data types to be passed as $array_arg
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0 => 'zero',
+ 1 => 'one',
+ 12345 => 'positive',
+ -2345 => 'negative',
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5 => 'positive',
+ -10.5 => 'negative',
+ .5 => 'half',
+ ),
+
+/*3*/ 'extreme floats' => array(
+ 12.3456789000e6 => 'large',
+ 12.3456789000E-10 => 'small',
+ ),
+
+ // null data
+/*4*/ 'null uppercase' => array(
+ NULL => 'null 1',
+ ),
+
+/*5*/ 'null lowercase' => array(
+ null => 'null 2',
+ ),
+
+ // boolean data
+/*6*/ 'bool lowercase' => array(
+ true => 'lowert',
+ false => 'lowerf',
+ ),
+
+/*7*/ 'bool uppercase' => array(
+ TRUE => 'uppert',
+ FALSE => 'upperf',
+ ),
+
+ // empty data
+/*8*/ 'empty double quotes' => array(
+ "" => 'emptyd',
+ ),
+
+/*9*/ 'empty single quotes' => array(
+ '' => 'emptys',
+ ),
+
+ // string data
+/*10*/ 'string' => array(
+ "stringd" => 'stringd',
+ 'strings' => 'strings',
+ $heredoc => 'stringh',
+ ),
+
+ // undefined data
+/*11*/ 'undefined' => array(
+ @$undefined_var => 'undefined',
+ ),
+
+ // unset data
+/*12*/ 'unset' => array(
+ @$unset_var => 'unset',
+ ),
+
+ // duplicate values
+/*13*/ 'duplicate' => array(
+ 'foo' => 'bar',
+ 'baz' => 'bar',
+ 'hello' => 'world'
+ ),
+
+);
+
+// loop through each element of $inputs to check the behavior of natcasesort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+array(4) {
+ [-2345]=>
+ string(8) "negative"
+ [1]=>
+ string(3) "one"
+ [12345]=>
+ string(8) "positive"
+ [0]=>
+ string(4) "zero"
+}
+
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [0]=>
+ string(4) "half"
+ [-10]=>
+ string(8) "negative"
+ [10]=>
+ string(8) "positive"
+}
+
+-- Iteration 3 --
+bool(true)
+array(2) {
+ [12345678]=>
+ string(5) "large"
+ [0]=>
+ string(5) "small"
+}
+
+-- Iteration 4 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "null 1"
+}
+
+-- Iteration 5 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "null 2"
+}
+
+-- Iteration 6 --
+bool(true)
+array(2) {
+ [0]=>
+ string(6) "lowerf"
+ [1]=>
+ string(6) "lowert"
+}
+
+-- Iteration 7 --
+bool(true)
+array(2) {
+ [0]=>
+ string(6) "upperf"
+ [1]=>
+ string(6) "uppert"
+}
+
+-- Iteration 8 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "emptyd"
+}
+
+-- Iteration 9 --
+bool(true)
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+
+-- Iteration 10 --
+bool(true)
+array(3) {
+ ["stringd"]=>
+ string(7) "stringd"
+ ["hello world"]=>
+ string(7) "stringh"
+ ["strings"]=>
+ string(7) "strings"
+}
+
+-- Iteration 11 --
+bool(true)
+array(1) {
+ [""]=>
+ string(9) "undefined"
+}
+
+-- Iteration 12 --
+bool(true)
+array(1) {
+ [""]=>
+ string(5) "unset"
+}
+
+-- Iteration 13 --
+bool(true)
+array(3) {
+ ["foo"]=>
+ string(3) "bar"
+ ["baz"]=>
+ string(3) "bar"
+ ["hello"]=>
+ string(5) "world"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation2.phpt b/ext/standard/tests/array/natcasesort_variation2.phpt
new file mode 100644
index 000000000..00edf9434
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation2.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test natcasesort() function : usage variations - Pass arrays of different data types
+--FILE--
+<?php
+
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of different data types to natcasesort() to test how they are sorted
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+//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");
+
+// arrays of different data types to be passed to $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 'int' => array(
+ 0,
+ 1,
+ 12345,
+ -2345,
+ ),
+
+ // float data
+/*2*/ 'float' => array(
+ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+ ),
+
+ // null data
+/*3*/ 'null' => array(
+ NULL,
+ null,
+ ),
+
+ // boolean data
+/*4*/ 'bool' => array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+ ),
+
+ // empty data
+/*5*/ 'empty string' => array(
+ "",
+ '',
+ ),
+
+/*6*/ 'empty array' => array(
+ ),
+
+ // string data
+/*7*/ 'string' => array(
+ "string",
+ 'string',
+ $heredoc,
+ ),
+
+ // object data
+/*8*/ 'object' => array(
+ new classA(),
+ ),
+
+ // undefined data
+/*9*/ 'undefined' => array(
+ @$undefined_var,
+ ),
+
+ // unset data
+/*10*/ 'unset' => array(
+ @$unset_var,
+ ),
+
+ // resource variable
+/*11*/ 'resource' => array(
+ $fp
+ ),
+);
+// loop through each element of $inputs to check the behavior of natcasesort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ var_dump($input);
+ $iterator++;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Iteration 1 --
+bool(true)
+array(4) {
+ [3]=>
+ int(-2345)
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(12345)
+}
+
+-- Iteration 2 --
+bool(true)
+array(5) {
+ [1]=>
+ float(-10.5)
+ [4]=>
+ float(0.5)
+ [3]=>
+ float(1.23456789E-9)
+ [0]=>
+ float(10.5)
+ [2]=>
+ float(123456789000)
+}
+
+-- Iteration 3 --
+bool(true)
+array(2) {
+ [1]=>
+ NULL
+ [0]=>
+ NULL
+}
+
+-- Iteration 4 --
+bool(true)
+array(4) {
+ [3]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [0]=>
+ bool(true)
+ [2]=>
+ bool(true)
+}
+
+-- Iteration 5 --
+bool(true)
+array(2) {
+ [1]=>
+ string(0) ""
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 6 --
+bool(true)
+array(0) {
+}
+
+-- Iteration 7 --
+bool(true)
+array(3) {
+ [2]=>
+ string(11) "hello world"
+ [1]=>
+ string(6) "string"
+ [0]=>
+ string(6) "string"
+}
+
+-- Iteration 8 --
+bool(true)
+array(1) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+
+-- Iteration 9 --
+bool(true)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 10 --
+bool(true)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 11 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (stream)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt
new file mode 100644
index 000000000..f15150843
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation3.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test natcasesort() function : usage variations - different numeric types
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of numeric data to test how natcasesort re-orders the array
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$inputs = array (
+
+ // negative/positive 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)
+);
+
+$iterator = 1;
+foreach ($inputs as $array_arg) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(natcasesort($array_arg));
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Iteration 1 --
+bool(true)
+array(9) {
+ [1]=>
+ int(-11)
+ [3]=>
+ int(-21)
+ [5]=>
+ int(-31)
+ [8]=>
+ int(-41)
+ [6]=>
+ int(0)
+ [0]=>
+ int(11)
+ [2]=>
+ int(21)
+ [4]=>
+ int(31)
+ [7]=>
+ int(41)
+}
+
+-- Iteration 1 --
+bool(true)
+array(7) {
+ [6]=>
+ float(-0.1)
+ [1]=>
+ float(-10.5)
+ [5]=>
+ float(0.01)
+ [4]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [0]=>
+ float(10.5)
+ [2]=>
+ float(1050)
+}
+
+-- Iteration 1 --
+bool(true)
+array(11) {
+ [2]=>
+ float(-0.01)
+ [7]=>
+ float(-0.9)
+ [9]=>
+ float(-0.106)
+ [3]=>
+ int(-1)
+ [4]=>
+ int(0)
+ [0]=>
+ float(0.0001)
+ [1]=>
+ float(0.0021)
+ [5]=>
+ float(0.09)
+ [8]=>
+ float(0.106)
+ [6]=>
+ int(2)
+ [10]=>
+ int(33)
+}
+
+-- Iteration 1 --
+bool(true)
+array(7) {
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+ [5]=>
+ int(0)
+ [4]=>
+ int(0)
+ [0]=>
+ int(2147483647)
+ [1]=>
+ float(2147483648)
+}
+Done
diff --git a/ext/standard/tests/array/natcasesort_variation4.phpt b/ext/standard/tests/array/natcasesort_variation4.phpt
new file mode 100644
index 000000000..81276ef1c
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation4.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test natcasesort() function : usage variations - different string types
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays of string data to see how natcasesort() re-orders the array
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$inputs = array (
+ // group of escape sequences
+ array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"),
+
+ // array contains combination of capital/small letters
+ array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
+);
+
+foreach ($inputs as $array_arg) {
+ var_dump( natcasesort($array_arg) );
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(11) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [6]=>
+ string(1) "
+"
+ [10]=>
+ string(1) " "
+ [7]=>
+ string(1) " "
+ [5]=>
+ string(1) " "
+ [2]=>
+ string(2) "\a"
+ [3]=>
+ string(3) "\cx"
+ [9]=>
+ string(4) "\ddd"
+ [4]=>
+ string(2) "\e"
+ [8]=>
+ string(4) "\xhh"
+}
+bool(true)
+array(12) {
+ [3]=>
+ string(5) "apple"
+ [11]=>
+ string(6) "BANANA"
+ [2]=>
+ string(6) "banana"
+ [0]=>
+ string(5) "lemoN"
+ [10]=>
+ string(6) "oraNGe"
+ [1]=>
+ string(6) "Orange"
+ [4]=>
+ string(4) "Test"
+ [6]=>
+ string(3) "ttt"
+ [5]=>
+ string(4) "TTTT"
+ [7]=>
+ string(2) "ww"
+ [8]=>
+ string(1) "x"
+ [9]=>
+ string(1) "X"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation5.phpt b/ext/standard/tests/array/natcasesort_variation5.phpt
new file mode 100644
index 000000000..867d0b89e
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation5.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test natcasesort() function : usage variations - different hex values
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of different hex values to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
+var_dump( natcasesort($unsorted_hex_array) );
+var_dump($unsorted_hex_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(11) {
+ [8]=>
+ int(-255)
+ [10]=>
+ int(-682)
+ [9]=>
+ int(0)
+ [2]=>
+ int(15)
+ [5]=>
+ int(187)
+ [3]=>
+ int(255)
+ [7]=>
+ int(255)
+ [0]=>
+ int(427)
+ [6]=>
+ int(427)
+ [4]=>
+ int(682)
+ [1]=>
+ int(4095)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation6.phpt b/ext/standard/tests/array/natcasesort_variation6.phpt
new file mode 100644
index 000000000..1d151d80d
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation6.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test natcasesort() function : usage variations - referenced variables
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of referenced varaibles to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+echo "\n-- Initial test --\n";
+$array = array( &$value1 , &$value2, &$value3);
+var_dump( natcasesort($array) );
+var_dump($array);
+
+echo "\n-- Change \$value1 --\n";
+$value1 = -29;
+var_dump( natcasesort($array) );
+var_dump($array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+
+-- Initial test --
+bool(true)
+array(3) {
+ [1]=>
+ &int(33)
+ [0]=>
+ &int(100)
+ [2]=>
+ &int(555)
+}
+
+-- Change $value1 --
+bool(true)
+array(3) {
+ [0]=>
+ &int(-29)
+ [1]=>
+ &int(33)
+ [2]=>
+ &int(555)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation7.phpt b/ext/standard/tests/array/natcasesort_variation7.phpt
new file mode 100644
index 000000000..eefcd1d6f
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation7.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test natcasesort() function : usage variations - recursive arrays
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass natcasesort() an infinitely recursive array to test how it is re-ordered
+ */
+
+echo "*** Testing natcasesort() : usage variations ***\n";
+
+$array = array (1, 3.00, 'zero', '2');
+$array[] = &$array;
+var_dump($array);
+
+var_dump(@natcasesort($array));
+var_dump($array);
+
+$array[4] = null;
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variations ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ float(3)
+ [2]=>
+ string(4) "zero"
+ [3]=>
+ string(1) "2"
+ [4]=>
+ &array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ float(3)
+ [2]=>
+ string(4) "zero"
+ [3]=>
+ string(1) "2"
+ [4]=>
+ &array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ float(3)
+ [2]=>
+ string(4) "zero"
+ [3]=>
+ string(1) "2"
+ [4]=>
+ *RECURSION*
+ }
+ }
+}
+bool(true)
+array(5) {
+ [0]=>
+ int(1)
+ [3]=>
+ string(1) "2"
+ [1]=>
+ float(3)
+ [4]=>
+ &array(5) {
+ [0]=>
+ int(1)
+ [3]=>
+ string(1) "2"
+ [1]=>
+ float(3)
+ [4]=>
+ &array(5) {
+ [0]=>
+ int(1)
+ [3]=>
+ string(1) "2"
+ [1]=>
+ float(3)
+ [4]=>
+ *RECURSION*
+ [2]=>
+ string(4) "zero"
+ }
+ [2]=>
+ string(4) "zero"
+ }
+ [2]=>
+ string(4) "zero"
+}
+Done
diff --git a/ext/standard/tests/array/natcasesort_variation8.phpt b/ext/standard/tests/array/natcasesort_variation8.phpt
new file mode 100644
index 000000000..fbced4a22
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation8.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test natcasesort() function : usage variations - octal values
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array of octal values to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
+
+var_dump( natcasesort($unsorted_oct_array) );
+var_dump($unsorted_oct_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(9) {
+ [6]=>
+ int(-54)
+ [7]=>
+ int(-229)
+ [8]=>
+ int(0)
+ [3]=>
+ int(54)
+ [5]=>
+ int(63)
+ [1]=>
+ int(209)
+ [2]=>
+ int(229)
+ [4]=>
+ int(506)
+ [0]=>
+ int(669)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/natcasesort_variation9.phpt b/ext/standard/tests/array/natcasesort_variation9.phpt
new file mode 100644
index 000000000..98eec05a0
--- /dev/null
+++ b/ext/standard/tests/array/natcasesort_variation9.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Test natcasesort() function : usage variations - mixed array
+--FILE--
+<?php
+/* Prototype : bool natcasesort(array &$array_arg)
+ * Description: Sort an array using case-insensitive natural sort
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass an array containing sub-arrays, ints, floats, strings, boolean, null
+ * and escape characters to test how natcasesort() re-orders it
+ */
+
+echo "*** Testing natcasesort() : usage variation ***\n";
+
+$mixed_values = array (
+ array(),
+ array( array(33, -5, 6),
+ array(11),
+ array(22, -55),
+ array()
+ ),
+ -4, "4", 4.00, "b", "5", -2, -2.0, -2.98989, "-.9", "True", "",
+ NULL, "ab", "abcd", 0.0, -0, "abcd\x00abcd\x00abcd", '', true, false
+);
+// suppress errors as is generating a lot of "array to string" notices
+var_dump( @natcasesort($mixed_values) );
+
+var_dump($mixed_values);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing natcasesort() : usage variation ***
+bool(true)
+array(22) {
+ [13]=>
+ NULL
+ [19]=>
+ string(0) ""
+ [21]=>
+ bool(false)
+ [12]=>
+ string(0) ""
+ [10]=>
+ string(3) "-.9"
+ [7]=>
+ int(-2)
+ [8]=>
+ float(-2)
+ [9]=>
+ float(-2.98989)
+ [2]=>
+ int(-4)
+ [16]=>
+ float(0)
+ [17]=>
+ int(0)
+ [20]=>
+ bool(true)
+ [3]=>
+ string(1) "4"
+ [4]=>
+ float(4)
+ [6]=>
+ string(1) "5"
+ [14]=>
+ string(2) "ab"
+ [15]=>
+ string(4) "abcd"
+ [18]=>
+ string(14) "%s"
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [3]=>
+ array(0) {
+ }
+ }
+ [5]=>
+ string(1) "b"
+ [11]=>
+ string(4) "True"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/next_basic.phpt b/ext/standard/tests/array/next_basic.phpt
new file mode 100644
index 000000000..fe8b70c88
--- /dev/null
+++ b/ext/standard/tests/array/next_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test next() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of next()
+ */
+
+echo "*** Testing next() : basic functionality ***\n";
+
+$array = array('zero', 'one', 'two');
+echo key($array) . " => " . current($array) . "\n";
+var_dump(next($array));
+
+echo key($array) . " => " . current($array) . "\n";
+var_dump(next($array));
+
+echo key($array) . " => " . current($array) . "\n";
+var_dump(next($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : basic functionality ***
+0 => zero
+string(3) "one"
+1 => one
+string(3) "two"
+2 => two
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/next_error.phpt b/ext/standard/tests/array/next_error.phpt
new file mode 100644
index 000000000..ba7596feb
--- /dev/null
+++ b/ext/standard/tests/array/next_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test next() function : error conditions - Pass incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to next() to test behaviour
+ */
+
+echo "*** Testing next() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing next() function with Zero arguments --\n";
+var_dump( next() );
+
+//Test next with one more than the expected number of arguments
+echo "\n-- Testing next() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( next($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : error conditions ***
+
+-- Testing next() function with Zero arguments --
+
+Warning: Wrong parameter count for next() in %s on line %d
+NULL
+
+-- Testing next() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for next() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/next_variation1.phpt b/ext/standard/tests/array/next_variation1.phpt
new file mode 100644
index 000000000..aa02ac599
--- /dev/null
+++ b/ext/standard/tests/array/next_variation1.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test next() function : usage variation - Pass different data types as $array_arg
+--FILE--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to next() to test behaviour
+ */
+
+echo "*** Testing next() : variation ***\n";
+
+//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 $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of next()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( next($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : variation ***
+
+-- Iteration 1 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/next_variation2.phpt b/ext/standard/tests/array/next_variation2.phpt
new file mode 100644
index 000000000..e7505096d
--- /dev/null
+++ b/ext/standard/tests/array/next_variation2.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test next() function : usage variation - Mulit-dimensional arrays
+--FILE--
+<?php
+/* Prototype : mixed next(array $array_arg)
+ * Description: Move array argument's internal pointer to the next element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test next() when passed:
+ * 1. a two-dimensional array
+ * 2. a sub-array
+ * as $array_arg argument.
+ */
+
+echo "*** Testing next() : usage variations ***\n";
+
+$array_arg = array ('a' => 'z', array(9, 8, 7));
+
+echo "\n-- Pass a two-dimensional array as \$array_arg --\n";
+var_dump(next($array_arg));
+var_dump(next($array_arg));
+
+echo "\n-- Pass a sub-array as \$array_arg --\n";
+var_dump(next($array_arg[0]));
+?>
+===DONE===
+--EXPECTF--
+*** Testing next() : usage variations ***
+
+-- Pass a two-dimensional array as $array_arg --
+array(3) {
+ [0]=>
+ int(9)
+ [1]=>
+ int(8)
+ [2]=>
+ int(7)
+}
+bool(false)
+
+-- Pass a sub-array as $array_arg --
+int(8)
+===DONE===
diff --git a/ext/standard/tests/array/reset_basic.phpt b/ext/standard/tests/array/reset_basic.phpt
new file mode 100644
index 000000000..d376e68a2
--- /dev/null
+++ b/ext/standard/tests/array/reset_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test reset() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of reset()
+ */
+
+echo "*** Testing reset() : basic functionality ***\n";
+
+$array = array('zero', 'one', 200 => 'two');
+
+echo "\n-- Initial Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Call to next() --\n";
+var_dump(next($array));
+
+echo "\n-- Current Position: --\n";
+echo key($array) . " => " . current($array) . "\n";
+
+echo "\n-- Call to reset() --\n";
+var_dump(reset($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : basic functionality ***
+
+-- Initial Position: --
+0 => zero
+
+-- Call to next() --
+string(3) "one"
+
+-- Current Position: --
+1 => one
+
+-- Call to reset() --
+string(4) "zero"
+===DONE===
diff --git a/ext/standard/tests/array/reset_error.phpt b/ext/standard/tests/array/reset_error.phpt
new file mode 100644
index 000000000..1bf0f9613
--- /dev/null
+++ b/ext/standard/tests/array/reset_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test reset() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to reset() to test behaviour
+ */
+
+echo "*** Testing reset() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing reset() function with Zero arguments --\n";
+var_dump( reset() );
+
+//Test reset with one more than the expected number of arguments
+echo "\n-- Testing reset() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$extra_arg = 10;
+var_dump( reset($array_arg, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : error conditions ***
+
+-- Testing reset() function with Zero arguments --
+
+Warning: Wrong parameter count for reset() in %s on line %d
+NULL
+
+-- Testing reset() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for reset() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/array/reset_variation1.phpt b/ext/standard/tests/array/reset_variation1.phpt
new file mode 100644
index 000000000..0dc99512e
--- /dev/null
+++ b/ext/standard/tests/array/reset_variation1.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test reset() function : usage variations - Pass different data types as $array_arg arg.
+--FILE--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to reset() to test behaviour
+ */
+
+echo "*** Testing reset() : usage variations ***\n";
+
+//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 $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of reset()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( reset($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 2 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 3 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 4 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 5 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 6 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 7 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 8 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 9 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 10 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 11 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 12 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 13 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 14 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 15 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 16 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 17 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 20 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 21 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 22 --
+bool(false)
+
+-- Iteration 23 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 24 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+
+-- Iteration 25 --
+
+Warning: reset(): Passed variable is not an array or object in %s on line %s
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/array/reset_variation2.phpt b/ext/standard/tests/array/reset_variation2.phpt
new file mode 100644
index 000000000..1384affa9
--- /dev/null
+++ b/ext/standard/tests/array/reset_variation2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test reset() function : usage variations - unset first element
+--FILE--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Unset first element of an array and test behaviour of reset()
+ */
+
+echo "*** Testing reset() : usage variations ***\n";
+
+$array = array('a', 'b', 'c');
+
+echo "\n-- Initial Position: --\n";
+echo current($array) . " => " . key($array) . "\n";
+
+echo "\n-- Unset First element in array and check reset() --\n";
+unset($array[0]);
+var_dump(reset($array));
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : usage variations ***
+
+-- Initial Position: --
+a => 0
+
+-- Unset First element in array and check reset() --
+string(1) "b"
+===DONE===
diff --git a/ext/standard/tests/array/reset_variation3.phpt b/ext/standard/tests/array/reset_variation3.phpt
new file mode 100644
index 000000000..29f965abe
--- /dev/null
+++ b/ext/standard/tests/array/reset_variation3.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test reset() function : usage variations - Referenced variables
+--FILE--
+<?php
+/* Prototype : mixed reset(array $array_arg)
+ * Description: Set array argument's internal pointer to the first element and return it
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Reference two arrays to each other then call reset() to test position of
+ * internal pointer in both arrays
+ */
+
+echo "*** Testing reset() : usage variations ***\n";
+
+$array1 = array ('zero', 'one', 'two');
+
+echo "\n-- Initial position of internal pointer --\n";
+var_dump(current($array1));
+
+// Test that when two variables are referenced to one another
+// the internal pointer is the same for both
+$array2 = &$array1;
+
+next($array1);
+
+echo "\n-- Position after calling next() --\n";
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+
+echo "\n-- Position after calling reset() --\n";
+var_dump(reset($array1));
+echo "\$array1: ";
+var_dump(current($array1));
+echo "\$array2: ";
+var_dump(current($array2));
+?>
+===DONE===
+--EXPECTF--
+*** Testing reset() : usage variations ***
+
+-- Initial position of internal pointer --
+string(4) "zero"
+
+-- Position after calling next() --
+$array1: string(3) "one"
+$array2: string(3) "one"
+
+-- Position after calling reset() --
+string(4) "zero"
+$array1: string(4) "zero"
+$array2: string(4) "zero"
+===DONE===
diff --git a/ext/standard/tests/array/rsort_basic.phpt b/ext/standard/tests/array/rsort_basic.phpt
new file mode 100644
index 000000000..5495be925
--- /dev/null
+++ b/ext/standard/tests/array/rsort_basic.phpt
@@ -0,0 +1,129 @@
+--TEST--
+Test rsort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of rsort()
+ */
+
+echo "*** Testing rsort() : 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 rsort() by supplying string array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_strings;
+var_dump( rsort($temp_array) );
+var_dump( $temp_array);
+
+echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( rsort($temp_array) );
+var_dump( $temp_array);
+
+echo "\n-- Testing rsort() by supplying string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_strings;
+var_dump( rsort($temp_array, SORT_REGULAR) );
+var_dump( $temp_array);
+
+echo "\n-- Testing rsort() by supplying numeric array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_numerics;
+var_dump( rsort($temp_array, SORT_REGULAR) );
+var_dump( $temp_array);
+
+echo "\n-- Testing rsort() by supplying string array, 'flag' = SORT_STRING --\n";
+$temp_array = $unsorted_strings;
+var_dump( rsort($temp_array, SORT_STRING) );
+var_dump( $temp_array);
+
+echo "\n-- Testing rsort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = $unsorted_numerics;
+var_dump( rsort($temp_array, SORT_NUMERIC) );
+var_dump( $temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : basic functionality ***
+
+-- Testing rsort() by supplying string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ [0]=>
+ string(6) "orange"
+ [1]=>
+ string(5) "lemon"
+ [2]=>
+ string(6) "banana"
+}
+
+-- Testing rsort() by supplying numeric array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [0]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [3]=>
+ int(22)
+}
+
+-- Testing rsort() by supplying string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ string(6) "orange"
+ [1]=>
+ string(5) "lemon"
+ [2]=>
+ string(6) "banana"
+}
+
+-- Testing rsort() by supplying numeric array, 'flag' = SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [3]=>
+ int(22)
+}
+
+-- Testing rsort() by supplying string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ [0]=>
+ string(6) "orange"
+ [1]=>
+ string(5) "lemon"
+ [2]=>
+ string(6) "banana"
+}
+
+-- Testing rsort() by supplying numeric array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(4) {
+ [0]=>
+ int(555)
+ [1]=>
+ int(100)
+ [2]=>
+ int(33)
+ [3]=>
+ int(22)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_error.phpt b/ext/standard/tests/array/rsort_error.phpt
new file mode 100644
index 000000000..6f6f2f976
--- /dev/null
+++ b/ext/standard/tests/array/rsort_error.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test rsort() function : error conditions - Pass incorrect number of args
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass incorrect number of arguments to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing rsort() function with Zero arguments --\n";
+var_dump( rsort() );
+
+//Test rsort() with more than the expected number of arguments
+echo "\n-- Testing rsort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$sort_flags = SORT_REGULAR;
+$extra_arg = 10;
+var_dump( rsort($array_arg, $sort_flags, $extra_arg) );
+
+// dump the input array to ensure that it wasn't changed
+var_dump($array_arg);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : error conditions ***
+
+-- Testing rsort() function with Zero arguments --
+
+Warning: rsort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing rsort() function with more than expected no. of arguments --
+
+Warning: rsort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_object1.phpt b/ext/standard/tests/array/rsort_object1.phpt
new file mode 100644
index 000000000..98f7cfec1
--- /dev/null
+++ b/ext/standard/tests/array/rsort_object1.phpt
@@ -0,0 +1,243 @@
+--TEST--
+Test rsort() function : object functionality
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of rsort() with objects
+ */
+
+echo "*** Testing rsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_rsort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_rsort
+{
+ 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_rsort(11), new for_integer_rsort(66),
+ new for_integer_rsort(23), new for_integer_rsort(-5),
+ new for_integer_rsort(0.001), new for_integer_rsort(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_rsort("axx"), new for_string_rsort("t"),
+ new for_string_rsort("w"), new for_string_rsort("py"),
+ new for_string_rsort("apple"), new for_string_rsort("Orange"),
+ new for_string_rsort("Lemon"), new for_string_rsort("aPPle")
+);
+
+
+echo "\n-- Sort flag = default --\n";
+
+// testing rsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_REGULAR --\n";
+// testing rsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : object functionality ***
+
+-- Sort flag = default --
+bool(true)
+array(6) {
+ [0]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [1]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [2]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [3]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [4]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [5]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+}
+bool(true)
+array(8) {
+ [0]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ [1]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [2]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [3]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [4]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [5]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [6]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [7]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(6) {
+ [0]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+ [1]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [2]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [3]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [4]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [5]=>
+ object(for_integer_rsort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+}
+bool(true)
+array(8) {
+ [0]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+ [1]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [2]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [3]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [4]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [5]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [6]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [7]=>
+ object(for_string_rsort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_object2.phpt b/ext/standard/tests/array/rsort_object2.phpt
new file mode 100644
index 000000000..216d3c910
--- /dev/null
+++ b/ext/standard/tests/array/rsort_object2.phpt
@@ -0,0 +1,258 @@
+--TEST--
+Test rsort() function : object functionality - different visibilities
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test functionality of rsort() with objects where properties have different visibilities
+ */
+
+echo "*** Testing rsort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_rsort
+{
+ 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_rsort
+{
+ 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_rsort(11,33,30),
+ new for_integer_rsort(66,44,4),
+ new for_integer_rsort(-88,-5,5),
+ new for_integer_rsort(0.001,99.5,0.1)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_rsort("axx","AXX","ass"),
+ new for_string_rsort("t","eee","abb"),
+ new for_string_rsort("w","W", "c"),
+ new for_string_rsort("py","PY", "pt"),
+);
+
+
+echo "\n-- Sort flag = default --\n";
+
+// testing rsort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_REGULAR --\n";
+// testing rsort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing rsort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : object functionality ***
+
+-- Sort flag = default --
+bool(true)
+array(4) {
+ [0]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ int(66)
+ ["private_class_value:private"]=>
+ int(44)
+ ["protected_class_value:protected"]=>
+ int(4)
+ }
+ [1]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ int(11)
+ ["private_class_value:private"]=>
+ int(33)
+ ["protected_class_value:protected"]=>
+ int(30)
+ }
+ [2]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ float(0.001)
+ ["private_class_value:private"]=>
+ float(99.5)
+ ["protected_class_value:protected"]=>
+ float(0.1)
+ }
+ [3]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ int(-88)
+ ["private_class_value:private"]=>
+ int(-5)
+ ["protected_class_value:protected"]=>
+ int(5)
+ }
+}
+bool(true)
+array(4) {
+ [0]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "w"
+ ["private_class_value:private"]=>
+ string(1) "W"
+ ["protected_class_value:protected"]=>
+ string(1) "c"
+ }
+ [1]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "t"
+ ["private_class_value:private"]=>
+ string(3) "eee"
+ ["protected_class_value:protected"]=>
+ string(3) "abb"
+ }
+ [2]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(2) "py"
+ ["private_class_value:private"]=>
+ string(2) "PY"
+ ["protected_class_value:protected"]=>
+ string(2) "pt"
+ }
+ [3]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value:private"]=>
+ string(3) "AXX"
+ ["protected_class_value:protected"]=>
+ string(3) "ass"
+ }
+}
+
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ int(66)
+ ["private_class_value:private"]=>
+ int(44)
+ ["protected_class_value:protected"]=>
+ int(4)
+ }
+ [1]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ int(11)
+ ["private_class_value:private"]=>
+ int(33)
+ ["protected_class_value:protected"]=>
+ int(30)
+ }
+ [2]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ float(0.001)
+ ["private_class_value:private"]=>
+ float(99.5)
+ ["protected_class_value:protected"]=>
+ float(0.1)
+ }
+ [3]=>
+ object(for_integer_rsort)#%d (3) {
+ ["public_class_value"]=>
+ int(-88)
+ ["private_class_value:private"]=>
+ int(-5)
+ ["protected_class_value:protected"]=>
+ int(5)
+ }
+}
+bool(true)
+array(4) {
+ [0]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "w"
+ ["private_class_value:private"]=>
+ string(1) "W"
+ ["protected_class_value:protected"]=>
+ string(1) "c"
+ }
+ [1]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "t"
+ ["private_class_value:private"]=>
+ string(3) "eee"
+ ["protected_class_value:protected"]=>
+ string(3) "abb"
+ }
+ [2]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(2) "py"
+ ["private_class_value:private"]=>
+ string(2) "PY"
+ ["protected_class_value:protected"]=>
+ string(2) "pt"
+ }
+ [3]=>
+ object(for_string_rsort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value:private"]=>
+ string(3) "AXX"
+ ["protected_class_value:protected"]=>
+ string(3) "ass"
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation1.phpt b/ext/standard/tests/array/rsort_variation1.phpt
new file mode 100644
index 000000000..96dac90ae
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation1.phpt
@@ -0,0 +1,514 @@
+--TEST--
+Test rsort() function : usage variations - Pass different data types as $array_arg arg
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $array_arg argument to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+//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 $array_arg argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // 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 element of $inputs to check the behavior of rsort()
+$iterator = 1;
+foreach ($inputs as $input) {
+ echo "-- Iteration $iterator --\n";
+ echo "Flag = default:\n";
+ var_dump( rsort($input) );
+ echo "Flag = SORT_REGULAR:\n";
+ var_dump( rsort($input, SORT_REGULAR) );
+ echo "Flag = SORT_NUMERIC:\n";
+ var_dump( rsort($input, SORT_NUMERIC) );
+ echo "Flag = SORT_STRING:\n";
+ var_dump( rsort($input, SORT_STRING) );
+ $iterator++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+-- Iteration 1 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 21 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 22 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 23 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 24 --
+Flag = default:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Flag = SORT_REGULAR:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Flag = SORT_NUMERIC:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Flag = SORT_STRING:
+
+Warning: rsort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation10.phpt b/ext/standard/tests/array/rsort_variation10.phpt
new file mode 100644
index 000000000..ccf886b07
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation10.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test rsort() function : usage variations - Octal values
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() an array containing octal values to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
+
+echo "\n-- Sort flag = default --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Sort flag = SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(rsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Sort flag = default --
+bool(true)
+array(9) {
+ [0]=>
+ int(669)
+ [1]=>
+ int(506)
+ [2]=>
+ int(229)
+ [3]=>
+ int(209)
+ [4]=>
+ int(63)
+ [5]=>
+ int(54)
+ [6]=>
+ int(0)
+ [7]=>
+ int(-54)
+ [8]=>
+ int(-229)
+}
+
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(9) {
+ [0]=>
+ int(669)
+ [1]=>
+ int(506)
+ [2]=>
+ int(229)
+ [3]=>
+ int(209)
+ [4]=>
+ int(63)
+ [5]=>
+ int(54)
+ [6]=>
+ int(0)
+ [7]=>
+ int(-54)
+ [8]=>
+ int(-229)
+}
+
+-- Sort flag = SORT_NUMERIC --
+bool(true)
+array(9) {
+ [0]=>
+ int(669)
+ [1]=>
+ int(506)
+ [2]=>
+ int(229)
+ [3]=>
+ int(209)
+ [4]=>
+ int(63)
+ [5]=>
+ int(54)
+ [6]=>
+ int(0)
+ [7]=>
+ int(-54)
+ [8]=>
+ int(-229)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation11.phpt b/ext/standard/tests/array/rsort_variation11.phpt
new file mode 100644
index 000000000..83bbf84df
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/rsort_variation2.phpt b/ext/standard/tests/array/rsort_variation2.phpt
new file mode 100644
index 000000000..2196a6494
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation2.phpt
@@ -0,0 +1,484 @@
+--TEST--
+Test rsort() function : usage variations - Pass different data types as $sort_flags arg
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass different data types as $sort_flags argument to rsort() to test behaviour
+ * Where possible, 'SORT_NUMERIC' has been entered as a string value
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// Initialise function arguments not being substituted
+$array_arg = array (1, 5, 2, 3, 1);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "SORT_NUMERIC";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+SORT_NUMERIC
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $sort_flags argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "SORT_NUMERIC",
+ 'SORT_NUMERIC',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of rsort()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+
+ //create temporary array in case rsort() works
+ $temp = $array_arg;
+
+ var_dump( rsort($temp, $input) );
+ var_dump($temp);
+ $iterator++;
+
+ $temp = null;
+};
+
+fclose($fp);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 2 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 3 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 4 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 5 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 6 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 7 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 8 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 9 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 10 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 11 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 12 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 13 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 14 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 15 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 16 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 17 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 18 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 19 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 20 --
+
+Warning: rsort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 21 --
+
+Warning: rsort() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 22 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 23 --
+bool(true)
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(3)
+ [2]=>
+ int(2)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+}
+
+-- Iteration 24 --
+
+Warning: rsort() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(1)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt
new file mode 100644
index 000000000..798e148c7
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation3.phpt
@@ -0,0 +1,325 @@
+--TEST--
+Test rsort() function : usage variations - numeric values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays containing different numeric data to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// group of various arrays
+
+$various_arrays = array (
+// negative/positive 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;
+
+// loop through to test rsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With Defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(rsort($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(rsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- 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(1050)
+ [1]=>
+ float(10.5)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.01)
+ [5]=>
+ float(-0.1)
+ [6]=>
+ float(-10.5)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [0]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.01)
+ [5]=>
+ float(-0.1)
+ [6]=>
+ float(-10.5)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [0]=>
+ float(1050)
+ [1]=>
+ float(10.5)
+ [2]=>
+ float(0.5)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.01)
+ [5]=>
+ float(-0.1)
+ [6]=>
+ float(-10.5)
+}
+
+-- Iteration 3 --
+- With Defualt sort flag -
+bool(true)
+array(11) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.106)
+ [3]=>
+ float(0.09)
+ [4]=>
+ float(0.0021)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ int(0)
+ [7]=>
+ float(-0.01)
+ [8]=>
+ float(-0.106)
+ [9]=>
+ float(-0.9)
+ [10]=>
+ int(-1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.106)
+ [3]=>
+ float(0.09)
+ [4]=>
+ float(0.0021)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ int(0)
+ [7]=>
+ float(-0.01)
+ [8]=>
+ float(-0.106)
+ [9]=>
+ float(-0.9)
+ [10]=>
+ int(-1)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(2)
+ [2]=>
+ float(0.106)
+ [3]=>
+ float(0.09)
+ [4]=>
+ float(0.0021)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ int(0)
+ [7]=>
+ float(-0.01)
+ [8]=>
+ float(-0.106)
+ [9]=>
+ float(-0.9)
+ [10]=>
+ int(-1)
+}
+
+-- Iteration 4 --
+- With Defualt sort flag -
+bool(true)
+array(7) {
+ [0]=>
+ float(2147483648)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(-2147483647)
+ [5]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [0]=>
+ float(2147483648)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(-2147483647)
+ [5]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [0]=>
+ float(2147483648)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(0)
+ [3]=>
+ int(0)
+ [4]=>
+ int(-2147483647)
+ [5]=>
+ float(-2147483648)
+ [6]=>
+ float(-2147483649)
+}
+Done
diff --git a/ext/standard/tests/array/rsort_variation4.phpt b/ext/standard/tests/array/rsort_variation4.phpt
new file mode 100644
index 000000000..4cab1a933
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation4.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test rsort() function : usage variations - referenced variables
+--INI--
+allow_call_time_pass_reference=on
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test behaviour of rsort() when:
+ * 1. passed an array of referenced variables
+ * 2. $array_arg is a reference to another array
+ * 3. $array_arg is passed by reference
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+// an array containing integer references
+$unsorted_numerics = array( &$value1 , &$value2, &$value3);
+
+echo "\n-- 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( rsort($temp_array) );
+var_dump( $temp_array);
+
+echo "\n-- 'flag' = SORT_REGULAR --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( rsort($temp_array, SORT_REGULAR) );
+var_dump( $temp_array);
+
+echo "\n-- 'flag' = SORT_NUMERIC --\n";
+$temp_array = $unsorted_numerics;
+var_dump( rsort(&$temp_array, SORT_NUMERIC) );
+var_dump( $temp_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- 'flag' value is defualt --
+bool(true)
+array(3) {
+ [0]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+
+-- 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+
+-- 'flag' = SORT_NUMERIC --
+bool(true)
+array(3) {
+ [0]=>
+ &int(555)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(33)
+}
+Done
diff --git a/ext/standard/tests/array/rsort_variation5.phpt b/ext/standard/tests/array/rsort_variation5.phpt
new file mode 100644
index 000000000..eba6bc420
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation5.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test rsort() function : usage variations - String values
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass arrays containing different string data to rsort() to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+$various_arrays = array (
+// group of escape sequences
+array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\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;
+// loop through to test rsort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With Default sort flag -\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ 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(rsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+- With Default sort flag -
+bool(true)
+array(11) {
+ [0]=>
+ string(4) "\xhh"
+ [1]=>
+ string(2) "\e"
+ [2]=>
+ string(4) "\ddd"
+ [3]=>
+ string(3) "\cx"
+ [4]=>
+ string(2) "\a"
+ [5]=>
+ string(1) " "
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(1) "
+"
+ [8]=>
+ string(1) " "
+ [9]=>
+ NULL
+ [10]=>
+ NULL
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [0]=>
+ string(4) "\xhh"
+ [1]=>
+ string(2) "\e"
+ [2]=>
+ string(4) "\ddd"
+ [3]=>
+ string(3) "\cx"
+ [4]=>
+ string(2) "\a"
+ [5]=>
+ string(1) " "
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(1) "
+"
+ [8]=>
+ string(1) " "
+ [9]=>
+ NULL
+ [10]=>
+ NULL
+}
+- Sort flag = SORT_STRING -
+bool(true)
+array(11) {
+ [0]=>
+ string(4) "\xhh"
+ [1]=>
+ string(2) "\e"
+ [2]=>
+ string(4) "\ddd"
+ [3]=>
+ string(3) "\cx"
+ [4]=>
+ string(2) "\a"
+ [5]=>
+ string(1) " "
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(1) "
+"
+ [8]=>
+ string(1) " "
+ [9]=>
+ NULL
+ [10]=>
+ NULL
+}
+
+-- Iteration 2 --
+- With Default sort flag -
+bool(true)
+array(12) {
+ [0]=>
+ string(1) "x"
+ [1]=>
+ string(2) "ww"
+ [2]=>
+ string(3) "ttt"
+ [3]=>
+ string(6) "oraNGe"
+ [4]=>
+ string(5) "lemoN"
+ [5]=>
+ string(6) "banana"
+ [6]=>
+ string(5) "apple"
+ [7]=>
+ string(1) "X"
+ [8]=>
+ string(4) "Test"
+ [9]=>
+ string(4) "TTTT"
+ [10]=>
+ string(6) "Orange"
+ [11]=>
+ string(6) "BANANA"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(12) {
+ [0]=>
+ string(1) "x"
+ [1]=>
+ string(2) "ww"
+ [2]=>
+ string(3) "ttt"
+ [3]=>
+ string(6) "oraNGe"
+ [4]=>
+ string(5) "lemoN"
+ [5]=>
+ string(6) "banana"
+ [6]=>
+ string(5) "apple"
+ [7]=>
+ string(1) "X"
+ [8]=>
+ string(4) "Test"
+ [9]=>
+ string(4) "TTTT"
+ [10]=>
+ string(6) "Orange"
+ [11]=>
+ string(6) "BANANA"
+}
+- Sort flag = SORT_STRING -
+bool(true)
+array(12) {
+ [0]=>
+ string(1) "x"
+ [1]=>
+ string(2) "ww"
+ [2]=>
+ string(3) "ttt"
+ [3]=>
+ string(6) "oraNGe"
+ [4]=>
+ string(5) "lemoN"
+ [5]=>
+ string(6) "banana"
+ [6]=>
+ string(5) "apple"
+ [7]=>
+ string(1) "X"
+ [8]=>
+ string(4) "Test"
+ [9]=>
+ string(4) "TTTT"
+ [10]=>
+ string(6) "Orange"
+ [11]=>
+ string(6) "BANANA"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation6.phpt b/ext/standard/tests/array/rsort_variation6.phpt
new file mode 100644
index 000000000..559a1ebaf
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation6.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Test rsort() function : usage variations - Hexadecimal vales
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() an array of hexadecimal values to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// an array contains unsorted hexadecimal values
+$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
+
+echo "\n-- 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(rsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- 'flag' value is defualt --
+bool(true)
+array(11) {
+ [0]=>
+ int(4095)
+ [1]=>
+ int(682)
+ [2]=>
+ int(427)
+ [3]=>
+ int(427)
+ [4]=>
+ int(255)
+ [5]=>
+ int(255)
+ [6]=>
+ int(187)
+ [7]=>
+ int(15)
+ [8]=>
+ int(0)
+ [9]=>
+ int(-255)
+ [10]=>
+ int(-682)
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(11) {
+ [0]=>
+ int(4095)
+ [1]=>
+ int(682)
+ [2]=>
+ int(427)
+ [3]=>
+ int(427)
+ [4]=>
+ int(255)
+ [5]=>
+ int(255)
+ [6]=>
+ int(187)
+ [7]=>
+ int(15)
+ [8]=>
+ int(0)
+ [9]=>
+ int(-255)
+ [10]=>
+ int(-682)
+}
+
+-- 'flag' value is SORT_NUMERIC --
+bool(true)
+array(11) {
+ [0]=>
+ int(4095)
+ [1]=>
+ int(682)
+ [2]=>
+ int(427)
+ [3]=>
+ int(427)
+ [4]=>
+ int(255)
+ [5]=>
+ int(255)
+ [6]=>
+ int(187)
+ [7]=>
+ int(15)
+ [8]=>
+ int(0)
+ [9]=>
+ int(-255)
+ [10]=>
+ int(-682)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation7.phpt b/ext/standard/tests/array/rsort_variation7.phpt
new file mode 100644
index 000000000..a996bf6db
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation7.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test rsort() function : usage variations - boolean values
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() arrays of boolean values to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// bool value array
+$bool_values = array (true, false, TRUE, FALSE);
+
+echo "\n-- 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(rsort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- 'flag' value is defualt --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+-- 'flag' value is SORT_NUMERIC --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+
+-- 'flag' value is SORT_STRING --
+bool(true)
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(true)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation8.phpt b/ext/standard/tests/array/rsort_variation8.phpt
new file mode 100644
index 000000000..a4f94b5f0
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation8.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test rsort() function : usage variations - multi-dimensional arrays
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() multi-dimensional arrays to test behaviour
+ */
+
+echo "*** Testing rsort() : variation ***\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;
+
+// loop through to test rsort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+
+ echo "\n-- 'flag' value is default --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "\n-- 'flag' value is SORT_REGULAR --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+
+-- 'flag' value is default --
+bool(true)
+array(0) {
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+
+-- 'flag' value is default --
+bool(true)
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+
+-- 'flag' value is default --
+bool(true)
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(44)
+ [2]=>
+ int(11)
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+ [1]=>
+ int(44)
+ [2]=>
+ int(11)
+}
+
+-- Iteration 4 --
+
+-- 'flag' value is default --
+bool(true)
+array(4) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [3]=>
+ array(0) {
+ }
+}
+
+-- 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [3]=>
+ array(0) {
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/rsort_variation9.phpt b/ext/standard/tests/array/rsort_variation9.phpt
new file mode 100644
index 000000000..c08791df1
--- /dev/null
+++ b/ext/standard/tests/array/rsort_variation9.phpt
@@ -0,0 +1,259 @@
+--TEST--
+Test rsort() function : usage variations - mixed associative arrays
+--FILE--
+<?php
+/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
+ * Description: Sort an array in reverse order
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Pass rsort() associative arrays to test key re-assignment
+ */
+
+echo "*** Testing rsort() : variation ***\n";
+
+// Associative arrays
+$various_arrays = array(
+ // numeric assoc. only array
+ array(5 => 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11),
+
+ // two-dimensional assoc. and default key array
+ array("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
+ "numbers" => array(1, 2, 3, 4, 5, 6),
+ "holes" => array("first", 5 => "second", "third")),
+
+ // numeric assoc. and default key array
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+
+ // mixed assoc. array
+ array('bar' => 'baz', "foo" => 1),
+
+ // assoc. only multi-dimensional array
+ array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5),
+);
+
+$count = 1;
+
+// loop through to test rsort() 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 "-- Sort flag = default --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ var_dump($temp_array);
+
+ echo "-- Sort flag = SORT_REGULAR --\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rsort() : variation ***
+
+-- Iteration 1 --
+-- Sort flag = default --
+bool(true)
+array(5) {
+ [0]=>
+ int(66)
+ [1]=>
+ int(55)
+ [2]=>
+ int(33)
+ [3]=>
+ int(22)
+ [4]=>
+ int(11)
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(5) {
+ [0]=>
+ int(66)
+ [1]=>
+ int(55)
+ [2]=>
+ int(33)
+ [3]=>
+ int(22)
+ [4]=>
+ int(11)
+}
+
+-- Iteration 2 --
+-- Sort flag = default --
+bool(true)
+array(3) {
+ [0]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+ }
+ [2]=>
+ array(3) {
+ ["a"]=>
+ string(6) "orange"
+ ["b"]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+ }
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+ }
+ [2]=>
+ array(3) {
+ ["a"]=>
+ string(6) "orange"
+ ["b"]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+ }
+}
+
+-- Iteration 3 --
+-- Sort flag = default --
+bool(true)
+array(6) {
+ [0]=>
+ int(19)
+ [1]=>
+ int(13)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(6) {
+ [0]=>
+ int(19)
+ [1]=>
+ int(13)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+}
+
+-- Iteration 4 --
+-- Sort flag = default --
+bool(true)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "baz"
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(3) "baz"
+}
+
+-- Iteration 5 --
+-- Sort flag = default --
+bool(true)
+array(4) {
+ [0]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ [1]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ [2]=>
+ int(5)
+ [3]=>
+ int(1)
+}
+-- Sort flag = SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+ [1]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ [2]=>
+ int(5)
+ [3]=>
+ int(1)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/sizeof_basic1.phpt b/ext/standard/tests/array/sizeof_basic1.phpt
new file mode 100644
index 000000000..dea4a68ea
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_basic1.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test sizeof() function : basic functionality - for scalar types
+--FILE--
+<?php
+/* Prototype : int sizeof(mixed $var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP library is
+ * installed, it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+/* Testing the sizeof() for some of the scalar types(integer, float) values
+ * in default, COUNT_NORMAL and COUNT_RECURSIVE modes.
+ */
+
+echo "*** Testing sizeof() : basic functionality ***\n";
+
+$intval = 10;
+$floatval = 10.5;
+$stringval = "String";
+
+echo "-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($intval) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($intval, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($intval, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($floatval) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($floatval, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($floatval, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : basic functionality ***
+-- Testing sizeof() for integer type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
+default mode: int(1)
+
+COUNT_NORMAL mode: int(1)
+
+COUNT_RECURSIVE mode: int(1)
+
+-- Testing sizeof() for float type in default, COUNT_NORMAL and COUNT_RECURSIVE modes --
+default mode: int(1)
+
+COUNT_NORMAL mode: int(1)
+
+COUNT_RECURSIVE mode: int(1)
+Done
diff --git a/ext/standard/tests/array/sizeof_basic2.phpt b/ext/standard/tests/array/sizeof_basic2.phpt
new file mode 100644
index 000000000..a2ab2eedf
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_basic2.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test sizeof() function : basic functionality - for non-scalar type(array)
+--FILE--
+<?php
+/* Prototype : int sizeof(mixed $var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP library is
+ * installed, it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+/* Testing the sizeof() for non-scalar type(array) value
+ * in default, COUNT_NORMAL and COUNT_RECURSIVE modes.
+ * Sizeof() has been tested for simple integer, string,
+ * indexed and mixed arrays.
+ */
+
+echo "*** Testing sizeof() : basic functionality ***\n";
+
+$int_array = array(1, 2, 3, 4);
+$string_array = array("Saffron", "White", "Green");
+$indexed_array = array("Agression" => "Saffron", "Peace" => "White", "Growth" => "Green");
+$mixed_array = array(1, 2, "Aggression" => "Saffron", 10 => "Ten", "Ten" => 10);
+
+echo "-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($int_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($int_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($int_array, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($string_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($string_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($string_array, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($indexed_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($indexed_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($indexed_array, COUNT_RECURSIVE) );
+echo "\n";
+
+echo "-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
+echo "default mode: ";
+var_dump( sizeof($mixed_array) );
+echo "\n";
+echo "COUNT_NORMAL mode: ";
+var_dump( sizeof($mixed_array, COUNT_NORMAL) );
+echo "\n";
+echo "COUNT_RECURSIVE mode: ";
+var_dump( sizeof($mixed_array, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : basic functionality ***
+-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(4)
+
+COUNT_NORMAL mode: int(4)
+
+COUNT_RECURSIVE mode: int(4)
+
+-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(3)
+
+COUNT_NORMAL mode: int(3)
+
+COUNT_RECURSIVE mode: int(3)
+
+-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(3)
+
+COUNT_NORMAL mode: int(3)
+
+COUNT_RECURSIVE mode: int(3)
+
+-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
+default mode: int(5)
+
+COUNT_NORMAL mode: int(5)
+
+COUNT_RECURSIVE mode: int(5)
+Done
diff --git a/ext/standard/tests/array/sizeof_error.phpt b/ext/standard/tests/array/sizeof_error.phpt
new file mode 100644
index 000000000..79a75f315
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sizeof() function : error conditions
+--FILE--
+<?php
+/* Prototype : int sizeof(mixed $var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP Library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+// Calling sizeof() with zero and more than expected arguments .
+
+echo "*** Testing sizeof() : error conditions ***\n";
+
+echo "-- Testing sizeof() with zero arguments --\n";
+var_dump( sizeof() );
+echo "-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --\n";
+$var = 100;
+$extra_arg = 10;;
+var_dump( sizeof($var, COUNT_NORMAL, $extra_arg) );
+echo "-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --\n";
+var_dump( sizeof($var, COUNT_RECURSIVE, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : error conditions ***
+-- Testing sizeof() with zero arguments --
+
+Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --
+
+Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --
+
+Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/sizeof_object1.phpt b/ext/standard/tests/array/sizeof_object1.phpt
new file mode 100644
index 000000000..470599605
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_object1.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test sizeof() function : object functionality - object with Countable interface
+--SKIPIF--
+<?php
+// Skip the test case if Standard PHP Library(spl) is not installed
+ if( !extension_loaded('spl'))
+ {
+ die('skip spl is not installed');
+ }
+?>
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : object functionality ***\n";
+
+echo "-- Testing sizeof() with an object which implements Countable interface --\n";
+class sizeof_class implements Countable
+{
+ public $member1;
+ private $member2;
+ protected $member3;
+
+ public function count()
+ {
+ return 3; // return the count of member variables in the object
+ }
+}
+
+$obj = new sizeof_class();
+
+echo "-- Testing sizeof() in default mode --\n";
+var_dump( sizeof($obj) );
+echo "-- Testing sizeof() in COUNT_NORMAL mode --\n";
+var_dump( sizeof($obj, COUNT_NORMAL) );
+echo "-- Testing sizeof() in COUNT_RECURSIVE mode --\n";
+var_dump( sizeof($obj, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : object functionality ***
+-- Testing sizeof() with an object which implements Countable interface --
+-- Testing sizeof() in default mode --
+int(3)
+-- Testing sizeof() in COUNT_NORMAL mode --
+int(3)
+-- Testing sizeof() in COUNT_RECURSIVE mode --
+int(3)
+Done
diff --git a/ext/standard/tests/array/sizeof_object2.phpt b/ext/standard/tests/array/sizeof_object2.phpt
new file mode 100644
index 000000000..e2c0816c6
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_object2.phpt
@@ -0,0 +1,138 @@
+--TEST--
+Test sizeof() function : object functionality - objects without Countable interface
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode] )
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : object functionality ***\n";
+
+echo "--- Testing sizeof() with objects which doesn't implement Countable interface ---\n";
+
+// class without member
+class test
+{
+ // no members
+}
+
+// class with only members and with out member functions
+class test1
+{
+ public $member1;
+ var $var1;
+ private $member2;
+ protected $member3;
+
+ // no member functions
+}
+
+// class with only member functions
+class test2
+{
+ // no data members
+
+ public function display()
+ {
+ echo " Class Name : test2\n";
+ }
+}
+
+// child class which inherits parent test2
+class child_test2 extends test2
+{
+ public $child_member1;
+ private $child_member2;
+}
+
+// abstract class
+abstract class abstract_class
+{
+ public $member1;
+ private $member2;
+
+ abstract protected function display();
+}
+
+// implement abstract 'abstract_class' class
+class concrete_class extends abstract_class
+{
+ protected function display()
+ {
+ echo " class name is : concrete_class \n ";
+ }
+}
+
+$objects = array (
+ /* 1 */ new test(),
+ new test1(),
+ new test2(),
+ new child_test2(),
+ /* 5 */ new concrete_class()
+);
+
+$counter = 1;
+for($i = 0; $i < count($objects); $i++)
+{
+ echo "-- Iteration $counter --\n";
+ $var = $objects[$i];
+
+ echo "Default Mode: ";
+ var_dump( sizeof($var) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($var, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($var, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : object functionality ***
+--- Testing sizeof() with objects which doesn't implement Countable interface ---
+-- Iteration 1 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 2 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 3 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 4 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 5 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation1.phpt b/ext/standard/tests/array/sizeof_variation1.phpt
new file mode 100644
index 000000000..328645f9e
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_variation1.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test sizeof() function : usage variations - for all scalar types and resource variable
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode ---\n";
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// array containing all scalar types
+$values = array (
+ // int values
+ /* 1 */ 0,
+ 1,
+
+ // float values
+ /* 3 */ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ /* 7 */ .5,
+
+ // NULL values
+ /* 8 */ NULL,
+ null,
+
+ // boolean values
+ /* 10 */ TRUE,
+ FALSE,
+ true,
+ /* 13 */ false,
+
+ // string data
+ /* 14 */ "",
+ '',
+ "string",
+ /* 17 */ 'string',
+
+ // undefined variable
+ @$undefined_var,
+
+ // resource variable
+ /* 19 */ $fp
+);
+
+// loop through the each value of the array for 'var' argument and check the behaviour of sizeof()
+$counter = 1;
+for($i = 0; $i < count($values); $i++)
+{
+ echo "-- Iteration $counter --\n";
+
+ $var = $values[$i];
+
+ echo "Default Mode: ";
+ var_dump( sizeof($var) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($var, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($var, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() for all scalar types in default,COUNT_NORMAL and COUNT_RECURSIVE mode ---
+-- Iteration 1 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 2 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 3 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 4 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 5 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 6 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 7 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 8 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 9 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 10 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 11 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 12 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 13 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 14 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 15 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 16 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 17 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+-- Iteration 18 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 19 --
+Default Mode: int(1)
+
+COUNT_NORMAL Mode: int(1)
+
+COUNT_RECURSIVE Mode: int(1)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation2.phpt b/ext/standard/tests/array/sizeof_variation2.phpt
new file mode 100644
index 000000000..a22457978
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_variation2.phpt
@@ -0,0 +1,163 @@
+--TEST--
+Test sizeof() function : usage variations - different array values for 'var' argument
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+echo "--- Testing sizeof() with different array values for 'var' argument ---\n";
+
+// array containing different types of array values for 'var' argument
+$values = array (
+ /* 1 */ array($fp, "resource" => $fp),
+ array(1, array(3, 4, array(6, array(8)))),
+ array("a" => 1, 'b' => 2, array( "c" =>3, array( "d" => 5))),
+ array(),
+ /* 5 */ array(1, 2, 3, 4),
+ array("Saffron", "White", "Green"),
+ array('saffron', 'white', 'green'),
+ array(1 => "Hi", 2 => "Hello" ),
+ array("color" => "red", "item" => "pen"),
+ /* 10 */ array('color' => 'red', 'item' => 'pen'),
+ array(TRUE => "red", FALSE => "pen" ),
+ array(false => 'red', true => 'pen' ),
+ array('color' => "red", "item" => 'pen', 1 => "Hi", "" => "Hello" ),
+ /* 14 */ array($fp, "resource1" => $fp, 'resource2' => $fp, array( $fp, 'type' => $fp) )
+);
+
+// loop through each element of the values array for 'var' argument
+// check the working of sizeof()
+$counter = 1;
+for($i = 0; $i < count($values); $i++)
+{
+ echo "-- Iteration $counter --\n";
+ $var = $values[$i];
+
+ echo "Default Mode: ";
+ var_dump( sizeof($var) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($var, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($var, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() with different array values for 'var' argument ---
+-- Iteration 1 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 2 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(8)
+
+-- Iteration 3 --
+Default Mode: int(3)
+
+COUNT_NORMAL Mode: int(3)
+
+COUNT_RECURSIVE Mode: int(6)
+
+-- Iteration 4 --
+Default Mode: int(0)
+
+COUNT_NORMAL Mode: int(0)
+
+COUNT_RECURSIVE Mode: int(0)
+
+-- Iteration 5 --
+Default Mode: int(4)
+
+COUNT_NORMAL Mode: int(4)
+
+COUNT_RECURSIVE Mode: int(4)
+
+-- Iteration 6 --
+Default Mode: int(3)
+
+COUNT_NORMAL Mode: int(3)
+
+COUNT_RECURSIVE Mode: int(3)
+
+-- Iteration 7 --
+Default Mode: int(3)
+
+COUNT_NORMAL Mode: int(3)
+
+COUNT_RECURSIVE Mode: int(3)
+
+-- Iteration 8 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 9 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 10 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 11 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 12 --
+Default Mode: int(2)
+
+COUNT_NORMAL Mode: int(2)
+
+COUNT_RECURSIVE Mode: int(2)
+
+-- Iteration 13 --
+Default Mode: int(4)
+
+COUNT_NORMAL Mode: int(4)
+
+COUNT_RECURSIVE Mode: int(4)
+
+-- Iteration 14 --
+Default Mode: int(4)
+
+COUNT_NORMAL Mode: int(4)
+
+COUNT_RECURSIVE Mode: int(6)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation3.phpt b/ext/standard/tests/array/sizeof_variation3.phpt
new file mode 100644
index 000000000..ba8afb83e
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_variation3.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test sizeof() function : usage variations - checking for infinite recursion in COUNT_RECURSIVE mode
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "-- Testing sizeof() for infinite recursion with arrays as argument in COUNT_RECURSIVE mode --\n";
+
+$array2 = array ( "Hi", "Hello",@$a);
+$array3 = array( 'hi', 'hello');
+$a = array ( 1, @$array1, $array2, $array3);
+$array1 = array( array(1, 2), $a);
+$array4 = array( 100, @$array4);
+
+var_dump( sizeof($array1, COUNT_RECURSIVE) );
+echo "\n";
+var_dump( sizeof($array4, COUNT_RECURSIVE) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+-- Testing sizeof() for infinite recursion with arrays as argument in COUNT_RECURSIVE mode --
+int(13)
+
+int(2)
+Done
diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt
new file mode 100644
index 000000000..a2462757d
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_variation4.phpt
@@ -0,0 +1,350 @@
+--TEST--
+Test sizeof() function : usage variations - all kinds of unset variables for 'var' argument
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes ---\n";
+
+// class declaration
+class test
+{
+ public $member1;
+}
+
+// get an resource variable
+$fp = fopen(__FILE__, "r");
+
+// array containing different types of variables
+$values = array (
+ // int values
+ /* 1 */ 0,
+ 1,
+ // float values
+ /* 3 */ 10.5,
+ -10.5,
+ 12.34e3,
+ /* 6 */ 12.34E-3,
+ // string values
+ /* 7 */ "string",
+ 'string',
+ "",
+ /* 10 */ '',
+ // NULL values
+ /* 11 */ NULL,
+ null,
+ // Boolean Values
+ /* 12 */ TRUE,
+ true,
+ false,
+ /* 16 */ FALSE,
+ // array values
+ /* 17 */ array(),
+ array(1, 2, 3,4 , array(5, 6)),
+ // object variable
+ /* 19 */ new test(),
+ // resource variable
+ /* 20 */ $fp
+);
+
+// loop through the each element of the $values array for 'var' arugment
+// and check the functionality of sizeof()
+$counter = 1;
+foreach($values as $value)
+{
+ echo "-- Iteration $counter --\n";
+
+ // unset the variable
+ unset($value);
+
+ // now check the size of unset variable when different modes are given
+ echo "Default Mode: ";
+ var_dump( sizeof($value) );
+ echo "\n";
+
+ echo "COUNT_NORMAL Mode: ";
+ var_dump( sizeof($value, COUNT_NORMAL) );
+ echo "\n";
+
+ echo "COUNT_RECURSIVE Mode: ";
+ var_dump( sizeof($value, COUNT_RECURSIVE) );
+ echo "\n";
+
+ $counter++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes ---
+-- Iteration 1 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 2 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 3 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 4 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 5 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 6 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 7 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 8 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 9 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 10 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 11 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 12 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 13 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 14 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 15 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 16 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 17 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 18 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 19 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+-- Iteration 20 --
+Default Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_NORMAL Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+COUNT_RECURSIVE Mode:
+Notice: Undefined variable: value in %s on line %d
+int(0)
+
+Done
diff --git a/ext/standard/tests/array/sizeof_variation5.phpt b/ext/standard/tests/array/sizeof_variation5.phpt
new file mode 100644
index 000000000..6e40f7ea7
--- /dev/null
+++ b/ext/standard/tests/array/sizeof_variation5.phpt
@@ -0,0 +1,132 @@
+--TEST--
+Test sizeof() function : usage variations - different values for 'mode' argument
+--FILE--
+<?php
+/* Prototype : int sizeof($mixed var[, int $mode])
+ * Description: Counts an elements in an array. If Standard PHP library is installed,
+ * it will return the properties of an object.
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions: count()
+ */
+
+echo "*** Testing sizeof() : usage variations ***\n";
+
+echo "--- Testing sizeof() with different values for 'mode' argument ---\n";
+$array1 = array(1, 2, 3, 4, array(1.0, 2.0, array()), array() );
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//unset variable
+$unset_var = 10;
+unset($unset_var);
+
+//class declaration
+class test
+{
+ public $member1;
+}
+
+$mode_values = array (
+ /* 1 */ COUNT_NORMAL,
+ COUNT_RECURSIVE,
+ 0, // same as COUNT_NORMAL
+ 1, // same as COUNT_RECURSIVE
+
+ /* 5 */ TRUE, // same as COUNT_RECURSIVE
+ true, // same as COUNT_RECURSIVE
+ FALSE, // same as COUNT_NORMAL
+ false, // same as COUNT_NORMAL
+ NULL, // same as COUNT_NORMAL
+ /* 10 */ null, // same as COUNT_NORMAL
+ 100,
+ 10.5,
+ 12.34e3,
+ 12.34E-2,
+ /* 15 */ .5,
+ "",
+ '',
+ "string",
+ 'string',
+ /* 20 */ @$unset_var,
+ new test(),
+ /* 22 */ $fp
+);
+
+// loop through the each element of $modes_array for 'mode' argument
+// and check the working of sizeof()
+$counter = 1;
+for($i = 0; $i < count($mode_values); $i++)
+{
+ echo "-- Iteration $counter --\n";
+ $mode = $mode_values[$i];
+
+ var_dump( sizeof($array1, $mode) );
+
+ $counter++;
+}
+
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sizeof() : usage variations ***
+--- Testing sizeof() with different values for 'mode' argument ---
+-- Iteration 1 --
+int(6)
+-- Iteration 2 --
+int(9)
+-- Iteration 3 --
+int(6)
+-- Iteration 4 --
+int(9)
+-- Iteration 5 --
+int(9)
+-- Iteration 6 --
+int(9)
+-- Iteration 7 --
+int(6)
+-- Iteration 8 --
+int(6)
+-- Iteration 9 --
+int(6)
+-- Iteration 10 --
+int(6)
+-- Iteration 11 --
+int(6)
+-- Iteration 12 --
+int(6)
+-- Iteration 13 --
+int(6)
+-- Iteration 14 --
+int(6)
+-- Iteration 15 --
+int(6)
+-- Iteration 16 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: sizeof() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 20 --
+int(6)
+-- Iteration 21 --
+
+Warning: sizeof() expects parameter 2 to be long, object given in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: sizeof() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/uasort_basic1.phpt b/ext/standard/tests/array/uasort_basic1.phpt
new file mode 100644
index 000000000..70dd04c0c
--- /dev/null
+++ b/ext/standard/tests/array/uasort_basic1.phpt
@@ -0,0 +1,116 @@
+--TEST--
+Test uasort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing uasort() : basic functionality ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Int array with default keys
+$int_values = array(1, 8, 9, 3, 2, 6, 7);
+echo "-- Numeric array with default keys --\n";
+var_dump( uasort($int_values, 'cmp') );
+var_dump($int_values);
+
+// String array with default keys
+$string_values = array("This", "is", 'a', "test");
+echo "-- String array with default keys --\n";
+var_dump( uasort($string_values, 'cmp') );
+var_dump($string_values);
+
+// Associative array with numeric keys
+$numeric_key_arg = array(1=> 1, 2 => 2, 3 => 7, 5 => 4, 4 => 9);
+echo "-- Associative array with numeric keys --\n";
+var_dump( uasort($numeric_key_arg, 'cmp') );
+var_dump($numeric_key_arg);
+
+// Associative array with string keys
+$string_key_arg = array('one' => 4, 'two' => 2, 'three' => 1, 'four' => 10);
+echo "-- Associative array with string keys --\n";
+var_dump( uasort($string_key_arg, 'cmp') );
+var_dump($string_key_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : basic functionality ***
+-- Numeric array with default keys --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [4]=>
+ int(2)
+ [3]=>
+ int(3)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+}
+-- String array with default keys --
+bool(true)
+array(4) {
+ [0]=>
+ string(4) "This"
+ [2]=>
+ string(1) "a"
+ [1]=>
+ string(2) "is"
+ [3]=>
+ string(4) "test"
+}
+-- Associative array with numeric keys --
+bool(true)
+array(5) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [5]=>
+ int(4)
+ [3]=>
+ int(7)
+ [4]=>
+ int(9)
+}
+-- Associative array with string keys --
+bool(true)
+array(4) {
+ ["three"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(4)
+ ["four"]=>
+ int(10)
+}
+Done
diff --git a/ext/standard/tests/array/uasort_basic2.phpt b/ext/standard/tests/array/uasort_basic2.phpt
new file mode 100644
index 000000000..e1b4ac9b2
--- /dev/null
+++ b/ext/standard/tests/array/uasort_basic2.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test uasort() function : basic functionality - duplicate values
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing uasort() : basic functionality with duplicate values ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// increasing values
+$int_values1 = array(1, 1, 2, 2, 3, 3);
+echo "-- Numeric array with increasing values --\n";
+var_dump( uasort($int_values1, 'cmp') );
+var_dump($int_values1);
+
+// decreasing values
+$int_values2 = array(3, 3, 2, 2, 1, 1);
+echo "-- Numeric array with decreasing values --\n";
+var_dump( uasort($int_values2, 'cmp') );
+var_dump($int_values2);
+
+// increasing and decreasing values
+$int_values3 = array(1, 2, 3, 3, 2, 1);
+echo "-- Numeric array with increasing and decreasing values --\n";
+var_dump( uasort($int_values3, 'cmp') );
+var_dump($int_values3);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : basic functionality with duplicate values ***
+-- Numeric array with increasing values --
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(2)
+ [2]=>
+ int(2)
+ [5]=>
+ int(3)
+ [4]=>
+ int(3)
+}
+-- Numeric array with decreasing values --
+bool(true)
+array(6) {
+ [4]=>
+ int(1)
+ [5]=>
+ int(1)
+ [3]=>
+ int(2)
+ [2]=>
+ int(2)
+ [1]=>
+ int(3)
+ [0]=>
+ int(3)
+}
+-- Numeric array with increasing and decreasing values --
+bool(true)
+array(6) {
+ [5]=>
+ int(1)
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [4]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/uasort_error.phpt b/ext/standard/tests/array/uasort_error.phpt
new file mode 100644
index 000000000..5f3d7ef10
--- /dev/null
+++ b/ext/standard/tests/array/uasort_error.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test uasort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing uasort() : error conditions ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+// Initialize 'array_arg'
+$array_arg = array(0 => 1, 1 => 10, 2 => 'string', 3 => 3, 4 => 2, 5 => 100, 6 => 25);
+
+// With zero arguments
+echo "-- Testing uasort() function with Zero argument --\n";
+var_dump( uasort() );
+
+// With one more than the expected number of arguments
+echo "-- Testing uasort() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( uasort($array_arg, 'cmp', $extra_arg) );
+
+// With one less than the expected number of arguments
+echo "-- Testing uasort() function with less than expected no. of arguments --\n";
+var_dump( uasort($array_arg) );
+
+// With non existent comparison function
+echo "-- Testing uasort() function with non-existent compare function --\n";
+var_dump( uasort($array_arg, 'non_existent') );
+
+// With non existent comparison function and extra arguemnt
+echo "-- Testing uasort() function with non-existent compare function and extra argument --\n";
+var_dump( uasort($array_arg, 'non_existent', $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : error conditions ***
+-- Testing uasort() function with Zero argument --
+
+Warning: Wrong parameter count for uasort() in %s on line %d
+NULL
+-- Testing uasort() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for uasort() in %s on line %d
+NULL
+-- Testing uasort() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for uasort() in %s on line %d
+NULL
+-- Testing uasort() function with non-existent compare function --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Testing uasort() function with non-existent compare function and extra argument --
+
+Warning: Wrong parameter count for uasort() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/uasort_object1.phpt b/ext/standard/tests/array/uasort_object1.phpt
new file mode 100644
index 000000000..c407ebc1f
--- /dev/null
+++ b/ext/standard/tests/array/uasort_object1.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test uasort() function : object functionality
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing uasort() function with the array of objects
+ * array of objects which has only one member variable & more than one member variables
+ */
+
+echo "*** Testing uasort() : object functionality ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value3
+ * Description : compares value1 and value2
+ */
+function simple_cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// comparison function for SimpleClass2 objects which has more than one members
+function multiple_cmp($value1, $value2)
+{
+ if($value1->getValue() == $value2->getValue())
+ return 0;
+ else if($value1->getValue() > $value2->getValue())
+ return 1;
+ else
+ return -1;
+}
+
+// Simple class with single member variable
+class SimpleClass1
+{
+ private $int_value;
+
+ public function __construct($value) {
+ $this->int_value = $value;
+ }
+}
+
+// Simple class with more than one member variables
+class SimpleClass2
+{
+ private $int_value;
+ protected $float_value;
+ public $string_value;
+ public function __construct($int, $float, $str) {
+ $this->int_value = $int;
+ $this->float_value = $float;
+ $this->string_value = $str;
+ }
+ public function getValue() {
+ return $this->int_value;
+ }
+}
+
+// array of SimpleClass objects with only one member
+$array_arg = array(
+ 0 => new SimpleClass1(10),
+ 1 => new SimpleClass1(1),
+ 2 => new SimpleClass1(100),
+ 3 => new SimpleClass1(50)
+);
+var_dump( uasort($array_arg, 'simple_cmp') );
+var_dump($array_arg);
+
+// array of SimpleClass objects having more than one members
+$array_arg = array(
+ 0 => new SimpleClass2(2, 3.4, "mango"),
+ 1 => new SimpleClass2(10, 1.2, "apple"),
+ 2 => new SimpleClass2(5, 2.5, "orange"),
+);
+var_dump( uasort($array_arg, 'multiple_cmp') );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : object functionality ***
+bool(true)
+array(4) {
+ [1]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value:private"]=>
+ int(1)
+ }
+ [0]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value:private"]=>
+ int(10)
+ }
+ [3]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value:private"]=>
+ int(50)
+ }
+ [2]=>
+ object(SimpleClass1)#%d (1) {
+ ["int_value:private"]=>
+ int(100)
+ }
+}
+bool(true)
+array(3) {
+ [0]=>
+ object(SimpleClass2)#%d (3) {
+ ["int_value:private"]=>
+ int(2)
+ ["float_value:protected"]=>
+ float(3.4)
+ ["string_value"]=>
+ string(5) "mango"
+ }
+ [2]=>
+ object(SimpleClass2)#%d (3) {
+ ["int_value:private"]=>
+ int(5)
+ ["float_value:protected"]=>
+ float(2.5)
+ ["string_value"]=>
+ string(6) "orange"
+ }
+ [1]=>
+ object(SimpleClass2)#%d (3) {
+ ["int_value:private"]=>
+ int(10)
+ ["float_value:protected"]=>
+ float(1.2)
+ ["string_value"]=>
+ string(5) "apple"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/uasort_object2.phpt b/ext/standard/tests/array/uasort_object2.phpt
new file mode 100644
index 000000000..cd32d8d94
--- /dev/null
+++ b/ext/standard/tests/array/uasort_object2.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test uasort() function : object functionality - sort diff. objects
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*
+
+/*
+ * This testcase tests uasort() functionality with differnt objects
+ * Objects of different classes:
+ * simple class,
+ * child class,
+ * empty class &
+ * static class
+ */
+
+echo "*** Testing uasort() : object functionality ***\n";
+
+// comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+
+// Simple class with single member variable
+class SimpleClass
+{
+ private $int_value;
+
+ public function __construct($value) {
+ $this->int_value = $value;
+ }
+
+}
+
+// Class without any member
+class EmptyClass
+{
+}
+
+// Class with static member
+class StaticClass
+{
+ public static $static_value;
+ public function __construct($value) {
+ StaticClass::$static_value = $value;
+ }
+}
+
+// Abstract class
+abstract class AbstractClass
+{
+ public $pub_value;
+ public abstract function abstractMethod();
+}
+
+// Child class extending abstract class
+class ChildClass extends AbstractClass
+{
+ public $child_value = 100;
+ public function abstractMethod() {
+ $pub_value = 5;
+ }
+ public function __construct($value) {
+ $this->child_value = $value;
+ }
+}
+
+// Testing uasort with StaticClass objects as elements of 'array_arg'
+echo "-- Testing uasort() with StaticClass objects --\n";
+$array_arg = array(
+ 0 => new StaticClass(20),
+ 1 => new StaticClass(50),
+ 2 => new StaticClass(15),
+ 3 => new StaticClass(70),
+);
+var_dump( uasort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+// Testing uasort with EmptyClass objects as elements of 'array_arg'
+echo "-- Testing uasort() with EmptyClass objects --\n";
+$array_arg = array(
+ 0 => new EmptyClass(),
+ 1 => new EmptyClass(),
+ 2 => new EmptyClass(),
+ 3 => new EmptyClass(),
+);
+var_dump( uasort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+// Testing uasort with ChildClass objects as elements of 'array_arg'
+echo "-- Testing uasort() with ChildClass objects --\n";
+$array_arg = array(
+ 0 => new ChildClass(20),
+ 1 => new ChildClass(500),
+ 2 => new ChildClass(15),
+ 3 => new ChildClass(700),
+);
+var_dump( uasort($array_arg, 'cmp_function') );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : object functionality ***
+-- Testing uasort() with StaticClass objects --
+bool(true)
+array(4) {
+ [3]=>
+ object(StaticClass)#%d (0) {
+ }
+ [2]=>
+ object(StaticClass)#%d (0) {
+ }
+ [1]=>
+ object(StaticClass)#%d (0) {
+ }
+ [0]=>
+ object(StaticClass)#%d (0) {
+ }
+}
+-- Testing uasort() with EmptyClass objects --
+bool(true)
+array(4) {
+ [3]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [2]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [1]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [0]=>
+ object(EmptyClass)#%d (0) {
+ }
+}
+-- Testing uasort() with ChildClass objects --
+bool(true)
+array(4) {
+ [2]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(15)
+ ["pub_value"]=>
+ NULL
+ }
+ [0]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(20)
+ ["pub_value"]=>
+ NULL
+ }
+ [1]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(500)
+ ["pub_value"]=>
+ NULL
+ }
+ [3]=>
+ object(ChildClass)#%d (2) {
+ ["child_value"]=>
+ int(700)
+ ["pub_value"]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation1.phpt b/ext/standard/tests/array/uasort_variation1.phpt
new file mode 100644
index 000000000..cce86ee0b
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation1.phpt
@@ -0,0 +1,188 @@
+--TEST--
+Test uasort() function : usage variations - unexpected values for 'array_arg' argument
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() function by passing different scalar/nonscalar values as 'array_arg' argument
+*/
+
+echo "*** Testing uasort() : unexpected values for 'array_arg' ***\n";
+
+// Comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get resource variable
+$fp = fopen(__FILE__,'r');
+
+//array of values to iterate over
+$input_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // resource data
+/*20*/ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+);
+
+// loop through each value of input_values
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( uasort($input_values[$count], 'cmp_function') );
+};
+
+//closing resource
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : unexpected values for 'array_arg' ***
+-- Iteration 1 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: uasort(): The argument should be an array in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/uasort_variation10.phpt b/ext/standard/tests/array/uasort_variation10.phpt
new file mode 100644
index 000000000..809cb78f5
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation10.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test uasort() function : usage variations - sort array with reference variables
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() with 'array_arg' containing different reference variables
+*/
+
+// comparision function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+echo "*** Testing uasort() : 'array_arg' with elements as reference ***\n";
+
+// different variables which are used as elements of 'array_arg'
+$value1 = -5;
+$value2 = 100;
+$value3 = 0;
+$value4 = &$value1;
+
+// array_args an array containing elements with reference variables
+$array_arg = array(
+ 0 => 10,
+ 1 => &$value4,
+ 2 => &$value2,
+ 3 => 200,
+ 4 => &$value3,
+);
+
+echo "-- Sorting 'array_arg' containing different references --\n";
+var_dump( uasort($array_arg, 'cmp_function') ); // expecting: bool(true)
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : 'array_arg' with elements as reference ***
+-- Sorting 'array_arg' containing different references --
+bool(true)
+array(5) {
+ [1]=>
+ &int(-5)
+ [4]=>
+ &int(0)
+ [0]=>
+ int(10)
+ [2]=>
+ &int(100)
+ [3]=>
+ int(200)
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation11.phpt b/ext/standard/tests/array/uasort_variation11.phpt
new file mode 100644
index 000000000..6d523eaed
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation11.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test uasort() function : usage variations - different associative arrays
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/* Testing uasort() with different associative arrays having keys as
+ * string, integer, default & duplicate keys
+ */
+
+echo "*** Testing uasort() : sorting different associative arrays ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Array with duplicate string and integer keys
+$array_arg = array(0 => 2, "a" => 8, "d" => 9, 3 => 3, 5 => 2, "o" => 6, "z" => -99, 0 => 1, "z" => 3);
+echo "-- Array with duplicate keys --\n";
+var_dump( uasort($array_arg, 'cmp') );
+var_dump($array_arg);
+
+// Array with default and assigned keys
+$array_arg = array(0 => "Banana", 1 => "Mango", "Orange", 2 => "Apple", "Pineapple");
+echo "-- Array with default/assigned keys --\n";
+var_dump( uasort($array_arg, 'cmp') );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : sorting different associative arrays ***
+-- Array with duplicate keys --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [5]=>
+ int(2)
+ ["z"]=>
+ int(3)
+ [3]=>
+ int(3)
+ ["o"]=>
+ int(6)
+ ["a"]=>
+ int(8)
+ ["d"]=>
+ int(9)
+}
+-- Array with default/assigned keys --
+bool(true)
+array(4) {
+ [2]=>
+ string(5) "Apple"
+ [0]=>
+ string(6) "Banana"
+ [1]=>
+ string(5) "Mango"
+ [3]=>
+ string(9) "Pineapple"
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation2.phpt b/ext/standard/tests/array/uasort_variation2.phpt
new file mode 100644
index 000000000..af1b71c0e
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation2.phpt
@@ -0,0 +1,212 @@
+--TEST--
+Test uasort() function : usage variations - unexpected values for 'cmp_function' argument
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() function with different scalar and nonscalar values in place of 'cmp_function'
+*/
+
+echo "*** Testing uasort() : Unexpected values in place of comparison function ***\n";
+
+// Class definition for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+$array_arg = array(0 => 1, 1 => -1, 2 => 3, 3 => 10, 4 => 4, 5 => 2, 6 => 8, 7 => 5);
+
+// Get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// Get resource variable
+$fp = fopen(__FILE__,'r');
+
+// different values for 'cmp_function'
+$cmp_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .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
+ "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 cmp_values for 'cmp_function'
+for($count = 0; $count < count($cmp_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( uasort($array_arg, $cmp_values[$count]) );
+};
+
+//closing resource
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : Unexpected values in place of comparison function ***
+-- Iteration 1 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 25 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 26 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 27 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Iteration 28 --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/uasort_variation3.phpt b/ext/standard/tests/array/uasort_variation3.phpt
new file mode 100644
index 000000000..9147d5991
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/array/uasort_variation4.phpt b/ext/standard/tests/array/uasort_variation4.phpt
new file mode 100644
index 000000000..c2844bfd2
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation4.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test uasort() function : usage variations - sort different numeric values
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* sorting different types of numeric arrays containing data of following type:
+* integer, octal, hexadecimal & float
+*/
+
+// comparision function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+echo "*** Testing uasort() : different numeric arrays as 'array_arg' ***\n";
+
+// Int array
+$int_values = array(0 => 3, 1 => 2, 3 => 100, 4 => 150, 5 => 25, 6 => 350, 7 => 0, 8 => -3, 9 => -1200);
+echo "-- Sorting Integer array --\n";
+var_dump( uasort($int_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($int_values);
+
+// Octal array
+$octal_values = array(0 => 056, 1 => 023, 2 => 090, 3 => 015, 4 => -045, 5 => 01, 6 => -078);
+echo "-- Sorting Octal array --\n";
+var_dump( uasort($octal_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($octal_values);
+
+// Hexadecimal array
+$hex_values = array(0 => 0xAE, 1 => 0x2B, 2 => 0X10, 3 => -0xCF, 4 => 0X12, 5 => -0XF2);
+echo "-- Sorting Hex array --\n";
+var_dump( uasort($hex_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($hex_values);
+
+// Float array
+$float_values = array( 0 => 10.2, 1 => 2.4, 2 => -3.4, 3 => 0, 4 => 0.5, 5 => 7.3e3, 6 => -9.34E-2);
+echo "-- Sorting Float array --\n";
+var_dump( uasort($float_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($float_values);
+
+// empty array
+$empty_array = array();
+echo "-- Sorting empty array --\n";
+var_dump( uasort($empty_array, 'cmp_function') ); // expecting: bool(true)
+var_dump($empty_array);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : different numeric arrays as 'array_arg' ***
+-- Sorting Integer array --
+bool(true)
+array(9) {
+ [9]=>
+ int(-1200)
+ [8]=>
+ int(-3)
+ [7]=>
+ int(0)
+ [1]=>
+ int(2)
+ [0]=>
+ int(3)
+ [5]=>
+ int(25)
+ [3]=>
+ int(100)
+ [4]=>
+ int(150)
+ [6]=>
+ int(350)
+}
+-- Sorting Octal array --
+bool(true)
+array(7) {
+ [4]=>
+ int(-37)
+ [6]=>
+ int(-7)
+ [2]=>
+ int(0)
+ [5]=>
+ int(1)
+ [3]=>
+ int(13)
+ [1]=>
+ int(19)
+ [0]=>
+ int(46)
+}
+-- Sorting Hex array --
+bool(true)
+array(6) {
+ [5]=>
+ int(-242)
+ [3]=>
+ int(-207)
+ [2]=>
+ int(16)
+ [4]=>
+ int(18)
+ [1]=>
+ int(43)
+ [0]=>
+ int(174)
+}
+-- Sorting Float array --
+bool(true)
+array(7) {
+ [2]=>
+ float(-3.4)
+ [6]=>
+ float(-0.0934)
+ [3]=>
+ int(0)
+ [4]=>
+ float(0.5)
+ [1]=>
+ float(2.4)
+ [0]=>
+ float(10.2)
+ [5]=>
+ float(7300)
+}
+-- Sorting empty array --
+bool(true)
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation5.phpt b/ext/standard/tests/array/uasort_variation5.phpt
new file mode 100644
index 000000000..22d9da31c
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation5.phpt
@@ -0,0 +1,145 @@
+--TEST--
+Test uasort() function : usage variations - sort diff. strings
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* sorting different strings:
+* single quoted, double quoted and heredoc strings
+*/
+
+// comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+// Different heredoc strings to be sorted
+$empty_heredoc =<<<EOT
+EOT;
+
+$simple_heredoc1 =<<<EOT
+Heredoc
+EOT;
+
+$simple_heredoc2 =<<<EOT
+HEREDOC
+EOT;
+
+$multiline_heredoc =<<<EOT
+heredoc string\twith!@# and 123
+Test this!!!
+EOT;
+
+
+echo "*** Testing uasort() : different string arrays as 'array_arg' ***\n";
+
+// Single quoted strings
+$single_quoted_values = array(
+ 0 => ' ', 1 => 'test', 3 => 'Hello', 4 => 'HELLO',
+ 5 => '', 6 => '\t', 7 => '0', 8 => '123Hello', 9 => '\'', 10 => '@#$%'
+);
+echo "-- Sorting Single Quoted String values --\n";
+var_dump( uasort($single_quoted_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($single_quoted_values);
+
+// Double quoted strings
+$double_quoted_values = array(
+ 0 => " ", 1 => "test", 3 => "Hello", 4 => "HELLO",
+ 5 => "", 6 => "\t", 7 => "0", 8 => "123Hello", 9 => "\"", 10 => "@#$%"
+);
+echo "-- Sorting Double Quoted String values --\n";
+var_dump( uasort($double_quoted_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($double_quoted_values);
+
+// Heredoc strings
+$heredoc_values = array(0 => $empty_heredoc, 1 => $simple_heredoc1, 2 => $simple_heredoc2, 3 => $multiline_heredoc);
+echo "-- Sorting Heredoc String values --\n";
+var_dump( uasort($heredoc_values, 'cmp_function') ); // expecting: bool(true)
+var_dump($heredoc_values);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : different string arrays as 'array_arg' ***
+-- Sorting Single Quoted String values --
+bool(true)
+array(10) {
+ [5]=>
+ string(0) ""
+ [0]=>
+ string(1) " "
+ [9]=>
+ string(1) "'"
+ [7]=>
+ string(1) "0"
+ [8]=>
+ string(8) "123Hello"
+ [10]=>
+ string(4) "@#$%"
+ [4]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "Hello"
+ [6]=>
+ string(2) "\t"
+ [1]=>
+ string(4) "test"
+}
+-- Sorting Double Quoted String values --
+bool(true)
+array(10) {
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) " "
+ [0]=>
+ string(1) " "
+ [9]=>
+ string(1) """
+ [7]=>
+ string(1) "0"
+ [8]=>
+ string(8) "123Hello"
+ [10]=>
+ string(4) "@#$%"
+ [4]=>
+ string(5) "HELLO"
+ [3]=>
+ string(5) "Hello"
+ [1]=>
+ string(4) "test"
+}
+-- Sorting Heredoc String values --
+bool(true)
+array(4) {
+ [0]=>
+ string(0) ""
+ [2]=>
+ string(7) "HEREDOC"
+ [1]=>
+ string(7) "Heredoc"
+ [3]=>
+ string(43) "heredoc string with!@# and 123
+Test this!!!"
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation6.phpt b/ext/standard/tests/array/uasort_variation6.phpt
new file mode 100644
index 000000000..48d9c0357
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation6.phpt
@@ -0,0 +1,115 @@
+--TEST--
+Test uasort() function : usage variations - sort array having subarrays
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing uasort() with 'array_arg' having different subarrays as array elements
+*/
+
+// comparison function
+/* Prototype : int cmp_function(mixed $value1, mixed $value2)
+ * Parameters : $value1 and $value2 - values to be compared
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp_function($value1, $value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else {
+ return -1;
+ }
+}
+
+echo "*** Testing uasort() : sorting array having different subarrays ***\n";
+
+$array_args = array(
+ 0 => array(2, 10, -1),
+ 1 => array(100),
+ 2 => array(),
+ 3 => array(0),
+ 4 => array(-1),
+ 5 => array(-9, 34, 54, 0, 20),
+ 6 => array(''),
+ 7 => array("apple", "Apple", "APPLE", "aPPle", "aPpLe")
+);
+$temp_array = $array_args;
+// sorting array_arg as whole array
+var_dump( uasort($temp_array, 'cmp_function') ); // expecting: bool(true)
+var_dump($temp_array);
+
+?>
+--EXPECTF--
+*** Testing uasort() : sorting array having different subarrays ***
+bool(true)
+array(8) {
+ [2]=>
+ array(0) {
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [6]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(100)
+ }
+ [0]=>
+ array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(-1)
+ }
+ [5]=>
+ array(5) {
+ [0]=>
+ int(-9)
+ [1]=>
+ int(34)
+ [2]=>
+ int(54)
+ [3]=>
+ int(0)
+ [4]=>
+ int(20)
+ }
+ [7]=>
+ array(5) {
+ [0]=>
+ string(5) "apple"
+ [1]=>
+ string(5) "Apple"
+ [2]=>
+ string(5) "APPLE"
+ [3]=>
+ string(5) "aPPle"
+ [4]=>
+ string(5) "aPpLe"
+ }
+}
diff --git a/ext/standard/tests/array/uasort_variation7.phpt b/ext/standard/tests/array/uasort_variation7.phpt
new file mode 100644
index 000000000..44a2bb3a2
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation7.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test uasort() function : usage variations - anonymous function as 'cmp_function'
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different anonymous functions as 'cmp_function'
+* arguments passed by value
+* arguments passed by reference
+*/
+
+echo "*** Testing uasort() : anonymous function as 'cmp_function' ***\n";
+
+$cmp_function = 'if($value1 == $value2) {return 0;} else if($value1 > $value2) {return 1;} else{return -1;}';
+
+$array_arg = array(0 => 100, 1 => 3, 2 => -70, 3 => 24, 4 => 90);
+echo "-- Anonymous 'cmp_function' with parameters passed by value --\n";
+var_dump( uasort($array_arg, create_function('$value1, $value2',$cmp_function) ) );
+var_dump($array_arg);
+
+$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "Apple", "p" => "Pineapple");
+echo "-- Anonymous 'cmp_function' with parameters passed by reference --\n";
+var_dump( uasort($array_arg, create_function('&$value1, &$value2', $cmp_function) ) );
+var_dump($array_arg);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : anonymous function as 'cmp_function' ***
+-- Anonymous 'cmp_function' with parameters passed by value --
+bool(true)
+array(5) {
+ [2]=>
+ int(-70)
+ [1]=>
+ int(3)
+ [3]=>
+ int(24)
+ [4]=>
+ int(90)
+ [0]=>
+ int(100)
+}
+-- Anonymous 'cmp_function' with parameters passed by reference --
+bool(true)
+array(4) {
+ ["a"]=>
+ string(5) "Apple"
+ ["b"]=>
+ string(6) "Banana"
+ ["m"]=>
+ string(5) "Mango"
+ ["p"]=>
+ string(9) "Pineapple"
+}
+Done
diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt
new file mode 100644
index 000000000..858ce2009
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation8.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test uasort() function : usage variations - built-in function as 'cmp_function'
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different built-in library functions in place of 'cmp_function'
+* valid comparison functions: strcmp() & strcasecmp()
+* language constructs: echo & exit
+*/
+
+echo "*** Testing uasort() : built in function as 'cmp_function' ***\n";
+// Initializing variables
+$array_arg = array("b" => "Banana", "m" => "Mango", "a" => "apple", "p" => "Pineapple", "o" => "orange");
+$builtin_fun_arg = $array_arg;
+$languageConstruct_fun_arg = $array_arg;
+
+// Testing library functions as comparison function
+echo "-- Testing uasort() with built-in 'cmp_function': strcasecmp() --\n";
+var_dump( uasort($builtin_fun_arg, 'strcasecmp') ); // expecting: bool(true)
+var_dump($builtin_fun_arg);
+
+echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n";
+var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true)
+var_dump($array_arg);
+
+// Testing with language construct as comparison function
+echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
+var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false)
+
+echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
+var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false)
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : built in function as 'cmp_function' ***
+-- Testing uasort() with built-in 'cmp_function': strcasecmp() --
+bool(true)
+array(5) {
+ ["a"]=>
+ string(5) "apple"
+ ["b"]=>
+ string(6) "Banana"
+ ["m"]=>
+ string(5) "Mango"
+ ["o"]=>
+ string(6) "orange"
+ ["p"]=>
+ string(9) "Pineapple"
+}
+-- Testing uasort() with built-in 'cmp_function': strcmp() --
+bool(true)
+array(5) {
+ ["b"]=>
+ string(6) "Banana"
+ ["m"]=>
+ string(5) "Mango"
+ ["p"]=>
+ string(9) "Pineapple"
+ ["a"]=>
+ string(5) "apple"
+ ["o"]=>
+ string(6) "orange"
+}
+-- Testing uasort() with language construct as 'cmp_function' --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+-- Testing uasort() with language construct as 'cmp_function' --
+
+Warning: uasort(): Invalid comparison function in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/uasort_variation9.phpt b/ext/standard/tests/array/uasort_variation9.phpt
new file mode 100644
index 000000000..486042e5e
--- /dev/null
+++ b/ext/standard/tests/array/uasort_variation9.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test uasort() function : usage variations - 'cmp_function' with reference argument
+--FILE--
+<?php
+/* Prototype : bool uasort(array $array_arg, string $cmp_function)
+ * Description: Sort an array with a user-defined comparison function and maintain index association
+ * Source code: ext/standard/array.c
+*/
+
+/* Testing uasort() functionality with comparison function having arguments as reference
+ */
+
+echo "*** Testing uasort() : 'cmp_function' with reference arguments ***\n";
+
+// comparison function
+/* Prototype : int cmp(mixed &$value1, mixed &$value2)
+ * Parameters : $value1 and $value2 - values recieved by reference
+ * Return value : 0 - if both values are same
+ * 1 - if value1 is greater than value2
+ * -1 - if value1 is less than value2
+ * Description : compares value1 and value2
+ */
+function cmp(&$value1, &$value2)
+{
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
+}
+
+// Int array with default keys
+$int_values = array(1, 8, 9, 3, 2, 6, 7);
+echo "-- Passing integer values to 'cmp_function' --\n";
+var_dump( uasort($int_values, 'cmp') );
+var_dump($int_values);
+
+// String array with default keys
+$string_values = array("Mango", "Apple", "Orange", "Banana");
+echo "-- Passing string values to 'cmp_function' --\n";
+var_dump( uasort($string_values, 'cmp') );
+var_dump($string_values);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing uasort() : 'cmp_function' with reference arguments ***
+-- Passing integer values to 'cmp_function' --
+bool(true)
+array(7) {
+ [0]=>
+ int(1)
+ [4]=>
+ int(2)
+ [3]=>
+ int(3)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+}
+-- Passing string values to 'cmp_function' --
+bool(true)
+array(4) {
+ [1]=>
+ string(5) "Apple"
+ [3]=>
+ string(6) "Banana"
+ [0]=>
+ string(5) "Mango"
+ [2]=>
+ string(6) "Orange"
+}
+Done
diff --git a/ext/standard/tests/array/var_export2.phpt b/ext/standard/tests/array/var_export2.phpt
index 2b8a1f97e..6db44d5ca 100644
--- a/ext/standard/tests/array/var_export2.phpt
+++ b/ext/standard/tests/array/var_export2.phpt
Binary files differ
diff --git a/ext/standard/tests/class_object/class_exists_basic_001.phpt b/ext/standard/tests/class_object/class_exists_basic_001.phpt
new file mode 100644
index 000000000..4cb6cbd32
--- /dev/null
+++ b/ext/standard/tests/class_object/class_exists_basic_001.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test class_exists() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing class_exists() : basic functionality ***\n";
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
+var_dump( class_exists('C', true) );
+echo "\nCalling class_exists() on existing class with autoload explicitly enabled:\n";
+var_dump( class_exists('stdclass', true) );
+
+echo "\nCalling class_exists() on non-existent class with autoload explicitly enabled:\n";
+var_dump( class_exists('D', false) );
+echo "\nCalling class_exists() on existing class with autoload explicitly disabled:\n";
+var_dump( class_exists('stdclass', false) );
+
+echo "\nCalling class_exists() on non-existent class with autoload unspecified:\n";
+var_dump( class_exists('E') );
+echo "\nCalling class_exists() on existing class with autoload unspecified:\n";
+var_dump( class_exists('stdclass') );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : basic functionality ***
+Calling class_exists() on non-existent class with autoload explicitly enabled:
+In __autoload(C)
+bool(false)
+
+Calling class_exists() on existing class with autoload explicitly enabled:
+bool(true)
+
+Calling class_exists() on non-existent class with autoload explicitly enabled:
+bool(false)
+
+Calling class_exists() on existing class with autoload explicitly disabled:
+bool(true)
+
+Calling class_exists() on non-existent class with autoload unspecified:
+In __autoload(E)
+bool(false)
+
+Calling class_exists() on existing class with autoload unspecified:
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/class_exists_error_001.phpt b/ext/standard/tests/class_object/class_exists_error_001.phpt
new file mode 100644
index 000000000..99c0b89b3
--- /dev/null
+++ b/ext/standard/tests/class_object/class_exists_error_001.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test class_exists() function : error conditions (wrong number of arguments)
+--FILE--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/**
+ * Test wrong number of arguments
+ */
+
+echo "*** Testing class_exists() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing class_exists() function with Zero arguments --\n";
+var_dump( class_exists() );
+
+//Test class_exists with one more than the expected number of arguments
+echo "\n-- Testing class_exists() function with more than expected no. of arguments --\n";
+$classname = 'string_val';
+$autoload = true;
+$extra_arg = 10;
+var_dump( class_exists($classname, $autoload, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : error conditions ***
+
+-- Testing class_exists() function with Zero arguments --
+
+Warning: class_exists() expects at least 1 parameter, 0 given in %s on line 16
+NULL
+
+-- Testing class_exists() function with more than expected no. of arguments --
+
+Warning: class_exists() expects at most 2 parameters, 3 given in %s on line 23
+NULL
+Done
diff --git a/ext/standard/tests/class_object/class_exists_variation_001.phpt b/ext/standard/tests/class_object/class_exists_variation_001.phpt
new file mode 100644
index 000000000..2141d65eb
--- /dev/null
+++ b/ext/standard/tests/class_object/class_exists_variation_001.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Test class_exists() function : usage variations - unexpected types for agument 1
+--FILE--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing class_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$autoload = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for classname
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( class_exists($value, $autoload) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+In __autoload(0)
+bool(false)
+
+Arg value 1
+In __autoload(1)
+bool(false)
+
+Arg value 12345
+In __autoload(12345)
+bool(false)
+
+Arg value -2345
+In __autoload(-2345)
+bool(false)
+
+Arg value 10.5
+In __autoload(10.5)
+bool(false)
+
+Arg value -10.5
+In __autoload(-10.5)
+bool(false)
+
+Arg value 101234567000
+In __autoload(101234567000)
+bool(false)
+
+Arg value 1.07654321E-9
+In __autoload(1.07654321E-9)
+bool(false)
+
+Arg value 0.5
+In __autoload(0.5)
+bool(false)
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 1 to be string, array given, %s(77)
+NULL
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+In __autoload(1)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+In __autoload(1)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(76)
+
+Arg value
+Error: 2 - class_exists() expects parameter 1 to be string, object given, %s(77)
+NULL
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/class_exists_variation_002.phpt b/ext/standard/tests/class_object/class_exists_variation_002.phpt
new file mode 100644
index 000000000..da10cac90
--- /dev/null
+++ b/ext/standard/tests/class_object/class_exists_variation_002.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test class_exists() function : usage variations - unexpected types for agument 2
+--FILE--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing class_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$classname = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for autoload
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( class_exists($classname, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing class_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(71)
+Error: 8 - Undefined variable: unset_var, %s(74)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+In __autoload(string_val)
+bool(false)
+
+Arg value 12345
+In __autoload(string_val)
+bool(false)
+
+Arg value -2345
+In __autoload(string_val)
+bool(false)
+
+Arg value 10.5
+In __autoload(string_val)
+bool(false)
+
+Arg value -10.5
+In __autoload(string_val)
+bool(false)
+
+Arg value 101234567000
+In __autoload(string_val)
+bool(false)
+
+Arg value 1.07654321E-9
+In __autoload(string_val)
+bool(false)
+
+Arg value 0.5
+In __autoload(string_val)
+bool(false)
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81)
+NULL
+
+Arg value Array
+Error: 2 - class_exists() expects parameter 2 to be boolean, array given, %s(81)
+NULL
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+In __autoload(string_val)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+In __autoload(string_val)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value string
+In __autoload(string_val)
+bool(false)
+
+Arg value string
+In __autoload(string_val)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(80)
+
+Arg value
+Error: 2 - class_exists() expects parameter 2 to be boolean, object given, %s(81)
+NULL
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/class_exists_variation_003.phpt b/ext/standard/tests/class_object/class_exists_variation_003.phpt
new file mode 100644
index 000000000..074560145
--- /dev/null
+++ b/ext/standard/tests/class_object/class_exists_variation_003.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test class_exists() function : usage variations - case sensitivity
+--FILE--
+<?php
+/* Prototype : proto bool class_exists(string classname [, bool autoload])
+ * Description: Checks if the class exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+class caseSensitivityTest {}
+var_dump(class_exists('casesensitivitytest'));
+
+echo "Done"
+?>
+--EXPECTF--
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_error_001.phpt b/ext/standard/tests/class_object/get_class_error_001.phpt
new file mode 100644
index 000000000..b563c3188
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_error_001.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test get_class() function : error conditions - wrong number of arguments.
+--FILE--
+<?php
+/* Prototype : proto string get_class([object object])
+ * Description: Retrieves the class name
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class() : error conditions ***\n";
+
+//Test get_class with one more than the expected number of arguments
+echo "\n-- Testing get_class() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$extra_arg = 10;
+var_dump( get_class($object, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class() : error conditions ***
+
+-- Testing get_class() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for get_class() in %s on line 14
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt
new file mode 100644
index 000000000..b2b87af4e
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test get_class_methods() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic behaviour with existing class and non-existent class.
+ */
+
+echo "*** Testing get_class_methods() : basic functionality ***\n";
+
+class C {
+ function f() {}
+ function g() {}
+ function h() {}
+}
+
+echo "Argument is class name:\n";
+var_dump( get_class_methods("C") );
+echo "Argument is class instance:\n";
+$c = new C;
+var_dump( get_class_methods($c) );
+
+class D {}
+echo "Argument is name of class which has no methods:\n";
+var_dump( get_class_methods("D") );
+
+echo "Argument is non existent class:\n";
+var_dump( get_class_methods("NonExistent") );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : basic functionality ***
+Argument is class name:
+array(3) {
+ [0]=>
+ string(1) "f"
+ [1]=>
+ string(1) "g"
+ [2]=>
+ string(1) "h"
+}
+Argument is class instance:
+array(3) {
+ [0]=>
+ string(1) "f"
+ [1]=>
+ string(1) "g"
+ [2]=>
+ string(1) "h"
+}
+Argument is name of class which has no methods:
+array(0) {
+}
+Argument is non existent class:
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_002.phpt b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt
new file mode 100644
index 000000000..441bb45d6
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test get_class_methods() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test behaviour with various visibility levels.
+ */
+
+class C {
+ private function privC() {}
+ protected function protC() {}
+ public function pubC() {}
+
+ public static function testFromC() {
+ echo "Accessing C from C:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from C:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from C:\n";
+ var_dump(get_class_methods("X"));
+ }
+}
+
+class D extends C {
+ private function privD() {}
+ protected function protD() {}
+ public function pubD() {}
+
+ public static function testFromD() {
+ echo "Accessing C from D:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from D:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from D:\n";
+ var_dump(get_class_methods("X"));
+ }
+}
+
+class X {
+ private function privX() {}
+ protected function protX() {}
+ public function pubX() {}
+
+ public static function testFromX() {
+ echo "Accessing C from X:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from X:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from X:\n";
+ var_dump(get_class_methods("X"));
+ }
+}
+
+echo "Accessing D from global scope:\n";
+var_dump(get_class_methods("D"));
+
+C::testFromC();
+D::testFromD();
+X::testFromX();
+
+echo "Done";
+?>
+--EXPECTF--
+Accessing D from global scope:
+array(4) {
+ [0]=>
+ string(4) "pubD"
+ [1]=>
+ string(9) "testFromD"
+ [2]=>
+ string(4) "pubC"
+ [3]=>
+ string(9) "testFromC"
+}
+Accessing C from C:
+array(4) {
+ [0]=>
+ string(5) "privC"
+ [1]=>
+ string(5) "protC"
+ [2]=>
+ string(4) "pubC"
+ [3]=>
+ string(9) "testFromC"
+}
+Accessing D from C:
+array(7) {
+ [0]=>
+ string(5) "protD"
+ [1]=>
+ string(4) "pubD"
+ [2]=>
+ string(9) "testFromD"
+ [3]=>
+ string(5) "privC"
+ [4]=>
+ string(5) "protC"
+ [5]=>
+ string(4) "pubC"
+ [6]=>
+ string(9) "testFromC"
+}
+Accessing X from C:
+array(2) {
+ [0]=>
+ string(4) "pubX"
+ [1]=>
+ string(9) "testFromX"
+}
+Accessing C from D:
+array(3) {
+ [0]=>
+ string(5) "protC"
+ [1]=>
+ string(4) "pubC"
+ [2]=>
+ string(9) "testFromC"
+}
+Accessing D from D:
+array(7) {
+ [0]=>
+ string(5) "privD"
+ [1]=>
+ string(5) "protD"
+ [2]=>
+ string(4) "pubD"
+ [3]=>
+ string(9) "testFromD"
+ [4]=>
+ string(5) "protC"
+ [5]=>
+ string(4) "pubC"
+ [6]=>
+ string(9) "testFromC"
+}
+Accessing X from D:
+array(2) {
+ [0]=>
+ string(4) "pubX"
+ [1]=>
+ string(9) "testFromX"
+}
+Accessing C from X:
+array(2) {
+ [0]=>
+ string(4) "pubC"
+ [1]=>
+ string(9) "testFromC"
+}
+Accessing D from X:
+array(4) {
+ [0]=>
+ string(4) "pubD"
+ [1]=>
+ string(9) "testFromD"
+ [2]=>
+ string(4) "pubC"
+ [3]=>
+ string(9) "testFromC"
+}
+Accessing X from X:
+array(4) {
+ [0]=>
+ string(5) "privX"
+ [1]=>
+ string(5) "protX"
+ [2]=>
+ string(4) "pubX"
+ [3]=>
+ string(9) "testFromX"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_003.phpt b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt
new file mode 100644
index 000000000..b64f702b8
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test get_class_methods() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test behaviour with interfaces.
+ */
+
+interface I {
+ public function pubI();
+
+}
+
+class C implements I {
+ public function pubI() {}
+
+ private function privC() {}
+ protected function protC() {}
+ public function pubC() {}
+
+ public static function testFromC() {
+ echo "Accessing I from C:\n";
+ var_dump(get_class_methods("I"));
+ echo "Accessing C from C:\n";
+ var_dump(get_class_methods("C"));
+ }
+}
+
+
+echo "Accessing I from global scope:\n";
+var_dump(get_class_methods("I"));
+echo "Accessing C from global scope:\n";
+var_dump(get_class_methods("C"));
+C::testFromC();
+echo "Done";
+?>
+--EXPECTF--
+Accessing I from global scope:
+array(1) {
+ [0]=>
+ string(4) "pubI"
+}
+Accessing C from global scope:
+array(3) {
+ [0]=>
+ string(4) "pubI"
+ [1]=>
+ string(4) "pubC"
+ [2]=>
+ string(9) "testFromC"
+}
+Accessing I from C:
+array(1) {
+ [0]=>
+ string(4) "pubI"
+}
+Accessing C from C:
+array(5) {
+ [0]=>
+ string(4) "pubI"
+ [1]=>
+ string(5) "privC"
+ [2]=>
+ string(5) "protC"
+ [3]=>
+ string(4) "pubC"
+ [4]=>
+ string(9) "testFromC"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_error_001.phpt b/ext/standard/tests/class_object/get_class_methods_error_001.phpt
new file mode 100644
index 000000000..6edb10803
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_methods_error_001.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test get_class_methods() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * Test wrong number of arguments.
+ */
+
+echo "*** Testing get_class_methods() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_class_methods() function with Zero arguments --\n";
+var_dump( get_class_methods() );
+
+//Test get_class_methods with one more than the expected number of arguments
+echo "\n-- Testing get_class_methods() function with more than expected no. of arguments --\n";
+$class = 1;
+$extra_arg = 10;
+var_dump( get_class_methods($class, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : error conditions ***
+
+-- Testing get_class_methods() function with Zero arguments --
+
+Warning: Wrong parameter count for get_class_methods() in %s on line 16
+NULL
+
+-- Testing get_class_methods() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for get_class_methods() in %s on line 22
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
new file mode 100644
index 000000000..b881452b4
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test get_class_methods() function : usage variations - unexpected types
+--FILE--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing get_class_methods() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for class
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( get_class_methods($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+NULL
+
+Arg value 1
+NULL
+
+Arg value 12345
+NULL
+
+Arg value -2345
+NULL
+
+Arg value 10.5
+NULL
+
+Arg value -10.5
+NULL
+
+Arg value 101234567000
+NULL
+
+Arg value 1.07654321E-9
+NULL
+
+Arg value 0.5
+NULL
+
+Arg value Array
+NULL
+
+Arg value Array
+NULL
+
+Arg value Array
+NULL
+
+Arg value Array
+NULL
+
+Arg value Array
+NULL
+
+Arg value
+NULL
+
+Arg value
+NULL
+
+Arg value 1
+NULL
+
+Arg value
+NULL
+
+Arg value 1
+NULL
+
+Arg value
+NULL
+
+Arg value
+NULL
+
+Arg value
+NULL
+
+Arg value string
+NULL
+
+Arg value string
+NULL
+Error: 4096 - Object of class stdClass could not be converted to string, %s(76)
+
+Arg value
+array(0) {
+}
+
+Arg value
+NULL
+
+Arg value
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_methods_variation_002.phpt b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt
new file mode 100644
index 000000000..60b944c69
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test get_class_methods() function : usage variations - case sensitivity
+--FILE--
+<?php
+/* Prototype : proto array get_class_methods(mixed class)
+ * Description: Returns an array of method names for class or class instance.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class_methods() : usage variations ***\n";
+
+class caseSensitivityTest {
+ function MyMeThOd() {}
+}
+
+var_dump( get_class_methods('CasesensitivitytesT') );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class_methods() : usage variations ***
+array(1) {
+ [0]=>
+ string(8) "MyMeThOd"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_variation_001.phpt b/ext/standard/tests/class_object/get_class_variation_001.phpt
new file mode 100644
index 000000000..6cbe0b368
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_variation_001.phpt
@@ -0,0 +1,160 @@
+--TEST--
+Test get_class() function : usage variations - passing unexpected types.
+--FILE--
+<?php
+/* Prototype : proto string get_class([object object])
+ * Description: Retrieves the class name
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_class() : usage variations ***\n";
+
+// Note: basic use cases in Zend/tests/009.phpt
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value: $value (type: " . gettype($value) . ")\n";
+ var_dump( get_class($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_class() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line 58
+
+Notice: Undefined variable: unset_var in %s on line 61
+
+Arg value: 0 (type: integer)
+bool(false)
+
+Arg value: 1 (type: integer)
+bool(false)
+
+Arg value: 12345 (type: integer)
+bool(false)
+
+Arg value: -2345 (type: integer)
+bool(false)
+
+Arg value: 10.5 (type: double)
+bool(false)
+
+Arg value: -10.5 (type: double)
+bool(false)
+
+Arg value: 101234567000 (type: double)
+bool(false)
+
+Arg value: 1.07654321E-9 (type: double)
+bool(false)
+
+Arg value: 0.5 (type: double)
+bool(false)
+
+Arg value: Array (type: array)
+bool(false)
+
+Arg value: Array (type: array)
+bool(false)
+
+Arg value: Array (type: array)
+bool(false)
+
+Arg value: Array (type: array)
+bool(false)
+
+Arg value: Array (type: array)
+bool(false)
+
+Arg value: (type: NULL)
+bool(false)
+
+Arg value: (type: NULL)
+bool(false)
+
+Arg value: 1 (type: boolean)
+bool(false)
+
+Arg value: (type: boolean)
+bool(false)
+
+Arg value: 1 (type: boolean)
+bool(false)
+
+Arg value: (type: boolean)
+bool(false)
+
+Arg value: (type: string)
+bool(false)
+
+Arg value: (type: string)
+bool(false)
+
+Arg value: string (type: string)
+bool(false)
+
+Arg value: string (type: string)
+bool(false)
+
+Arg value: (type: NULL)
+bool(false)
+
+Arg value: (type: NULL)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_class_variation_002.phpt b/ext/standard/tests/class_object/get_class_variation_002.phpt
new file mode 100644
index 000000000..1ee352981
--- /dev/null
+++ b/ext/standard/tests/class_object/get_class_variation_002.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test get_class() function : usage variations - ensure class name case is preserved.
+--FILE--
+<?php
+/* Prototype : proto string get_class([object object])
+ * Description: Retrieves the class name
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+class caseSensitivityTest {}
+var_dump(get_class(new casesensitivitytest));
+
+echo "Done";
+?>
+--EXPECTF--
+string(19) "caseSensitivityTest"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt
new file mode 100644
index 000000000..123e9772c
--- /dev/null
+++ b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test get_declared_classes() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto array get_declared_classes()
+ * Description: Returns an array of all declared classes.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_classes() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_declared_classes() function with Zero arguments --\n";
+var_dump(get_declared_classes());
+
+foreach (get_declared_classes() as $class) {
+ if (!class_exists($class)) {
+ echo "Error: $class is not a valid class.\n";
+ }
+}
+
+echo "\n-- Ensure userspace classes are listed --\n";
+Class C {}
+var_dump(in_array('C', get_declared_classes()));
+
+echo "\n-- Ensure userspace interfaces are not listed --\n";
+Interface I {}
+var_dump(in_array( 'I', get_declared_classes()));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_classes() : basic functionality ***
+
+-- Testing get_declared_classes() function with Zero arguments --
+array(%d) {
+%a
+}
+
+-- Ensure userspace classes are listed --
+bool(true)
+
+-- Ensure userspace interfaces are not listed --
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_declared_classes_error_001.phpt b/ext/standard/tests/class_object/get_declared_classes_error_001.phpt
new file mode 100644
index 000000000..a50844367
--- /dev/null
+++ b/ext/standard/tests/class_object/get_declared_classes_error_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test get_declared_classes() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array get_declared_classes()
+ * Description: Returns an array of all declared classes.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_declared_classes() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing get_declared_classes() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( get_declared_classes($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_classes() : error conditions ***
+
+-- Testing get_declared_classes() function with one argument --
+
+Warning: Wrong parameter count for get_declared_classes() in %s on line 13
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt
new file mode 100644
index 000000000..a0ec71518
--- /dev/null
+++ b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test get_declared_interfaces() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto array get_declared_interfaces()
+ * Description: Returns an array of all declared interfaces.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing get_declared_interfaces() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_declared_interfaces() function with Zero arguments --\n";
+var_dump(get_declared_interfaces());
+
+foreach (get_declared_interfaces() as $interface) {
+ if (!interface_exists($interface)) {
+ echo "Error: $interface is not a valid interface.\n";
+ }
+}
+
+echo "\n-- Ensure userspace classes are not listed --\n";
+Class C {}
+var_dump(in_array('C', get_declared_interfaces()));
+
+echo "\n-- Ensure userspace interfaces are listed --\n";
+Interface I {}
+var_dump(in_array('I', get_declared_interfaces()));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_interfaces() : basic functionality ***
+
+-- Testing get_declared_interfaces() function with Zero arguments --
+array(%d) {
+%a
+}
+
+-- Ensure userspace classes are not listed --
+bool(false)
+
+-- Ensure userspace interfaces are listed --
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt
new file mode 100644
index 000000000..93aabb6f6
--- /dev/null
+++ b/ext/standard/tests/class_object/get_declared_interfaces_error_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test get_declared_interfaces() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array get_declared_interfaces()
+ * Description: Returns an array of all declared interfaces.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_declared_interfaces() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing get_declared_interfaces() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( get_declared_interfaces($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_declared_interfaces() : error conditions ***
+
+-- Testing get_declared_interfaces() function with one argument --
+
+Warning: Wrong parameter count for get_declared_interfaces() in %s on line 13
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_basic_001.phpt b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt
new file mode 100644
index 000000000..38ed74fb0
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt
@@ -0,0 +1,107 @@
+--TEST--
+get_object_vars(): visibility from static methods (target object passed as arg)
+--FILE--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class A {
+ private $hiddenPriv = 'A::hiddenPriv';
+
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class B extends A {
+ private $hiddenPriv = 'B::hiddenPriv';
+ private $priv = 'B::priv';
+ protected $prot = 'B::prot';
+ public $pub = 'B::pub';
+
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class C extends B {
+ private $hiddenPriv = 'C::hiddenPriv';
+
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class X {
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+
+$b = new B;
+echo "\n---( Global scope: )---\n";
+var_dump(get_object_vars($b));
+echo "\n---( Declaring class: )---\n";
+B::test($b);
+echo "\n---( Subclass: )---\n";
+C::test($b);
+echo "\n---( Superclass: )---\n";
+A::test($b);
+echo "\n---( Unrelated class: )---\n";
+X::test($b);
+?>
+--EXPECTF--
+
+---( Global scope: )---
+array(1) {
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Declaring class: )---
+B::test
+array(4) {
+ ["hiddenPriv"]=>
+ string(13) "B::hiddenPriv"
+ ["priv"]=>
+ string(7) "B::priv"
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Subclass: )---
+C::test
+array(2) {
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Superclass: )---
+A::test
+array(3) {
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+ ["hiddenPriv"]=>
+ string(13) "A::hiddenPriv"
+}
+
+---( Unrelated class: )---
+X::test
+array(1) {
+ ["pub"]=>
+ string(6) "B::pub"
+} \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_basic_002.phpt b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt
new file mode 100644
index 000000000..910926bc1
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt
@@ -0,0 +1,64 @@
+--TEST--
+get_object_vars(): visibility from non static methods (target object passed as arg)
+--FILE--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class A {
+ private $hiddenPriv = 'A::hiddenPriv';
+
+ public function testA($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+Class B extends A {
+ private $hiddenPriv = 'B::hiddenPriv';
+ private $priv = 'B::priv';
+ protected $prot = 'B::prot';
+ public $pub = 'B::pub';
+
+ public function testB($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
+}
+
+
+$b = new B;
+echo "\n---( Declaring class: )---\n";
+$b->testB($b);
+echo "\n---( Superclass: )---\n";
+$b->testA($b);
+
+?>
+--EXPECTF--
+
+---( Declaring class: )---
+B::testB
+array(4) {
+ ["hiddenPriv"]=>
+ string(13) "B::hiddenPriv"
+ ["priv"]=>
+ string(7) "B::priv"
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+}
+
+---( Superclass: )---
+A::testA
+array(3) {
+ ["prot"]=>
+ string(7) "B::prot"
+ ["pub"]=>
+ string(6) "B::pub"
+ ["hiddenPriv"]=>
+ string(13) "A::hiddenPriv"
+} \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_error_001.phpt b/ext/standard/tests/class_object/get_object_vars_error_001.phpt
new file mode 100644
index 000000000..67a2705d0
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_error_001.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test get_object_vars() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_object_vars() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing get_object_vars() function with Zero arguments --\n";
+var_dump( get_object_vars() );
+
+//Test get_object_vars with one more than the expected number of arguments
+echo "\n-- Testing get_object_vars() function with more than expected no. of arguments --\n";
+$obj = new stdclass();
+$extra_arg = 10;
+var_dump( get_object_vars($obj, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_object_vars() : error conditions ***
+
+-- Testing get_object_vars() function with Zero arguments --
+
+Warning: Wrong parameter count for get_object_vars() in %s on line 12
+NULL
+
+-- Testing get_object_vars() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for get_object_vars() in %s on line 18
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_001.phpt b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt
new file mode 100644
index 000000000..89fbc53e9
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt
@@ -0,0 +1,20 @@
+--TEST--
+get_object_vars() - ensure statics are not shown
+--FILE--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class A {
+ public static $var = 'hello';
+}
+
+$a = new A;
+var_dump(get_object_vars($a));
+?>
+--EXPECTF--
+array(0) {
+} \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_002.phpt b/ext/standard/tests/class_object/get_object_vars_variation_002.phpt
new file mode 100644
index 000000000..73478de79
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_variation_002.phpt
@@ -0,0 +1,47 @@
+--TEST--
+get_object_vars() - ensure references are preserved
+--FILE--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+$obj = new stdClass;
+var_dump(get_object_vars($obj));
+
+$a='original.a';
+$obj->ref = &$a;
+$obj->val = $a;
+
+$arr = get_object_vars($obj);
+var_dump($arr);
+
+$arr['ref'] = 'changed.ref';
+$arr['val'] = 'changed.val';
+
+var_dump($arr, $obj, $a);
+?>
+--EXPECTF--
+array(0) {
+}
+array(2) {
+ ["ref"]=>
+ &string(10) "original.a"
+ ["val"]=>
+ string(10) "original.a"
+}
+array(2) {
+ ["ref"]=>
+ &string(11) "changed.ref"
+ ["val"]=>
+ string(11) "changed.val"
+}
+object(stdClass)#1 (2) {
+ ["ref"]=>
+ &string(11) "changed.ref"
+ ["val"]=>
+ string(10) "original.a"
+}
+string(11) "changed.ref" \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_003.phpt b/ext/standard/tests/class_object/get_object_vars_variation_003.phpt
new file mode 100644
index 000000000..70794e7d5
--- /dev/null
+++ b/ext/standard/tests/class_object/get_object_vars_variation_003.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test get_object_vars() function : usage variations - unexpected types for argument 1
+--FILE--
+<?php
+/* Prototype : proto array get_object_vars(object obj)
+ * Description: Returns an array of object properties
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_object_vars() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for obj
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( get_object_vars($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_object_vars() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line 56
+
+Notice: Undefined variable: unset_var in %s on line 59
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value string
+bool(false)
+
+Arg value string
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_parent_class_error_001.phpt b/ext/standard/tests/class_object/get_parent_class_error_001.phpt
new file mode 100644
index 000000000..cf9c3e867
--- /dev/null
+++ b/ext/standard/tests/class_object/get_parent_class_error_001.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test get_parent_class() function : error conditions - wrong number of args.
+--FILE--
+<?php
+/* Prototype : proto string get_parent_class([mixed object])
+ * Description: Retrieves the parent class name for object or class or current scope.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_parent_class() : error conditions ***\n";
+
+
+//Test get_parent_class with one more than the expected number of arguments
+echo "\n-- Testing get_parent_class() function with more than expected no. of arguments --\n";
+$object = 1;
+$extra_arg = 10;
+var_dump( get_parent_class($object, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_parent_class() : error conditions ***
+
+-- Testing get_parent_class() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for get_parent_class() in %s on line 15
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_parent_class_variation_001.phpt b/ext/standard/tests/class_object/get_parent_class_variation_001.phpt
new file mode 100644
index 000000000..6f2e32805
--- /dev/null
+++ b/ext/standard/tests/class_object/get_parent_class_variation_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test get_parent_class() function : variation - case sensitivity
+--FILE--
+<?php
+/* Prototype : proto string get_parent_class([mixed object])
+ * Description: Retrieves the parent class name for object or class or current scope.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+// Note: basic use cases in Zend/tests/010.phpt
+
+echo "*** Testing get_parent_class() : variation ***\n";
+
+class caseSensitivityTest {}
+class caseSensitivityTestChild extends caseSensitivityTest {}
+
+var_dump(get_parent_class('CasesensitivitytestCHILD'));
+var_dump(get_parent_class(new CasesensitivitytestCHILD));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_parent_class() : variation ***
+string(19) "caseSensitivityTest"
+string(19) "caseSensitivityTest"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
new file mode 100644
index 000000000..f7e5b9df3
--- /dev/null
+++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
@@ -0,0 +1,174 @@
+--TEST--
+Test get_parent_class() function : usage variations - unexpected argument type.
+--FILE--
+<?php
+/* Prototype : proto string get_parent_class([mixed object])
+ * Description: Retrieves the parent class name for object or class or current scope.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing get_parent_class() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( get_parent_class($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing get_parent_class() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(68)
+Error: 8 - Undefined variable: unset_var, %s(71)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value string
+In __autoload(string)
+bool(false)
+
+Arg value String
+In __autoload(String)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(77)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/is_a_error_001.phpt b/ext/standard/tests/class_object/is_a_error_001.phpt
new file mode 100644
index 000000000..0d1aedca0
--- /dev/null
+++ b/ext/standard/tests/class_object/is_a_error_001.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test is_a() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_a() : error conditions ***\n";
+
+
+//Test is_a with one more than the expected number of arguments
+echo "\n-- Testing is_a() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$class_name = 'string_val';
+$extra_arg = 10;
+var_dump( is_a($object, $class_name, $extra_arg) );
+
+// Testing is_a with one less than the expected number of arguments
+echo "\n-- Testing is_a() function with less than expected no. of arguments --\n";
+$object = new stdclass();
+var_dump( is_a($object) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_a() : error conditions ***
+
+-- Testing is_a() function with more than expected no. of arguments --
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 16
+
+Warning: Wrong parameter count for is_a() in %s on line 16
+NULL
+
+-- Testing is_a() function with less than expected no. of arguments --
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 21
+
+Warning: Wrong parameter count for is_a() in %s on line 21
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/is_a_variation_001.phpt b/ext/standard/tests/class_object/is_a_variation_001.phpt
new file mode 100644
index 000000000..d521502dc
--- /dev/null
+++ b/ext/standard/tests/class_object/is_a_variation_001.phpt
@@ -0,0 +1,213 @@
+--TEST--
+Test is_a() function : usage variations - wrong type for arg 1
+--FILE--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+// Note: basic use cases in Zend/tests/is_a.phpt
+echo "*** Testing is_a() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$class_name = 'stdClass';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( is_a($value, $class_name) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_a() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line 59
+
+Notice: Undefined variable: unset_var in %s on line 62
+
+Arg value 0
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 1
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 12345
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value -2345
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 10.5
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value -10.5
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 101234567000
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 1.07654321E-9
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 0.5
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 1
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value 1
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value string
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value String
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 69
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/is_a_variation_002.phpt b/ext/standard/tests/class_object/is_a_variation_002.phpt
new file mode 100644
index 000000000..9835e7c68
--- /dev/null
+++ b/ext/standard/tests/class_object/is_a_variation_002.phpt
@@ -0,0 +1,223 @@
+--TEST--
+Test is_a() function : usage variations - wrong type for arg 2
+--FILE--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+class C {
+ function __toString() {
+ return "C Instance";
+ }
+}
+
+echo "*** Testing is_a() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$object = new stdclass();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new C,
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for class_name
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( is_a($object, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_a() : usage variations ***
+
+Notice: Undefined variable: undefined_var in %s on line 64
+
+Notice: Undefined variable: unset_var in %s on line 67
+
+Arg value 0
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 1
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 12345
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value -2345
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 10.5
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value -10.5
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 101234567000
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 1.07654321E-9
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 0.5
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+
+Notice: Array to string conversion in %s on line 74
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+
+Notice: Array to string conversion in %s on line 74
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+
+Notice: Array to string conversion in %s on line 74
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+
+Notice: Array to string conversion in %s on line 74
+bool(false)
+
+Arg value Array
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+
+Notice: Array to string conversion in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 1
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value 1
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value C Instance
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+
+Arg value
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 74
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/is_a_variation_003.phpt b/ext/standard/tests/class_object/is_a_variation_003.phpt
new file mode 100644
index 000000000..9cc50f34b
--- /dev/null
+++ b/ext/standard/tests/class_object/is_a_variation_003.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test is_a() function : usage variations - case sensitivity
+--FILE--
+<?php
+/* Prototype : proto bool is_a(object object, string class_name)
+ * Description: Returns true if the object is of this class or has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_a() : usage variations ***\n";
+
+class caseSensitivityTest {}
+class caseSensitivityTestChild extends caseSensitivityTest {}
+
+var_dump(is_a(new caseSensitivityTestChild, 'caseSensitivityTEST'));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_a() : usage variations ***
+
+Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %s on line 13
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/is_subclass_of_error_001.phpt b/ext/standard/tests/class_object/is_subclass_of_error_001.phpt
new file mode 100644
index 000000000..4403bde4c
--- /dev/null
+++ b/ext/standard/tests/class_object/is_subclass_of_error_001.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test is_subclass_of() function : wrong number of args
+--FILE--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_subclass_of() : error conditions ***\n";
+
+
+//Test is_subclass_of with one more than the expected number of arguments
+echo "\n-- Testing is_subclass_of() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$class_name = 'string_val';
+$extra_arg = 10;
+var_dump( is_subclass_of($object, $class_name, $extra_arg) );
+
+// Testing is_subclass_of with one less than the expected number of arguments
+echo "\n-- Testing is_subclass_of() function with less than expected no. of arguments --\n";
+$object = new stdclass();
+var_dump( is_subclass_of($object) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : error conditions ***
+
+-- Testing is_subclass_of() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for is_subclass_of() in %s on line 16
+NULL
+
+-- Testing is_subclass_of() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for is_subclass_of() in %s on line 21
+NULL
+Done
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
new file mode 100644
index 000000000..f11183d48
--- /dev/null
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test is_subclass_of() function : usage variations - unexpected type for arg 1
+--FILE--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+// Note: basic use cases in Zend/tests/is_a.phpt
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$class_name = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( is_subclass_of($value, $class_name) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(69)
+Error: 8 - Undefined variable: unset_var, %s(72)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+Error: 2 - Unknown class passed as parameter, %s(79)
+bool(false)
+
+Arg value
+Error: 2 - Unknown class passed as parameter, %s(79)
+bool(false)
+
+Arg value string
+In __autoload(string)
+Error: 2 - Unknown class passed as parameter, %s(79)
+bool(false)
+
+Arg value String
+In __autoload(String)
+Error: 2 - Unknown class passed as parameter, %s(79)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
new file mode 100644
index 000000000..a45583ce6
--- /dev/null
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test is_subclass_of() function : usage variations - unexpected type for arg 2
+--FILE--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$object = new stdclass();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for class_name
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( is_subclass_of($object, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(76)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(77)
+Error: 8 - Object of class stdClass to string conversion, %s(77)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_003.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_003.phpt
new file mode 100644
index 000000000..d4aef1234
--- /dev/null
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_003.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test is_subclass_of() function : usage variations - case sensitivity
+--FILE--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing is_subclass_of() : usage variations ***\n";
+
+echo "*** Testing is_a() : usage variations ***\n";
+
+class caseSensitivityTest {}
+class caseSensitivityTestChild extends caseSensitivityTest {}
+
+var_dump(is_subclass_of('caseSensitivityTestCHILD', 'caseSensitivityTEST'));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing is_subclass_of() : usage variations ***
+*** Testing is_a() : usage variations ***
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_basic_001.phpt b/ext/standard/tests/class_object/method_exists_basic_001.phpt
new file mode 100644
index 000000000..2f11e4c46
--- /dev/null
+++ b/ext/standard/tests/class_object/method_exists_basic_001.phpt
@@ -0,0 +1,83 @@
+--TEST--
+method_exists() on userspace classes; static & non-static methods with various visibilities.
+--FILE--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+Class B {
+ public function inherit_pub() {}
+ protected function inherit_prot() {}
+ private function inherit_priv() {}
+ static public function inherit_static_pub() {}
+ static protected function inherit_static_prot() {}
+ static private function inherit_static_priv() {}
+}
+
+Class C extends B {
+ public function pub() {}
+ protected function prot() {}
+ private function priv() {}
+ static public function static_pub() {}
+ static protected function static_prot() {}
+ static private function static_priv() {}
+}
+
+
+$methods = array(
+ 'inherit_pub', 'inherit_prot', 'inherit_priv',
+ 'inherit_static_pub', 'inherit_static_prot', 'inherit_static_priv',
+ 'pub', 'prot', 'priv',
+ 'static_pub', 'static_prot', 'static_priv',
+ 'non_existent');
+
+echo "\n ---(Using string class name)---\n";
+foreach ($methods as $method) {
+ echo "Does C::$method exist? ";
+ var_dump(method_exists("C", $method));
+}
+
+echo "\n ---(Using object)---\n";
+$myC = new C;
+foreach ($methods as $method) {
+ echo "Does C::$method exist? ";
+ var_dump(method_exists($myC, $method));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+
+ ---(Using string class name)---
+Does C::inherit_pub exist? bool(true)
+Does C::inherit_prot exist? bool(true)
+Does C::inherit_priv exist? bool(true)
+Does C::inherit_static_pub exist? bool(true)
+Does C::inherit_static_prot exist? bool(true)
+Does C::inherit_static_priv exist? bool(true)
+Does C::pub exist? bool(true)
+Does C::prot exist? bool(true)
+Does C::priv exist? bool(true)
+Does C::static_pub exist? bool(true)
+Does C::static_prot exist? bool(true)
+Does C::static_priv exist? bool(true)
+Does C::non_existent exist? bool(false)
+
+ ---(Using object)---
+Does C::inherit_pub exist? bool(true)
+Does C::inherit_prot exist? bool(true)
+Does C::inherit_priv exist? bool(true)
+Does C::inherit_static_pub exist? bool(true)
+Does C::inherit_static_prot exist? bool(true)
+Does C::inherit_static_priv exist? bool(true)
+Does C::pub exist? bool(true)
+Does C::prot exist? bool(true)
+Does C::priv exist? bool(true)
+Does C::static_pub exist? bool(true)
+Does C::static_prot exist? bool(true)
+Does C::static_priv exist? bool(true)
+Does C::non_existent exist? bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_basic_002.phpt b/ext/standard/tests/class_object/method_exists_basic_002.phpt
new file mode 100644
index 000000000..f6b62aa26
--- /dev/null
+++ b/ext/standard/tests/class_object/method_exists_basic_002.phpt
@@ -0,0 +1,33 @@
+--TEST--
+method_exists() on internal classes
+--FILE--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo " ---(Internal classes, using string class name)---\n";
+echo "Does exception::getmessage exist? ";
+var_dump(method_exists("exception", "getmessage"));
+echo "Does stdclass::nonexistent exist? ";
+var_dump(method_exists("stdclass", "nonexistent"));
+
+echo "\n ---(Internal classes, using class instance)---\n";
+echo "Does exception::getmessage exist? ";
+var_dump(method_exists(new exception, "getmessage"));
+echo "Does stdclass::nonexistent exist? ";
+var_dump(method_exists(new stdclass, "nonexistent"));
+
+echo "Done";
+?>
+--EXPECTF--
+ ---(Internal classes, using string class name)---
+Does exception::getmessage exist? bool(true)
+Does stdclass::nonexistent exist? bool(false)
+
+ ---(Internal classes, using class instance)---
+Does exception::getmessage exist? bool(true)
+Does stdclass::nonexistent exist? bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_basic_003.phpt b/ext/standard/tests/class_object/method_exists_basic_003.phpt
new file mode 100644
index 000000000..32f62b7e4
--- /dev/null
+++ b/ext/standard/tests/class_object/method_exists_basic_003.phpt
@@ -0,0 +1,22 @@
+--TEST--
+method_exists() on non-existent class, with __autoload().
+--FILE--
+<?php
+/* Prototype : proto bool is_subclass_of(object object, string class_name)
+ * Description: Returns true if the object has this class as one of its parents
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($name) {
+ echo "In __autoload($name)\n";
+}
+
+var_dump(method_exists('UndefC', 'func'));
+
+echo "Done";
+?>
+--EXPECTF--
+In __autoload(UndefC)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_error_001.phpt b/ext/standard/tests/class_object/method_exists_error_001.phpt
new file mode 100644
index 000000000..203128c67
--- /dev/null
+++ b/ext/standard/tests/class_object/method_exists_error_001.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test method_exists() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing method_exists() : error conditions ***\n";
+
+
+//Test method_exists with one more than the expected number of arguments
+echo "\n-- Testing method_exists() function with more than expected no. of arguments --\n";
+$object = new stdclass();
+$method = 'string_val';
+$extra_arg = 10;
+var_dump( method_exists($object, $method, $extra_arg) );
+
+// Testing method_exists with one less than the expected number of arguments
+echo "\n-- Testing method_exists() function with less than expected no. of arguments --\n";
+$object = new stdclass();
+var_dump( method_exists($object) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : error conditions ***
+
+-- Testing method_exists() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for method_exists() in %s on line 16
+NULL
+
+-- Testing method_exists() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for method_exists() in %s on line 21
+NULL
+Done
diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt
new file mode 100644
index 000000000..117c211d0
--- /dev/null
+++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test method_exists() function : usage variations - unexpected type for arg 1
+--FILE--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing method_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$method = 'string_val';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'String',
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for object
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( method_exists($value, $method) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(68)
+Error: 8 - Undefined variable: unset_var, %s(71)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value Array
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value string
+In __autoload(string)
+bool(false)
+
+Arg value String
+In __autoload(String)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_variation_002.phpt b/ext/standard/tests/class_object/method_exists_variation_002.phpt
new file mode 100644
index 000000000..54d0ef94f
--- /dev/null
+++ b/ext/standard/tests/class_object/method_exists_variation_002.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test method_exists() function : usage variations - unexpected type for arg 2
+--FILE--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+function __autoload($className) {
+ echo "In __autoload($className)\n";
+}
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing method_exists() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$object = new stdclass();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for method
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( method_exists($object, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(77)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(76)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(77)
+Error: 8 - Object of class stdClass to string conversion, %s(77)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/class_object/method_exists_variation_003.phpt b/ext/standard/tests/class_object/method_exists_variation_003.phpt
new file mode 100644
index 000000000..debe5a35e
--- /dev/null
+++ b/ext/standard/tests/class_object/method_exists_variation_003.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test method_exists() function : variation - Case sensitivity
+--FILE--
+<?php
+/* Prototype : proto bool method_exists(object object, string method)
+ * Description: Checks if the class method exists
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing method_exists() : variation ***\n";
+
+Class caseSensitivityTest {
+ public function myMethod() {}
+}
+
+var_dump(method_exists(new casesensitivitytest, 'myMetHOD'));
+var_dump(method_exists('casesensiTivitytest', 'myMetHOD'));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing method_exists() : variation ***
+bool(true)
+bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/chdir_basic.phpt b/ext/standard/tests/dir/chdir_basic.phpt
new file mode 100644
index 000000000..5fc0e5b88
--- /dev/null
+++ b/ext/standard/tests/dir/chdir_basic.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test chdir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of chdir() with absolute and relative paths
+ */
+
+echo "*** Testing chdir() : basic functionality ***\n";
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create directories
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- Testing chdir() with absolute path: --\n";
+chdir($base_dir_path);
+var_dump(chdir($level_one_dir_path));
+var_dump(getcwd());
+
+echo "\n-- Testing chdir() with relative paths: --\n";
+var_dump(chdir($level_two_dir_name));
+var_dump(getcwd());
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing chdir() : basic functionality ***
+
+-- Testing chdir() with absolute path: --
+bool(true)
+string(%d) "%slevel_one"
+
+-- Testing chdir() with relative paths: --
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+===DONE===
diff --git a/ext/standard/tests/dir/chdir_error1.phpt b/ext/standard/tests/dir/chdir_error1.phpt
new file mode 100644
index 000000000..0f57ff5b2
--- /dev/null
+++ b/ext/standard/tests/dir/chdir_error1.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test chdir() function : error conditions - Incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to chdir() to test behaviour
+ */
+
+echo "*** Testing chdir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing chdir() function with Zero arguments --\n";
+var_dump( chdir() );
+
+//Test chdir with one more than the expected number of arguments
+echo "\n-- Testing chdir() function with more than expected no. of arguments --\n";
+$directory = __FILE__;
+$extra_arg = 10;
+var_dump( chdir($directory, $extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing chdir() : error conditions ***
+
+-- Testing chdir() function with Zero arguments --
+
+Warning: chdir() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing chdir() function with more than expected no. of arguments --
+
+Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/chdir_error2.phpt b/ext/standard/tests/dir/chdir_error2.phpt
new file mode 100644
index 000000000..a3bbb63e6
--- /dev/null
+++ b/ext/standard/tests/dir/chdir_error2.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test chdir() function : error conditions - Non-existent directory
+--FILE--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory that does not exist as $directory to chdir() to test behaviour
+ */
+
+echo "*** Testing chdir() : error conditions ***\n";
+
+$directory = __FILE__ . '/idonotexist';
+
+var_dump(chdir($directory));
+?>
+===DONE===
+--EXPECTF--
+*** Testing chdir() : error conditions ***
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/chdir_variation1.phpt b/ext/standard/tests/dir/chdir_variation1.phpt
new file mode 100644
index 000000000..a7cf857f7
--- /dev/null
+++ b/ext/standard/tests/dir/chdir_variation1.phpt
@@ -0,0 +1,235 @@
+--TEST--
+Test chdir() function : usage variations - different data type as $directory arg
+--FILE--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $directory argument to test behaviour
+ */
+
+echo "*** Testing chdir() : usage variations ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/chdir_basic";
+@mkdir($dir_path);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA {
+ var $dir_path;
+
+ function __construct($dir) {
+ $this->dir_path = $dir;
+ }
+
+ public function __toString() {
+ return "$this->dir_path";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+$dir_path
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $directory argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "$dir_path",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA($dir_path),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of chdir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( chdir($input) );
+ $iterator++;
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/chdir_basic";
+
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing chdir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: chdir() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+bool(true)
+
+-- Iteration 20 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+bool(true)
+
+-- Iteration 22 --
+bool(true)
+
+-- Iteration 23 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: chdir(): %s (errno %d) in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: chdir() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/chdir_variation2.phpt b/ext/standard/tests/dir/chdir_variation2.phpt
new file mode 100644
index 000000000..fa70f9e10
--- /dev/null
+++ b/ext/standard/tests/dir/chdir_variation2.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test chdir() function : usage variations - relative paths
+--FILE--
+<?php
+/* Prototype : bool chdir(string $directory)
+ * Description: Change the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test chdir() with variations of relative paths
+ */
+
+echo "*** Testing chdir() : usage variations ***\n";
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create directories
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- \$directory = './level_one': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(chdir("./$level_one_dir_name"));
+var_dump(getcwd());
+
+echo "\n-- \$directory = 'level_one/level_two': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(chdir("$level_one_dir_name/$level_two_dir_name"));
+var_dump(getcwd());
+
+echo "\n-- \$directory = '..': --\n";
+var_dump(chdir('..'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = 'level_two', '.': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(chdir('.'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = '../': --\n";
+var_dump(chdir('../'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = './': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(chdir('./'));
+var_dump(getcwd());
+
+echo "\n-- \$directory = '../../'level_one': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(chdir("../../$level_one_dir_name"));
+var_dump(getcwd());
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing chdir() : usage variations ***
+
+-- $directory = './level_one': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one"
+
+-- $directory = 'level_one/level_two': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+
+-- $directory = '..': --
+bool(true)
+string(%d) "%slevel_one"
+
+-- $directory = 'level_two', '.': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+
+-- $directory = '../': --
+bool(true)
+string(%d) "%slevel_one"
+
+-- $directory = './': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one%elevel_two"
+
+-- $directory = '../../'level_one': --
+bool(true)
+bool(true)
+string(%d) "%slevel_one"
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_basic.phpt b/ext/standard/tests/dir/closedir_basic.phpt
new file mode 100644
index 000000000..49080bb6a
--- /dev/null
+++ b/ext/standard/tests/dir/closedir_basic.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test closedir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Test basic functionality of closedir()
+ */
+
+echo "*** Testing closedir() : basic functionality ***\n";
+
+$base_dir = dirname(__FILE__);
+$dir_path = $base_dir . '/closedir_basic';
+mkdir($dir_path);
+
+echo "\n-- Call closedir() with no arguments: --\n";
+$dh1 = opendir($dir_path);
+var_dump(closedir());
+echo "-- Check Directory Handle: --\n";
+var_dump($dh1);
+
+echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n";
+$dh2 = opendir($dir_path);
+
+if ((int)$dh1 === (int)$dh2) {
+ echo "\nNo new resource created\n";
+}
+var_dump(closedir($dh2));
+echo "-- Check Directory Handle: --\n";
+var_dump($dh2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$base_dir = dirname(__FILE__);
+$dir_path = $base_dir . '/closedir_basic';
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing closedir() : basic functionality ***
+
+-- Call closedir() with no arguments: --
+NULL
+-- Check Directory Handle: --
+resource(%d) of type (Unknown)
+
+-- Call closedir() with $dir_handle argument supplied: --
+NULL
+-- Check Directory Handle: --
+resource(%d) of type (Unknown)
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_error.phpt b/ext/standard/tests/dir/closedir_error.phpt
new file mode 100644
index 000000000..1a8a043d0
--- /dev/null
+++ b/ext/standard/tests/dir/closedir_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test closedir() function : error conditions - Pass incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Pass incorrect number of arguments to closedir() to test behaviour
+ */
+
+echo "*** Testing closedir() : error conditions ***\n";
+
+
+//Test closedir with one more than the expected number of arguments
+echo "\n-- Testing closedir() function with more than expected no. of arguments --\n";
+
+$dir_path = dirname(__FILE__) . '\closedir_error';
+mkdir($dir_path);
+$dir_handle = opendir($dir_path);
+
+$extra_arg = 10;
+var_dump( closedir($dir_handle, $extra_arg) );
+
+//successfully close the directory handle so can delete in CLEAN section
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$base_dir = dirname(__FILE__);
+$dir_path = $base_dir . '\closedir_error';
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing closedir() : error conditions ***
+
+-- Testing closedir() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for closedir() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation1.phpt b/ext/standard/tests/dir/closedir_variation1.phpt
new file mode 100644
index 000000000..d5c843996
--- /dev/null
+++ b/ext/standard/tests/dir/closedir_variation1.phpt
@@ -0,0 +1,212 @@
+--TEST--
+Test closedir() function : usage variations - different data types as $dir_handle arg
+--FILE--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Pass different data types as $dir_handle argument to closedir() to test behaviour
+ */
+
+echo "*** Testing closedir() : usage variations ***\n";
+
+//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;
+
+// unexpected values to be passed to $dir_handle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of closedir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( closedir($input) );
+ $iterator++;
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing closedir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: closedir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation2.phpt b/ext/standard/tests/dir/closedir_variation2.phpt
new file mode 100644
index 000000000..015176c84
--- /dev/null
+++ b/ext/standard/tests/dir/closedir_variation2.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test closedir() function : usage variations - close directory handle twice
+--FILE--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * close the directory handle twice using closedir() to test behaviour
+ */
+
+echo "*** Testing closedir() : usage variations ***\n";
+
+//create temporary directory for test, removed in CLEAN section
+$directory = dirname(__FILE__) . "/closedir_variation2";
+mkdir($directory);
+
+$dh = opendir($directory);
+
+echo "\n-- Close directory handle first time: --\n";
+var_dump(closedir($dh));
+echo "Directory Handle: ";
+var_dump($dh);
+
+echo "\n-- Close directory handle second time: --\n";
+var_dump(closedir($dh));
+echo "Directory Handle: ";
+var_dump($dh);
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . "/closedir_variation2";
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing closedir() : usage variations ***
+
+-- Close directory handle first time: --
+NULL
+Directory Handle: resource(%d) of type (Unknown)
+
+-- Close directory handle second time: --
+
+Warning: closedir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+Directory Handle: resource(%d) of type (Unknown)
+===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt
new file mode 100644
index 000000000..b9b5e67e7
--- /dev/null
+++ b/ext/standard/tests/dir/closedir_variation3.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test closedir() function : usage variations - close a file pointer
+--FILE--
+<?php
+/* Prototype : void closedir([resource $dir_handle])
+ * Description: Close directory connection identified by the dir_handle
+ * Source code: ext/standard/dir.c
+ * Alias to functions: close
+ */
+
+/*
+ * Create a file pointer using fopen() then try to close it using closedir()
+ */
+
+echo "*** Testing closedir() : usage variations ***\n";
+
+echo "\n-- Open a file using fopen() --\n";
+var_dump($fp = fopen(__FILE__, 'r'));
+
+echo "\n-- Try to close the file pointer using closedir() --\n";
+var_dump(closedir($fp));
+
+echo "\n-- Check file pointer: --\n";
+var_dump($fp);
+
+if(is_resource($fp)) {
+ fclose($fp);
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing closedir() : usage variations ***
+
+-- Open a file using fopen() --
+resource(%d) of type (stream)
+
+-- Try to close the file pointer using closedir() --
+
+Warning: closedir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Check file pointer: --
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/dir_basic.phpt b/ext/standard/tests/dir/dir_basic.phpt
new file mode 100644
index 000000000..dba49dba0
--- /dev/null
+++ b/ext/standard/tests/dir/dir_basic.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test dir() function : basic functionality
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+echo "*** Testing dir() : basic functionality ***\n";
+
+// include the file.inc for Function: function create_files()
+include(dirname(__FILE__)."/../file/file.inc");
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_basic";
+@mkdir($dir_path);
+
+// create files within the temporary directory
+create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "dir_basic");
+
+echo "Get Directory instance:\n";
+$d = dir($dir_path);
+var_dump( $d );
+
+echo "\nRead and rewind:\n";
+var_dump( $d->read() );
+var_dump( $d->read() );
+var_dump( $d->rewind() );
+
+echo "\nTest using handle directly:\n";
+var_dump( readdir($d->handle) );
+var_dump( readdir($d->handle) );
+
+echo "\nClose directory:\n";
+var_dump( $d->close() );
+var_dump( $d );
+
+echo "\nTest read after closing the dir:";
+var_dump( $d->read() );
+
+// delete temp files
+delete_files($dir_path, 3, "dir_basic", 1, ".tmp");
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_basic";
+
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : basic functionality ***
+Get Directory instance:
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_basic"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+
+Read and rewind:
+string(%d) "%s"
+string(%d) "%s"
+NULL
+
+Test using handle directly:
+string(%d) "%s"
+string(%d) "%s"
+
+Close directory:
+NULL
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_basic"
+ ["handle"]=>
+ resource(%d) of type (Unknown)
+}
+
+Test read after closing the dir:
+Warning: Directory::read(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_error.phpt b/ext/standard/tests/dir/dir_error.phpt
new file mode 100644
index 000000000..f2ef25cc8
--- /dev/null
+++ b/ext/standard/tests/dir/dir_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test dir() function : error conditions
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+echo "*** Testing dir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing dir() function with zero arguments --";
+var_dump( dir() );
+
+// With one more than expected number of arguments
+echo "\n-- Testing dir() function with one more than expected number of arguments --";
+$extra_arg = 10;
+var_dump( dir(getcwd(), "stream", $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : error conditions ***
+
+-- Testing dir() function with zero arguments --
+Warning: dir() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing dir() function with one more than expected number of arguments --
+Warning: dir() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/dir/dir_variation1.phpt b/ext/standard/tests/dir/dir_variation1.phpt
new file mode 100644
index 000000000..ad912c008
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation1.phpt
@@ -0,0 +1,160 @@
+--TEST--
+Test dir() function : usage variations - unexpected value for 'dir' argument
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing non string values to 'directory' argument of dir() and see
+ * that the function outputs proper warning messages wherever expected.
+ */
+
+echo "*** Testing dir() : unexpected values for \$directory argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class A
+{
+ public $var;
+ public function init() {
+ $this->var = 10;
+ }
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r"); // get a file handle
+$dfp = opendir( dirname(__FILE__) ); // get a dir handle
+
+// unexpected values to be passed to $directory argument
+$unexpected_values = array (
+
+ // array data
+/*1*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*6*/ NULL,
+ null,
+
+ // boolean data
+/*8*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*12*/ "",
+ '',
+
+ // undefined data
+/*14*/ @$undefined_var,
+
+ // unset data
+/*15*/ @$unset_var,
+
+ // resource variable(dir and file handle)
+/*16*/ $fp,
+ $dfp,
+
+ // object data
+/*18*/ new A()
+);
+
+// loop through various elements of $unexpected_values to check the behavior of dir()
+$iterator = 1;
+foreach( $unexpected_values as $unexpected_value ) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( dir($unexpected_value) );
+ $iterator++;
+}
+
+fclose($fp);
+closedir($dfp);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : unexpected values for $directory argument ***
+
+-- Iteration 1 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: dir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+
+Warning: dir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+
+Warning: dir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+
+Warning: dir() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: dir() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: dir() expects parameter 1 to be string, object given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_variation2.phpt b/ext/standard/tests/dir/dir_variation2.phpt
new file mode 100644
index 000000000..ee42900ee
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation2.phpt
@@ -0,0 +1,223 @@
+--TEST--
+Test dir() function : usage variations - unexpected value for 'context' argument
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing non resource values to 'context' argument of dir() and see
+ * that the function outputs proper warning messages wherever expected.
+ */
+
+echo "*** Testing dir() : unexpected values for \$context argument ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$directory = $file_path."/dir_variation2";
+@mkdir($directory);
+
+// get an unset variable
+$unset_var = stream_context_create();
+unset($unset_var);
+
+class classA
+{
+ public $var;
+ public function init() {
+ $this->var = 10;
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// unexpected values to be passed to $directory argument
+$unexpected_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',
+ $heredoc,
+
+ // object data
+/*26*/ new classA(),
+
+ // undefined data
+/*27*/ @$undefined_var,
+
+ // unset data
+/*28*/ @$unset_var
+);
+
+// loop through various elements of $unexpected_values to check the behavior of dir()
+$iterator = 1;
+foreach( $unexpected_values as $unexpected_value ) {
+ echo "\n-- Iteration $iterator --";
+ var_dump( dir($directory, $unexpected_value) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$directory = $file_path."/dir_variation2";
+
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing dir() : unexpected values for $context argument ***
+
+-- Iteration 1 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: dir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: dir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: dir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 25 --
+Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 26 --
+Warning: dir() expects parameter 2 to be resource, object given in %s on line %d
+NULL
+
+-- Iteration 27 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 28 --
+Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_variation3.phpt b/ext/standard/tests/dir/dir_variation3.phpt
new file mode 100644
index 000000000..f8d325874
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation3.phpt
@@ -0,0 +1,204 @@
+--TEST--
+Test dir() function : usage variations - different directory permissions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Providing various permissions to the directory to be opened and checking
+ * to see if dir() function opens the directory successfully.
+ */
+
+echo "*** Testing dir() : different directory permissions ***";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation3";
+@mkdir($dir_path);
+
+/* different values for directory permissions */
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+// Open directory with different permission values, read and close, expected: none of them to succeed.
+for($count = 0; $count < count($permission_values); $count++) {
+ echo "\n-- Iteration ".($count + 1)." --\n";
+
+ // try to remove the dir if exists & create
+ $file_path = dirname(__FILE__);
+ $dir_path = $file_path."/dir_variation3";
+ @chmod ($dir_path, 0777); // change dir permission to allow all operation
+ @rmdir ($dir_path); // try n delete the dir
+
+ // create the dir now
+ @mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $permission_values[$count]) );
+
+ // try to get dir handle
+ $d = dir($dir_path);
+ var_dump($d); // dump the handle
+
+ // try read directory, expected : false
+ echo "-- reading contents --\n";
+ var_dump($d->read());
+
+ // close directory
+ $d->close();
+}
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+// deleting temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation3";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : different directory permissions ***
+-- Iteration 1 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 2 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 3 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 4 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 5 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 6 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 7 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 8 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 9 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+
+-- Iteration 10 --
+bool(true)
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation3"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading contents --
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/dir/dir_variation4.phpt b/ext/standard/tests/dir/dir_variation4.phpt
new file mode 100644
index 000000000..62b10b2a8
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation4.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test dir() function : usage variations - operate on previously opened directory
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Testing the behavior of dir() function by trying to open a
+ * directory which is already open.
+ */
+
+echo "*** Testing dir() : operate on previously opened directory ***\n";
+
+// include the file.inc for Function: function create_files()
+include( dirname(__FILE__)."/../file/file.inc");
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation4";
+@mkdir($dir_path);
+
+// create files within the temporary directory
+create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "dir_variation4");
+
+// open the directory
+$d = dir($dir_path);
+var_dump( $d );
+
+// open the same directory again without closing it
+$e = dir($dir_path);
+var_dump( $e );
+
+echo "-- reading directory contents with previous handle --\n";
+var_dump( $d->read() ); // with previous handle
+
+echo "-- reading directory contents with current handle --\n";
+var_dump( $e->read() ); // with current handle
+
+// delete temporary files
+delete_files($dir_path, 3, "dir_variation4");
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation4";
+
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : operate on previously opened directory ***
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation4"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation4"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+-- reading directory contents with previous handle --
+string(%d) "%s"
+-- reading directory contents with current handle --
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/dir/dir_variation5.phpt b/ext/standard/tests/dir/dir_variation5.phpt
new file mode 100644
index 000000000..2399c634c
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation5.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test dir() function : usage variations - open a file instead of directory
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing a file as argument to dir() function instead of a directory
+ * and checking if proper warning message is generated.
+ */
+
+echo "*** Testing dir() : open a file instead of a directory ***\n";
+
+// open the file instead of directory
+$d = dir(__FILE__);
+var_dump( $d );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : open a file instead of a directory ***
+
+Warning: dir(%s): failed to open dir: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/dir/dir_variation6.phpt b/ext/standard/tests/dir/dir_variation6.phpt
new file mode 100644
index 000000000..e42057ed1
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation6.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test dir() function : usage variations - non-existent directory
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Passing a non-existent directory as argument to dir() function
+ * and checking to see if proper warning message is output.
+ */
+echo "*** Testing dir() : open a non-existent directory ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation6";
+@mkdir($dir_path);
+
+// open existent directory
+$d = dir($dir_path);
+$d->close(); //close the dir
+
+// remove directory and try to open the same(non-existent) directory again
+rmdir($dir_path);
+clearstatcache();
+
+echo "-- opening previously removed directory --\n";
+var_dump( dir($dir_path) );
+
+// point to a non-existent directory
+$non_existent_dir = $file_path."/non_existent_dir";
+echo "-- opening non-existent directory --\n";
+$d = dir($non_existent_dir);
+var_dump( $d );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing dir() : open a non-existent directory ***
+-- opening previously removed directory --
+
+Warning: dir(%s): failed to open dir: %s in %s on line %d
+bool(false)
+-- opening non-existent directory --
+
+Warning: dir(%s): failed to open dir: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/dir/dir_variation7.phpt b/ext/standard/tests/dir/dir_variation7.phpt
new file mode 100644
index 000000000..ca168f90a
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation7.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test dir() function : usage variations - directories with restricted permissions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * remove the execute permission from the parent dir and test dir() on child dir
+ * 1) remove write & execute permission from the 1st parent and test dir()
+ * 2) remove execute permission from 2nd parent and test dir()
+ */
+
+echo "*** Testing dir() : remove execute permission from the parent dir ***\n";
+
+/* create the temporary directory :
+ dir_variation7 ( parent )
+ |-> sub_dir ( sub parent )
+ |-> child_dir ( child dir)
+*/
+$file_path = dirname(__FILE__);
+$parent_dir_path = $file_path."/dir_variation7";
+@mkdir($parent_dir_path);
+chmod($parent_dir_path, 0777);
+
+// create sub_dir
+$sub_dir_path = $parent_dir_path."/sub_dir";
+@mkdir($sub_dir_path);
+chmod($sub_dir_path, 0777);
+
+//create sub_sub_dir
+$child_dir_path = $sub_dir_path."/child_dir";
+@mkdir($child_dir_path);
+
+// remove the write and execute permisson from sub parent
+chmod($sub_dir_path, 0444);
+echo "-- After restricting 1st level parent directory --\n";
+$d = dir($child_dir_path); // try to open, expected failure
+var_dump( $d ); // dump it
+
+// remove the execute permisson from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permisson to sub dir
+chmod($parent_dir_path, 0666); // restricting parent directory
+echo "-- After restricting parent directory --\n";
+$d = dir($child_dir_path); // try to open, expected failure
+var_dump( $d ); // dump it
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$parent_dir_path = $file_path."/dir_variation7";
+$sub_dir_path = $parent_dir_path."/sub_dir";
+$child_dir_path = $sub_dir_path."/child_dir";
+
+// changing permissions for each temporary directory to delete them
+chmod($parent_dir_path, 0777);
+chmod($sub_dir_path, 0777);
+chmod($child_dir_path, 0777);
+
+rmdir($child_dir_path);
+rmdir($sub_dir_path);
+rmdir($parent_dir_path);
+?>
+--EXPECTF--
+*** Testing dir() : remove execute permission from the parent dir ***
+-- After restricting 1st level parent directory --
+
+Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+-- After restricting parent directory --
+
+Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/dir/dir_variation8.phpt b/ext/standard/tests/dir/dir_variation8.phpt
new file mode 100644
index 000000000..41217500d
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation8.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test dir() function : usage variations - checking with wildcard characters
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Create more than one temporary directory & subdirectory and check if dir() function can open
+ * those directories when wildcard characters are used to refer to them.
+ */
+
+echo "*** Testing dir() : checking with wildcard characters ***\n";
+
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation81";
+$sub_dir_path = $dir_path."/sub_dir1";
+
+@mkdir($dir_path1);
+@mkdir($sub_dir_path);
+
+/* with different wildcard characters */
+
+echo "-- wildcard = '*' --\n";
+var_dump( dir($file_path."/dir_var*") );
+var_dump( dir($file_path."/*") );
+
+echo "-- wildcard = '?' --\n";
+var_dump( dir($dir_path."/sub_dir?") );
+var_dump( dir($dir_path."/sub?dir1") );
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+$dir_path = $file_path."/dir_variation81";
+$sub_dir_path = $dir_path."/sub_dir1";
+
+rmdir($dir_path1);
+rmdir($dir_path2);
+?>
+--EXPECTF--
+*** Testing dir() : checking with wildcard characters ***
+-- wildcard = '*' --
+
+Warning: dir(%s/dir_var*): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/*): failed to open dir: %s in %s on line %d
+bool(false)
+-- wildcard = '?' --
+
+Warning: dir(%s/dir_variation81/sub_dir?): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/dir_variation81/sub?dir1): failed to open dir: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/dir/dir_variation9.phpt b/ext/standard/tests/dir/dir_variation9.phpt
new file mode 100644
index 000000000..22f3d5baa
--- /dev/null
+++ b/ext/standard/tests/dir/dir_variation9.phpt
@@ -0,0 +1,111 @@
+--TEST--
+Test dir() function : usage variations - relative valid and invalid paths
+--FILE--
+<?php
+/*
+ * Prototype : object dir(string $directory[, resource $context])
+ * Description: Directory class with properties, handle and class and methods read, rewind and close
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Checking the behavior of dir() function by passing directories which
+ * have valid and invalid relative path.
+ */
+
+echo "*** Testing dir() : checking with valid and invalid paths ***\n";
+
+/* create the temporary directories */
+
+$file_path = dirname(__FILE__);
+
+// directory dir_variation91 with one sub-directory sub_dir11 and sub-sub-directory sub_dir111
+$dir_path1 = $file_path."/dir_variation91";
+$sub_dir11 = $dir_path1."/sub_dir11";
+$sub_dir111 = $sub_dir11."/sub_dir111";
+
+// directory dir_variation92 with one sub-directory sub_dir21
+$dir_path2 = $file_path."/dir_variation92";
+$sub_dir21 = $dir_path2."/sub_dir21";
+
+@mkdir($dir_path1);
+@mkdir($dir_path2);
+@mkdir($sub_dir11);
+@mkdir($sub_dir111);
+@mkdir($sub_dir21);
+
+// open the directory with valid paths
+echo "\n-- With valid paths --\n";
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/..") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91/sub_dir11/..") );
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/..") );
+
+// open the directory with invalid path
+echo "\n-- With invalid paths --\n";
+var_dump( dir("$dir_path1/sub_dir12/sub_dir111/..") );
+var_dump( dir("$dir_path2/sub_dir21/../dir_variation91") );
+var_dump( dir("$dir_path2/sub_dir21/../../dir_variation91/sub_dir12/..") );
+var_dump( dir("$dir_path1/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..") );
+
+echo "Done";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+
+$dir_path1 = $file_path."/dir_variation91";
+$sub_dir11 = $dir_path1."/sub_dir11";
+$sub_dir111 = $sub_dir11."/sub_dir111";
+$dir_path2 = $file_path."/dir_variation92";
+$sub_dir21 = $dir_path2."/sub_dir21";
+
+rmdir($sub_dir21);
+rmdir($sub_dir111);
+rmdir($sub_dir11);
+rmdir($dir_path1);
+rmdir($dir_path2);
+?>
+--EXPECTF--
+*** Testing dir() : checking with valid and invalid paths ***
+
+-- With valid paths --
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91"
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir11/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+object(Directory)#%d (2) {
+ ["path"]=>
+ string(%d) "%s/dir_variation91/sub_dir11/sub_dir111/../../../dir_variation92/sub_dir21/.."
+ ["handle"]=>
+ resource(%d) of type (stream)
+}
+
+-- With invalid paths --
+
+Warning: dir(%s/dir_variation91/sub_dir12/sub_dir111/..): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/dir_variation92/sub_dir21/../dir_variation91): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: dir(%s/dir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..): failed to open dir: %s in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/dir/getcwd_basic.phpt b/ext/standard/tests/dir/getcwd_basic.phpt
new file mode 100644
index 000000000..ef720d095
--- /dev/null
+++ b/ext/standard/tests/dir/getcwd_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test getcwd() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed getcwd(void)
+ * Description: Gets the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of getcwd()
+ */
+
+echo "*** Testing getcwd() : basic functionality ***\n";
+
+//create temporary directory for test, removed in CLEAN section
+$directory = dirname(__FILE__) . "/getcwd_basic";
+mkdir($directory);
+
+var_dump(getcwd());
+chdir($directory);
+var_dump(getcwd());
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . "/getcwd_basic";
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing getcwd() : basic functionality ***
+string(%d) "%s"
+string(%d) "%s%egetcwd_basic"
+===DONE===
diff --git a/ext/standard/tests/dir/getcwd_error.phpt b/ext/standard/tests/dir/getcwd_error.phpt
new file mode 100644
index 000000000..09ee25481
--- /dev/null
+++ b/ext/standard/tests/dir/getcwd_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test getcwd() function : error conditions - Incorrect number of arguments
+--FILE--
+<?php
+/* Prototype : mixed getcwd(void)
+ * Description: Gets the current directory
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to getcwd() to test behaviour
+ */
+
+echo "*** Testing getcwd() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing getcwd() function with one argument --\n";
+$extra_arg = 10;
+var_dump( getcwd($extra_arg) );
+?>
+===DONE===
+--EXPECTF--
+*** Testing getcwd() : error conditions ***
+
+-- Testing getcwd() function with one argument --
+
+Warning: Wrong parameter count for getcwd() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_basic.phpt b/ext/standard/tests/dir/opendir_basic.phpt
new file mode 100644
index 000000000..17ada17ea
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_basic.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Test opendir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of opendir() with absolute and relative paths as $path argument
+ */
+
+echo "*** Testing opendir() : basic functionality ***\n";
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create temporary directories - will remove in CLEAN section
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- Testing opendir() with absolute path: --\n";
+var_dump($dh1 = opendir($level_one_dir_path));
+
+
+echo "\n-- Testing opendir() with relative paths: --\n";
+var_dump(chdir($level_one_dir_path));
+var_dump($dh2 = opendir($level_two_dir_name));
+
+echo "\n-- Close directory handles: --\n";
+closedir($dh1);
+var_dump($dh1);
+closedir($dh2);
+var_dump($dh2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing opendir() : basic functionality ***
+
+-- Testing opendir() with absolute path: --
+resource(%d) of type (stream)
+
+-- Testing opendir() with relative paths: --
+bool(true)
+resource(%d) of type (stream)
+
+-- Close directory handles: --
+resource(%d) of type (Unknown)
+resource(%d) of type (Unknown)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_error1.phpt b/ext/standard/tests/dir/opendir_error1.phpt
new file mode 100644
index 000000000..92b8eee1b
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_error1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test opendir() function : error conditions - Incorrect number of args
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to opendir() to test behaviour
+ */
+
+echo "*** Testing opendir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing opendir() function with Zero arguments --\n";
+var_dump( opendir() );
+
+//Test opendir with one more than the expected number of arguments
+echo "\n-- Testing opendir() function with more than expected no. of arguments --\n";
+$path = dirname(__FILE__) . "/opendir_error";
+mkdir($path);
+$context = stream_context_create();
+
+$extra_arg = 10;
+var_dump( opendir($path, $context, $extra_arg) );
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_error";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : error conditions ***
+
+-- Testing opendir() function with Zero arguments --
+
+Warning: opendir() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing opendir() function with more than expected no. of arguments --
+
+Warning: opendir() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_error2.phpt b/ext/standard/tests/dir/opendir_error2.phpt
new file mode 100644
index 000000000..0762be2ad
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_error2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test opendir() function : error conditions - Non-existent directory
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a non-existent directory as $path argument to opendir() to test behaviour
+ */
+
+echo "*** Testing opendir() : error conditions ***\n";
+
+echo "\n-- Pass a non-existent absolute path: --\n";
+$path = dirname(__FILE__) . "/idonotexist";
+var_dump(opendir($path));
+
+echo "\n-- Pass a non-existent relative path: --\n";
+chdir(dirname(__FILE__));
+var_dump(opendir('idonotexist'));
+?>
+===DONE===
+--EXPECTF--
+*** Testing opendir() : error conditions ***
+
+-- Pass a non-existent absolute path: --
+
+Warning: opendir(%s/idonotexist): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Pass a non-existent relative path: --
+
+Warning: opendir(idonotexist): failed to open dir: %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation1.phpt b/ext/standard/tests/dir/opendir_variation1.phpt
new file mode 100644
index 000000000..dc10356f5
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_variation1.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test opendir() function : usage variations - different data types as $path arg
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $path argument to opendir() to test behaviour
+ * Where possible, an existing directory has been entered as a string value
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+
+// create directory to be passed as string value where possible
+$path = dirname(__FILE__) . "/opendir_variation1";
+mkdir($path);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA {
+
+ var $path;
+ function __construct($path) {
+ $this->path = $path;
+ }
+ public function __toString() {
+ return $this->path;
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+$path
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $path argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "$path",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA($path),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of opendir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( $dh = opendir($input) );
+ if ($dh) {
+ closedir($dh);
+ }
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_variation1";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: opendir(0): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: opendir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: opendir(12345): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: opendir(-2345): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: opendir(10.5): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: opendir(-10.5): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: opendir(123456789000): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: opendir(1.23456789E-9): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: opendir(0.5): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+
+Warning: opendir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+
+Warning: opendir(1): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+
+Warning: opendir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+resource(%d) of type (stream)
+
+-- Iteration 20 --
+
+Warning: opendir(string): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+resource(%d) of type (stream)
+
+-- Iteration 22 --
+resource(%d) of type (stream)
+
+-- Iteration 23 --
+bool(false)
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+
+Warning: opendir() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation2.phpt b/ext/standard/tests/dir/opendir_variation2.phpt
new file mode 100644
index 000000000..4236bec84
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_variation2.phpt
@@ -0,0 +1,239 @@
+--TEST--
+Test opendir() function : usage variations - different data types as $context arg
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $context argument to opendir() to test behaviour
+ */
+
+echo "*** Testing opendir() : usage variation ***\n";
+
+
+// Initialise function arguments not being substituted (if any)
+// create temporary directory for test, removed in CLEAN section
+$path = dirname(__FILE__) . "/opendir_variation2";
+mkdir($path);
+
+
+//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 $context argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of opendir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump($dh = opendir($path, $input) );#
+ if ($dh) {
+ closedir($dh);
+ }
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_variation2";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variation ***
+
+-- Iteration 1 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: opendir() expects parameter 2 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: opendir() expects parameter 2 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: opendir() expects parameter 2 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: opendir() expects parameter 2 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: opendir() expects parameter 2 to be resource, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: opendir(): supplied resource is not a valid Stream-Context resource in %s on line %d
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation3.phpt b/ext/standard/tests/dir/opendir_variation3.phpt
new file mode 100644
index 000000000..3de0dd370
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_variation3.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test opendir() function : usage variations - open a directory twice
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Call opendir() twice with the same directory as $path argument
+ */
+
+echo "*** Testing opendir() : usage variation ***\n";
+
+$path = dirname(__FILE__) . "/opendir_variation3";
+mkdir($path);
+
+echo "\n-- Open directory first time: --\n";
+var_dump($dh1 = opendir($path));
+
+echo "\n-- Open directory second time: --\n";
+var_dump($dh2 = opendir($path));
+
+if ($dh1 !== $dh2) {
+ echo "\nNew resource created\n";
+} else {
+ echo "\nNo new resource created\n";
+}
+
+closedir($dh1);
+closedir($dh2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/opendir_variation3";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variation ***
+
+-- Open directory first time: --
+resource(%d) of type (stream)
+
+-- Open directory second time: --
+resource(%d) of type (stream)
+
+New resource created
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation4.phpt b/ext/standard/tests/dir/opendir_variation4.phpt
new file mode 100644
index 000000000..b20641740
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_variation4.phpt
@@ -0,0 +1,107 @@
+--TEST--
+Test opendir() function : usage variations - different relative paths
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test opendir() with different relative paths as $path argument
+ */
+
+echo "*** Testing opendir() : usage variation ***\n";
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_name = "level_one";
+$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
+
+$level_two_dir_name = "level_two";
+$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
+
+// create directories
+mkdir($level_one_dir_path);
+mkdir($level_two_dir_path);
+
+echo "\n-- \$path = './level_one': --\n";
+var_dump(chdir($base_dir_path));
+var_dump($dh = opendir("./$level_one_dir_name"));
+clean_dh($dh);
+
+echo "\n-- \$path = 'level_one/level_two': --\n";
+var_dump(chdir($base_dir_path));
+var_dump($dh = opendir("$level_one_dir_name/$level_two_dir_name"));
+clean_dh($dh);
+
+echo "\n-- \$path = '..': --\n";
+var_dump($dh = opendir('..'));
+clean_dh($dh);
+
+echo "\n-- \$path = 'level_two', '.': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump($dh = opendir('.'));
+clean_dh($dh);
+
+echo "\n-- \$path = '../': --\n";
+var_dump($dh = opendir('../'));
+clean_dh($dh);
+
+echo "\n-- \$path = './': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump($dh = opendir('./'));
+clean_dh($dh);
+
+echo "\n-- \$path = '../../'level_one': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump($dh = opendir("../../$level_one_dir_name"));
+clean_dh($dh);
+
+/*
+ * function to remove directory handle before re-using variable name in test
+ * and to ensure directory is not in use at CLEAN section so can me removed
+ */
+function clean_dh($dh){
+ if (is_resource($dh)) {
+ closedir($dh);
+ }
+ unset($dh);
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+rmdir("$file_path/level_one/level_two");
+rmdir("$file_path/level_one");
+?>
+--EXPECTF--
+*** Testing opendir() : usage variation ***
+
+-- $path = './level_one': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = 'level_one/level_two': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = '..': --
+resource(%d) of type (stream)
+
+-- $path = 'level_two', '.': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = '../': --
+resource(%d) of type (stream)
+
+-- $path = './': --
+bool(true)
+resource(%d) of type (stream)
+
+-- $path = '../../'level_one': --
+bool(true)
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation5.phpt b/ext/standard/tests/dir/opendir_variation5.phpt
new file mode 100644
index 000000000..f9bb38c68
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_variation5.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test opendir() function : usage variations - directories with restricted permissions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * remove the execute permission from the parent dir and test opendir() on child dir
+ * 1) remove write & execute permission from the 1st parent and test opendir()
+ * 2) remove execute permission from 2nd parent and test opendir()
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+
+/* create the temporary directory :
+ * opendir_variation5 ( parent )
+ * |-> sub_dir ( sub parent )
+ * |-> child_dir ( child dir)
+ */
+
+$parent_dir_path = dirname(__FILE__) . "/opendir_variation5";
+mkdir($parent_dir_path);
+chmod($parent_dir_path, 0777);
+
+// create sub_dir
+$sub_dir_path = $parent_dir_path . "/sub_dir";
+mkdir($sub_dir_path);
+chmod($sub_dir_path, 0777);
+
+//create sub_sub_dir
+$child_dir_path = $sub_dir_path."/child_dir";
+mkdir($child_dir_path);
+
+// remove the write and execute permisson from sub parent
+chmod($sub_dir_path, 0444);
+
+echo "\n-- After restricting 1st level parent directory --\n";
+$dir_handle1 = opendir($child_dir_path);
+var_dump( $dir_handle1 );
+
+// remove the execute permisson from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permisson to sub dir
+chmod($parent_dir_path, 0666); // restricting parent directory
+
+echo "\n-- After restricting parent directory --\n";
+$dir_handle2 = opendir($child_dir_path); // try to open, expected failure
+var_dump( $dir_handle2 ); // dump it
+
+if (is_resource($dir_handle1)) {
+ closedir($dir_handle1);
+}
+if (is_resource($dir_handle2)) {
+ closedir($dir_handle2);
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$parent_dir_path = dirname(__FILE__) . "/opendir_variation5";
+$sub_dir_path = $parent_dir_path."/sub_dir";
+$child_dir_path = $sub_dir_path."/child_dir";
+
+// changing permissions for each temporary directory to delete them
+chmod($parent_dir_path, 0777);
+chmod($sub_dir_path, 0777);
+chmod($child_dir_path, 0777);
+
+rmdir($child_dir_path);
+rmdir($sub_dir_path);
+rmdir($parent_dir_path);
+?>
+
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- After restricting 1st level parent directory --
+
+Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- After restricting parent directory --
+
+Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation6.phpt b/ext/standard/tests/dir/opendir_variation6.phpt
new file mode 100644
index 000000000..01e8225d5
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_variation6.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test opendir() function : usage variations - Different wildcards
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass paths containing wildcards to test if opendir() recognises them
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/opendir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+mkdir($dir_path);
+mkdir($sub_dir_path);
+
+// with different wildcard characters
+
+echo "\n-- Wildcard = '*' --\n";
+var_dump( opendir($file_path . "/opendir_var*") );
+var_dump( opendir($file_path . "/*") );
+
+echo "\n-- Wildcard = '?' --\n";
+var_dump( opendir($dir_path . "/sub_dir?") );
+var_dump( opendir($dir_path . "/sub?dir1") );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/opendir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+rmdir($sub_dir_path);
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Wildcard = '*' --
+
+Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: opendir(%s/*): failed to open dir: %s in %s on line %d
+bool(false)
+
+-- Wildcard = '?' --
+
+Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
+bool(false)
+
+Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation7.phpt b/ext/standard/tests/dir/opendir_variation7.phpt
new file mode 100644
index 000000000..2ad41b1d3
--- /dev/null
+++ b/ext/standard/tests/dir/opendir_variation7.phpt
@@ -0,0 +1,127 @@
+--TEST--
+Test opendir() function : usage variations - different directory permissions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__) . "/opendir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : mixed opendir(string $path[, resource $context])
+ * Description: Open a directory and return a dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open a directory using opendir() with different directory permissions
+ */
+
+echo "*** Testing opendir() : usage variations ***\n";
+
+// create the temporary directory
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/opendir_variation7";
+mkdir($dir_path);
+
+/* different values for directory permissions */
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+// Open directory with different permission values, read and close, expected: none of them to succeed.
+
+$iterator = 1;
+foreach ($permission_values as $perm) {
+
+ echo "\n-- Iteration $iterator --\n";
+ // try to remove the dir if exists & create
+ if (is_dir($dir_path)){
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+
+ var_dump($dh = opendir($dir_path));
+
+ if (is_resource($dh)) {
+ closedir($dh);
+ }
+ $iterator++;
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+// deleting temporary directory
+$dir_path = dirname(__FILE__) . "/opendir_variation7";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing opendir() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 2 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 3 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 4 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 5 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 6 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 7 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 8 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 9 --
+bool(true)
+resource(%d) of type (stream)
+
+-- Iteration 10 --
+bool(true)
+resource(%d) of type (stream)
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_basic.phpt b/ext/standard/tests/dir/readdir_basic.phpt
new file mode 100644
index 000000000..572a9a079
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_basic.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test readdir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.C
+ */
+
+/*
+ * Test basic functionality of readdir()
+ */
+
+echo "*** Testing readdir() : basic functionality ***\n";
+
+// include the file.inc for Function: function create_files()
+chdir(dirname(__FILE__));
+include(dirname(__FILE__)."/../file/file.inc");
+
+$path = dirname(__FILE__) . '/readdir_basic';
+mkdir($path);
+create_files($path, 3);
+
+echo "\n-- Call readdir() with \$path argument --\n";
+var_dump($dh = opendir($path));
+$a = array();
+while( FALSE !== ($file = readdir($dh)) ) {
+ $a[] = $file;
+}
+sort($a);
+foreach($a as $file) {
+ var_dump($file);
+}
+
+echo "\n-- Call readdir() without \$path argument --\n";
+var_dump($dh = opendir($path));
+$a = array();
+while( FALSE !== ( $file = readdir() ) ) {
+ $a[] = $file;
+}
+sort($a);
+foreach($a as $file) {
+ var_dump($file);
+}
+
+delete_files($path, 3);
+closedir($dh);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . '/readdir_basic';
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing readdir() : basic functionality ***
+
+-- Call readdir() with $path argument --
+resource(%d) of type (stream)
+string(1) "."
+string(2) ".."
+string(9) "file1.tmp"
+string(9) "file2.tmp"
+string(9) "file3.tmp"
+
+-- Call readdir() without $path argument --
+resource(%d) of type (stream)
+string(1) "."
+string(2) ".."
+string(9) "file1.tmp"
+string(9) "file2.tmp"
+string(9) "file3.tmp"
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_error.phpt b/ext/standard/tests/dir/readdir_error.phpt
new file mode 100644
index 000000000..4b4011a13
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test readdir() function : error conditions - Incorrect number of args
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : error conditions ***\n";
+
+
+//Test readdir with one more than the expected number of arguments
+echo "\n-- Testing readdir() function with more than expected no. of arguments --\n";
+
+$path = dirname(__FILE__) . "/readdir_error";
+mkdir($path);
+$dir_handle = opendir($path);
+$extra_arg = 10;
+
+var_dump( readdir($dir_handle, $extra_arg) );
+
+// close the handle so can remove dir in CLEAN section
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . "/readdir_error";
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing readdir() : error conditions ***
+
+-- Testing readdir() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for readdir() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation1.phpt b/ext/standard/tests/dir/readdir_variation1.phpt
new file mode 100644
index 000000000..b9cd85b28
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_variation1.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test readdir() function : usage variations - different data types as $dir_handle arg
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $dir_handle argument to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+//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;
+
+// unexpected values to be passed to $dir_handle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of readdir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( readdir($input) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: readdir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation2.phpt b/ext/standard/tests/dir/readdir_variation2.phpt
new file mode 100644
index 000000000..6809ac2f2
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_variation2.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test readdir() function : usage variations - empty directories
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass readdir() a directory handle pointing to an empty directory to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+$path = dirname(__FILE__) . '/readdir_variation2';
+mkdir($path);
+$dir_handle = opendir($path);
+
+echo "\n-- Pass an empty directory to readdir() --\n";
+while(FALSE !== ($file = readdir($dir_handle))){
+ var_dump($file);
+}
+
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path = dirname(__FILE__) . '/readdir_variation2';
+rmdir($path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Pass an empty directory to readdir() --
+string(1) "."
+string(2) ".."
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation3.phpt b/ext/standard/tests/dir/readdir_variation3.phpt
new file mode 100644
index 000000000..a598462e3
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_variation3.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test readdir() function : usage variations - sub-directories
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory handle pointing to a directory that has a sub-directory
+ * to test behaviour of readdir()
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// include the file.inc for Function: function create_files()
+chdir(dirname(__FILE__));
+include(dirname(__FILE__)."/../file/file.inc");
+
+$path_top = dirname(__FILE__) . '/readdir_variation3';
+$path_sub = $path_top . '/sub_folder';
+mkdir($path_top);
+mkdir($path_sub);
+
+create_files($path_top, 2);
+create_files($path_sub, 2);
+
+$dir_handle = opendir($path_top);
+$contents = array();
+while(FALSE !== ($file = readdir($dir_handle))) {
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
+}
+
+// more important to check that all contents are present than order they are returned in
+sort($contents);
+var_dump($contents);
+
+delete_files($path_top, 2);
+delete_files($path_sub, 2);
+
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$path_top = dirname(__FILE__) . '/readdir_variation3';
+$path_sub = $path_top . '/sub_folder';
+rmdir($path_sub);
+rmdir($path_top);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(9) "file2.tmp"
+ [4]=>
+ string(10) "sub_folder"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation4.phpt b/ext/standard/tests/dir/readdir_variation4.phpt
new file mode 100644
index 000000000..770cdf6b0
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_variation4.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test readdir() function : usage variations - different file names
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory handle pointing to a directory that contains
+ * files with different file names to test how readdir() reads them
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+$dir_path = dirname(__FILE__) . "/readdir_variation4/";
+mkdir($dir_path);
+
+// heredoc string
+$heredoc = <<<EOT
+hd_file
+EOT;
+
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // empty data
+/*10*/ "",
+ array(),
+
+ // string data
+/*12*/ "double_file",
+ 'single_file',
+ $heredoc,
+);
+
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = fopen($dir_path . $input . '.tmp', 'w') );
+ var_dump( fwrite($$handle, $key));
+ fclose($$handle);
+ $iterator++;
+};
+
+echo "\n-- Call to readdir() --\n";
+$dir_handle = opendir($dir_path);
+$contents = array();
+while(FALSE !== ($file = readdir($dir_handle))){
+
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
+
+ // remove files while going through directory
+ @unlink($dir_path . $file);
+}
+
+// more important to check that all contents are present than order they are returned in
+sort($contents);
+var_dump($contents);
+
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/readdir_variation4/";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Iteration 1 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 2 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 3 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 4 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 5 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 6 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 7 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 8 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 9 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 10 --
+resource(%d) of type (stream)
+int(1)
+
+-- Iteration 11 --
+resource(%d) of type (stream)
+int(2)
+
+-- Iteration 12 --
+resource(%d) of type (stream)
+int(2)
+
+-- Iteration 13 --
+resource(%d) of type (stream)
+int(2)
+
+-- Iteration 14 --
+resource(%d) of type (stream)
+int(2)
+
+-- Call to readdir() --
+array(16) {
+ [0]=>
+ string(9) "-10.5.tmp"
+ [1]=>
+ string(9) "-2345.tmp"
+ [2]=>
+ string(1) "."
+ [3]=>
+ string(2) ".."
+ [4]=>
+ string(4) ".tmp"
+ [5]=>
+ string(7) "0.5.tmp"
+ [6]=>
+ string(5) "0.tmp"
+ [7]=>
+ string(17) "1.23456789E-9.tmp"
+ [8]=>
+ string(5) "1.tmp"
+ [9]=>
+ string(8) "10.5.tmp"
+ [10]=>
+ string(9) "12345.tmp"
+ [11]=>
+ string(16) "123456789000.tmp"
+ [12]=>
+ string(9) "Array.tmp"
+ [13]=>
+ string(15) "double_file.tmp"
+ [14]=>
+ string(11) "hd_file.tmp"
+ [15]=>
+ string(15) "single_file.tmp"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation5.phpt b/ext/standard/tests/dir/readdir_variation5.phpt
new file mode 100644
index 000000000..8c12f13df
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_variation5.phpt
@@ -0,0 +1,144 @@
+--TEST--
+Test readdir() function : usage variations - different permissions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/readdir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open a directory with different premissions then try to read it
+ * to test behaviour of readdir()
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// create the temporary directory
+$dir_path = dirname(__FILE__) . "/readdir_variation5";
+mkdir($dir_path);
+
+/* different values for directory permissions */
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+// Open directory with different permission values, read and close, expected: none of them to succeed.
+$iterator = 1;
+foreach($permission_values as $perm) {
+ echo "\n-- Iteration $iterator --\n";
+
+ if (is_dir($dir_path)) {
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+ var_dump($dh = opendir($dir_path));
+
+ echo "-- Calling readdir() --\n";
+ var_dump(readdir($dh));
+
+ closedir($dh);
+ $iterator++;
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/readdir_variation5";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 2 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 3 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 4 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 5 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 6 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 7 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 8 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 9 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+
+-- Iteration 10 --
+bool(true)
+resource(%d) of type (stream)
+-- Calling readdir() --
+string(%d) "%s"
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation6.phpt b/ext/standard/tests/dir/readdir_variation6.phpt
new file mode 100644
index 000000000..eec673e73
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_variation6.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test readdir() function : usage variations - operate on previously opened directory
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open two directory handles on the same directory and pass both
+ * to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// include the file.inc for Function: function create_files()
+include( dirname(__FILE__)."/../file/file.inc");
+
+// create the temporary directory
+$dir_path = dirname(__FILE__) . "/readdir_variation6";
+mkdir($dir_path);
+
+// create files within the temporary directory
+create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "readdir_variation6");
+
+// open the directory
+$dir_handle1 = opendir($dir_path);
+
+// open the same directory again without closing it
+opendir($dir_path);
+
+echo "\n-- Reading Directory Contents with Previous Handle --\n";
+$a = array();
+while (FALSE !== ($file = readdir($dir_handle1))) {
+ $a[] = $file;
+}
+sort($a);
+foreach ($a as $file) {
+ var_dump($file);
+}
+
+echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n";
+$a = array();
+while (FALSE !== ($file = readdir())) {
+ $a[] = $file;
+}
+sort($a);
+foreach ($a as $file) {
+ var_dump($file);
+}
+
+// delete temporary files
+delete_files($dir_path, 3, "readdir_variation6");
+closedir($dir_handle1);
+closedir();
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/readdir_variation6";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+
+-- Reading Directory Contents with Previous Handle --
+string(1) "."
+string(2) ".."
+string(23) "readdir_variation61.tmp"
+string(23) "readdir_variation62.tmp"
+string(23) "readdir_variation63.tmp"
+
+-- Reading Directory Contents with Current Handle (no arguments supplied) --
+string(1) "."
+string(2) ".."
+string(23) "readdir_variation61.tmp"
+string(23) "readdir_variation62.tmp"
+string(23) "readdir_variation63.tmp"
+===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation7.phpt b/ext/standard/tests/dir/readdir_variation7.phpt
new file mode 100644
index 000000000..86bd43061
--- /dev/null
+++ b/ext/standard/tests/dir/readdir_variation7.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test readdir() function : usage variations - use file pointers
+--FILE--
+<?php
+/* Prototype : string readdir([resource $dir_handle])
+ * Description: Read directory entry from dir_handle
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Open a file pointer using fopen and pass to readdir() to test behaviour
+ */
+
+echo "*** Testing readdir() : usage variations ***\n";
+
+// get a resource variable
+var_dump($fp = fopen(__FILE__, "r"));
+var_dump( readdir($fp) );
+
+// get file length over 256 characters
+<<<EOT
+123456789012345678901234567890
+123456789012345678901234567890
+123456789012345678901234567890
+123456789012345678901234567890
+123456789012345678901234567890
+EOT;
+?>
+===DONE===
+--EXPECTF--
+*** Testing readdir() : usage variations ***
+resource(%d) of type (stream)
+
+Warning: readdir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_basic.phpt b/ext/standard/tests/dir/rewinddir_basic.phpt
new file mode 100644
index 000000000..e9c027818
--- /dev/null
+++ b/ext/standard/tests/dir/rewinddir_basic.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test rewinddir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Test basic functionality of rewinddir()
+ */
+
+echo "*** Testing rewinddir() : basic functionality ***\n";
+
+// include file.inc for create_files function
+include(dirname(__FILE__) . "/../file/file.inc");
+
+$dir_path1 = dirname(__FILE__) . "/rewinddir_basic_dir1";
+$dir_path2 = dirname(__FILE__) . "/rewinddir_basic_dir2";
+mkdir($dir_path1);
+mkdir($dir_path2);
+
+@create_files($dir_path1, 1);
+@create_files($dir_path2, 1, 'numeric', 0755, 1, 'w', 'file', 2);
+var_dump($dh1 = opendir($dir_path1));
+var_dump($dh2 = opendir($dir_path2));
+
+$data = array();
+echo "\n-- Read and rewind first directory (argument supplied) --\n";
+while(FALSE !== $file1 = readdir($dh1)) {
+ $data[] = $file1;
+}
+sort($data);
+var_dump($data);
+
+var_dump(rewinddir($dh1));
+var_dump(readdir($dh1));
+
+$data = array();
+echo "\n-- Read and rewind second directory (no argument supplied) --\n";
+while(FALSE !== $file2 = readdir()) {
+ $data[] = $file2;
+}
+sort($data);
+var_dump($data);
+
+var_dump(rewinddir());
+var_dump(readdir());
+
+closedir($dh1);
+closedir($dh2);
+
+delete_files($dir_path1, 1);
+delete_files($dir_path2, 1, 'file', 2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path1 = dirname(__FILE__) . "/rewinddir_basic_dir1";
+$dir_path2 = dirname(__FILE__) . "/rewinddir_basic_dir2";
+rmdir($dir_path1);
+rmdir($dir_path2);
+?>
+--EXPECTF--
+*** Testing rewinddir() : basic functionality ***
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+
+-- Read and rewind first directory (argument supplied) --
+array(3) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+}
+NULL
+string(1) "."
+
+-- Read and rewind second directory (no argument supplied) --
+array(3) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file2.tmp"
+}
+NULL
+string(1) "."
+===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_error.phpt b/ext/standard/tests/dir/rewinddir_error.phpt
new file mode 100644
index 000000000..d66b24b93
--- /dev/null
+++ b/ext/standard/tests/dir/rewinddir_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test rewinddir() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Pass incorrect number of arguments to rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : error conditions ***\n";
+
+
+//Test rewinddir with one more than the expected number of arguments
+echo "\n-- Testing rewinddir() function with more than expected no. of arguments --\n";
+
+$dir_path = dirname(__FILE__) . "/rewinddir_error";
+mkdir($dir_path);
+$dir_handle = opendir($dir_path);
+$extra_arg = 10;
+
+var_dump( rewinddir($dir_handle, $extra_arg) );
+closedir($dir_handle);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/rewinddir_error";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing rewinddir() : error conditions ***
+
+-- Testing rewinddir() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for rewinddir() in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_variation1.phpt b/ext/standard/tests/dir/rewinddir_variation1.phpt
new file mode 100644
index 000000000..e1fa002c1
--- /dev/null
+++ b/ext/standard/tests/dir/rewinddir_variation1.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Test rewinddir() function : usage variations - different data types as $dir_handle arg
+--FILE--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Pass different data types as $dir_handle argument to rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : usage variations ***\n";
+
+//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;
+
+// unexpected values to be passed to $dir_handle argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of rewinddir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( rewinddir($input) );
+ $iterator++;
+};
+?>
+===DONE===
+--EXPECTF--
+*** Testing rewinddir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: rewinddir(): supplied argument is not a valid Directory resource in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_variation2.phpt b/ext/standard/tests/dir/rewinddir_variation2.phpt
new file mode 100644
index 000000000..37ff324ee
--- /dev/null
+++ b/ext/standard/tests/dir/rewinddir_variation2.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test rewinddir() function : usage variations - operate on a closed directory
+--FILE--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Open and close a directory handle then call rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : usage variations ***\n";
+
+$dir_path = dirname(__FILE__) . '/rewinddir_variation2';
+mkdir($dir_path);
+
+echo "\n-- Create the directory handle, read and close the directory --\n";
+var_dump($dir_handle = opendir($dir_path));
+var_dump(readdir($dir_handle));
+closedir($dir_handle);
+
+echo "\n-- Call to rewinddir() --\n";
+var_dump(rewinddir($dir_handle));
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . '/rewinddir_variation2';
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing rewinddir() : usage variations ***
+
+-- Create the directory handle, read and close the directory --
+resource(%d) of type (stream)
+string(1) "."
+
+-- Call to rewinddir() --
+
+Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_variation3.phpt b/ext/standard/tests/dir/rewinddir_variation3.phpt
new file mode 100644
index 000000000..2a2af89e6
--- /dev/null
+++ b/ext/standard/tests/dir/rewinddir_variation3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test rewinddir() function : usage variations - file pointers
+--FILE--
+<?php
+/* Prototype : void rewinddir([resource $dir_handle])
+ * Description: Rewind dir_handle back to the start
+ * Source code: ext/standard/dir.c
+ * Alias to functions: rewind
+ */
+
+/*
+ * Pass a file pointer to rewinddir() to test behaviour
+ */
+
+echo "*** Testing rewinddir() : usage variations ***\n";
+
+echo "\n-- Open a file using fopen --\n";
+var_dump($fp = fopen(__FILE__, 'r'));
+
+$result1 = fread($fp, 5);
+var_dump(rewinddir($fp));
+$result2 = fread($fp, 5);
+
+echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
+if ($result1 === $result2) {
+ echo "rewinddir() works on file pointers\n";
+} else {
+ echo "rewinddir() does not work on file pointers\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing rewinddir() : usage variations ***
+
+-- Open a file using fopen --
+resource(%d) of type (stream)
+
+Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
+bool(false)
+
+-- Check if rewinddir() has repositioned the file pointer --
+rewinddir() does not work on file pointers
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_basic.phpt b/ext/standard/tests/dir/scandir_basic.phpt
new file mode 100644
index 000000000..25700a7a4
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_basic.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test scandir() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test basic functionality of scandir()
+ */
+
+echo "*** Testing scandir() : basic functionality ***\n";
+
+// include file.inc for create_files function
+include (dirname(__FILE__) . '/../file/file.inc');
+
+// set up directory
+$directory = dirname(__FILE__) . '/scandir_basic';
+mkdir($directory);
+create_files($directory, 3);
+
+echo "\n-- scandir() with mandatory arguments --\n";
+var_dump(scandir($directory));
+
+echo "\n-- scandir() with all arguments --\n";
+$sorting_order = 1;
+$context = stream_context_create();
+var_dump(scandir($directory, $sorting_order, $context));
+
+delete_files($directory, 3);
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . '/scandir_basic';
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing scandir() : basic functionality ***
+
+-- scandir() with mandatory arguments --
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(9) "file2.tmp"
+ [4]=>
+ string(9) "file3.tmp"
+}
+
+-- scandir() with all arguments --
+array(5) {
+ [0]=>
+ string(9) "file3.tmp"
+ [1]=>
+ string(9) "file2.tmp"
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(2) ".."
+ [4]=>
+ string(1) "."
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_error1.phpt b/ext/standard/tests/dir/scandir_error1.phpt
new file mode 100644
index 000000000..7fbffba0c
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_error1.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test scandir() function : error conditions - Incorrect number of args
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass incorrect number of arguments to scandir() to test behaviour
+ */
+
+echo "*** Testing scandir() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing scandir() function with Zero arguments --\n";
+var_dump( scandir() );
+
+//Test scandir with one more than the expected number of arguments
+echo "\n-- Testing scandir() function with more than expected no. of arguments --\n";
+$dir = dirname(__FILE__) . '/scandir_error';
+mkdir($dir);
+$sorting_order = 10;
+$context = stream_context_create();
+$extra_arg = 10;
+var_dump( scandir($dir, $sorting_order, $context, $extra_arg) );
+?>
+===DONE===
+--CLEAN--
+<?php
+$directory = dirname(__FILE__) . '/scandir_error';
+rmdir($directory);
+?>
+--EXPECTF--
+*** Testing scandir() : error conditions ***
+
+-- Testing scandir() function with Zero arguments --
+
+Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing scandir() function with more than expected no. of arguments --
+
+Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_error2.phpt b/ext/standard/tests/dir/scandir_error2.phpt
new file mode 100644
index 000000000..1e99a578a
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_error2.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test scandir() function : error conditions - Non-existent directory
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory that does not exist to scandir() to test error messages
+ */
+
+echo "*** Testing scandir() : error conditions ***\n";
+
+$directory = dirname(__FILE__) . '/idonotexist';
+
+echo "\n-- Pass scandir() an absolute path that does not exist --\n";
+var_dump(scandir($directory));
+
+echo "\n-- Pass scandir() a relative path that does not exist --\n";
+var_dump(scandir('/idonotexist'));
+?>
+===DONE===
+--EXPECTF--
+*** Testing scandir() : error conditions ***
+
+-- Pass scandir() an absolute path that does not exist --
+
+Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Pass scandir() a relative path that does not exist --
+
+Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation1.phpt b/ext/standard/tests/dir/scandir_variation1.phpt
new file mode 100644
index 000000000..84b3565f7
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation1.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test scandir() function : usage variations - different data types as $dir arg
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $dir argument to test behaviour of scandir()
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+//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 $dir argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of scandir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( scandir($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: scandir(0): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: scandir(1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: scandir(12345): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: scandir(-2345): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: scandir(10.5): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: scandir(-10.5): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: scandir(123456789000): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: scandir(1.23456789E-9): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: scandir(0.5): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: scandir(1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: scandir(1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: scandir() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: scandir(string): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: scandir(string): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: scandir(hello world): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: scandir(Class A object): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: scandir(): Directory name cannot be empty in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: scandir() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation2.phpt b/ext/standard/tests/dir/scandir_variation2.phpt
new file mode 100644
index 000000000..e6033f256
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation2.phpt
@@ -0,0 +1,283 @@
+--TEST--
+Test scandir() function : usage variations - diff data types as $sorting_order arg
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $sorting_order argument to test how scandir() behaves
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$dir = dirname(__FILE__) . '/scandir_variation2';
+mkdir($dir);
+
+//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 $sorting_order argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of scandir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( scandir($dir, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/scandir_variation2';
+rmdir($dir);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 9 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 10 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 12 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(2) ".."
+ [1]=>
+ string(1) "."
+}
+
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 16 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: scandir() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: scandir() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: scandir() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 24 --
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 25 --
+
+Warning: scandir() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation3.phpt b/ext/standard/tests/dir/scandir_variation3.phpt
new file mode 100644
index 000000000..8e23faf2d
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation3.phpt
@@ -0,0 +1,238 @@
+--TEST--
+Test scandir() function : usage variations - diff data types as $context arg
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different data types as $context argument to test how scandir() behaves
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$dir = dirname(__FILE__) . '/scandir_variation3';
+mkdir($dir);
+$sorting_order = 0;
+
+//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 $context argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of scandir()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( scandir($dir, $sorting_order, $input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/scandir_variation3';
+rmdir($dir);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: scandir() expects parameter 3 to be resource, integer given in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: scandir() expects parameter 3 to be resource, double given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: scandir() expects parameter 3 to be resource, boolean given in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
+NULL
+
+-- Iteration 25 --
+
+Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation4.phpt b/ext/standard/tests/dir/scandir_variation4.phpt
new file mode 100644
index 000000000..f756cf1ee
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation4.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test scandir() function : usage variations - different relative paths
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Test scandir() with relative paths as $dir argument
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// include for create_files/delete_files functions
+include (dirname(__FILE__) . '/../file/file.inc');
+
+$base_dir_path = dirname(__FILE__);
+
+$level_one_dir_path = "$base_dir_path/level_one";
+$level_two_dir_path = "$level_one_dir_path/level_two";
+
+// create directories and files
+mkdir($level_one_dir_path);
+create_files($level_one_dir_path, 2, 'numeric', 0755, 1, 'w', 'level_one', 1);
+mkdir($level_two_dir_path);
+create_files($level_two_dir_path, 2, 'numeric', 0755, 1, 'w', 'level_two', 1);
+
+echo "\n-- \$path = './level_one': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(scandir('./level_one'));
+
+echo "\n-- \$path = 'level_one/level_two': --\n";
+var_dump(chdir($base_dir_path));
+var_dump(scandir('level_one/level_two'));
+
+echo "\n-- \$path = '..': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('..'));
+
+echo "\n-- \$path = 'level_two', '.': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('.'));
+
+echo "\n-- \$path = '../': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('../'));
+
+echo "\n-- \$path = './': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('./'));
+
+echo "\n-- \$path = '../../'level_one': --\n";
+var_dump(chdir($level_two_dir_path));
+var_dump(scandir('../../level_one'));
+
+@delete_files($level_one_dir_path, 2, 'level_one');
+@delete_files($level_two_dir_path, 2, 'level_two');
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__);
+rmdir("$dir_path/level_one/level_two");
+rmdir("$dir_path/level_one");
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- $path = './level_one': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+
+-- $path = 'level_one/level_two': --
+bool(true)
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_two1.tmp"
+ [3]=>
+ string(14) "level_two2.tmp"
+}
+
+-- $path = '..': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+
+-- $path = 'level_two', '.': --
+bool(true)
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_two1.tmp"
+ [3]=>
+ string(14) "level_two2.tmp"
+}
+
+-- $path = '../': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+
+-- $path = './': --
+bool(true)
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_two1.tmp"
+ [3]=>
+ string(14) "level_two2.tmp"
+}
+
+-- $path = '../../'level_one': --
+bool(true)
+array(5) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(14) "level_one1.tmp"
+ [3]=>
+ string(14) "level_one2.tmp"
+ [4]=>
+ string(9) "level_two"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation5.phpt b/ext/standard/tests/dir/scandir_variation5.phpt
new file mode 100644
index 000000000..d6d3c79e4
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation5.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test scandir() function : usage variations - different directory permissions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * remove the execute permission from the parent dir and test scandir() on child dir
+ * 1. remove write & execute permission from the 1st parent and test scandir()
+ * 2. remove execute permission from 2nd parent and test scandir()
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+/*
+ * create the temporary directory :
+ * scandir_variation5 ( parent )
+ * |-> sub_dir ( sub parent )
+ * |-> child_dir ( child dir)
+ */
+
+$parent_dir_path = dirname(__FILE__) . "/scandir_variation5";
+mkdir($parent_dir_path);
+chmod($parent_dir_path, 0777);
+
+// create sub_dir
+$sub_dir_path = $parent_dir_path . "/sub_dir";
+mkdir($sub_dir_path);
+chmod($sub_dir_path, 0777);
+
+//create sub_sub_dir
+$child_dir_path = $sub_dir_path."/child_dir";
+mkdir($child_dir_path);
+
+// remove the write and execute permisson from sub parent
+chmod($sub_dir_path, 0444);
+
+echo "\n-- After restricting 1st level parent directory --\n";
+var_dump(scandir($child_dir_path));
+
+// remove the execute permisson from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permisson to sub dir
+chmod($parent_dir_path, 0666); // restricting parent directory
+
+echo "\n-- After restricting parent directory --\n";
+var_dump(scandir($child_dir_path));
+?>
+===DONE===
+--CLEAN--
+<?php
+$parent_dir_path = dirname(__FILE__) . "/scandir_variation5";
+$sub_dir_path = $parent_dir_path."/sub_dir";
+$child_dir_path = $sub_dir_path."/child_dir";
+
+// changing permissions for each temporary directory to delete them
+chmod($parent_dir_path, 0777);
+chmod($sub_dir_path, 0777);
+chmod($child_dir_path, 0777);
+
+rmdir($child_dir_path);
+rmdir($sub_dir_path);
+rmdir($parent_dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- After restricting 1st level parent directory --
+
+Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- After restricting parent directory --
+
+Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation6.phpt b/ext/standard/tests/dir/scandir_variation6.phpt
new file mode 100644
index 000000000..5cb595fe7
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation6.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test scandir() function : usage variations - Wildcards in directory path
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory path using wildcards as $dir argument to test how scandir() behaves
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// create the temporary directories
+$file_path = dirname(__FILE__);
+$dir_path = $file_path . "/scandir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+mkdir($dir_path);
+mkdir($sub_dir_path);
+
+// with different wildcard characters
+
+echo "\n-- Wildcard = '*' --\n";
+var_dump( scandir($file_path . "/scandir_var*") );
+var_dump( scandir($file_path . "/*") );
+
+echo "\n-- Wildcard = '?' --\n";
+var_dump( scandir($dir_path . "/sub_dir?") );
+var_dump( scandir($dir_path . "/sub?dir1") );
+
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/scandir_variation6";
+$sub_dir_path = $dir_path . "/sub_dir1";
+
+rmdir($sub_dir_path);
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Wildcard = '*' --
+
+Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+Warning: scandir(%s/*): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+-- Wildcard = '?' --
+
+Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+
+Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
+
+Warning: scandir(): (errno %d): %s in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation7.phpt b/ext/standard/tests/dir/scandir_variation7.phpt
new file mode 100644
index 000000000..c7f77651d
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation7.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test scandir() function : usage variations - different directory permissions
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows');
+}
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__) . "/dir_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+ unlink ($filename);
+ die('skip...cannot be run as root\n');
+}
+unlink($filename);
+?>
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Create directories with different permissions to test whether scandir() can access them
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// create the temporary directory
+$dir_path = dirname(__FILE__) . "/scandir_variation7";
+mkdir($dir_path);
+
+// different values for directory permissions
+$permission_values = array(
+/*1*/ 0477, // owner has read only, other and group has rwx
+ 0677, // owner has rw only, other and group has rwx
+
+/*3*/ 0444, // all have read only
+ 0666, // all have rw only
+
+/*5*/ 0400, // owner has read only, group and others have no permission
+ 0600, // owner has rw only, group and others have no permission
+
+/*7*/ 0470, // owner has read only, group has rwx & others have no permission
+ 0407, // owner has read only, other has rwx & group has no permission
+
+/*9*/ 0670, // owner has rw only, group has rwx & others have no permission
+/*10*/ 0607 // owner has rw only, group has no permission and others have rwx
+);
+
+$iterator = 1;
+foreach ($permission_values as $perm) {
+ echo "\n-- Iteration $iterator --\n";
+
+ // Remove the directory if already exists
+ if (is_dir($dir_path)){
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
+
+ // change the dir permisson to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+
+ var_dump(scandir($dir_path));
+ $iterator++;
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/scandir_variation7";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 2 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 3 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 4 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 5 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 6 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 7 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 8 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 9 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+
+-- Iteration 10 --
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation8.phpt b/ext/standard/tests/dir/scandir_variation8.phpt
new file mode 100644
index 000000000..36ae88c8f
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation8.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Test scandir() function : usage variations - different file names
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass a directory containing files with different types of names to test how scandir()
+ * reads them
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+$dir_path = dirname(__FILE__) . "/scandir_variation8/";
+mkdir($dir_path);
+
+// heredoc string
+$heredoc = <<<EOT
+hd_file
+EOT;
+
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // empty data
+/*10*/ "",
+ array(),
+
+ // string data
+/*12*/ "double_file",
+ 'single_file',
+ $heredoc,
+);
+
+$iterator = 1;
+foreach($inputs as $key => $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = fopen($dir_path . $input . '.tmp', 'w') );
+ fclose($$handle);
+ $iterator++;
+};
+
+echo "\n-- Call to scandir() --\n";
+var_dump($content = scandir($dir_path));
+
+// remove all files in directory so can remove directory in CLEAN section
+foreach ($content as $file_name) {
+ // suppress errors as won't be able to remove "." and ".." entries
+ @unlink($dir_path . $file_name);
+}
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir_path = dirname(__FILE__) . "/scandir_variation8";
+rmdir($dir_path);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+
+-- Iteration 1 --
+resource(%d) of type (stream)
+
+-- Iteration 2 --
+resource(%d) of type (stream)
+
+-- Iteration 3 --
+resource(%d) of type (stream)
+
+-- Iteration 4 --
+resource(%d) of type (stream)
+
+-- Iteration 5 --
+resource(%d) of type (stream)
+
+-- Iteration 6 --
+resource(%d) of type (stream)
+
+-- Iteration 7 --
+resource(%d) of type (stream)
+
+-- Iteration 8 --
+resource(%d) of type (stream)
+
+-- Iteration 9 --
+resource(%d) of type (stream)
+
+-- Iteration 10 --
+resource(%d) of type (stream)
+
+-- Iteration 11 --
+resource(%d) of type (stream)
+
+-- Iteration 12 --
+resource(%d) of type (stream)
+
+-- Iteration 13 --
+resource(%d) of type (stream)
+
+-- Iteration 14 --
+resource(%d) of type (stream)
+
+-- Call to scandir() --
+array(16) {
+ [0]=>
+ string(9) "-10.5.tmp"
+ [1]=>
+ string(9) "-2345.tmp"
+ [2]=>
+ string(1) "."
+ [3]=>
+ string(2) ".."
+ [4]=>
+ string(4) ".tmp"
+ [5]=>
+ string(7) "0.5.tmp"
+ [6]=>
+ string(5) "0.tmp"
+ [7]=>
+ string(17) "1.23456789E-9.tmp"
+ [8]=>
+ string(5) "1.tmp"
+ [9]=>
+ string(8) "10.5.tmp"
+ [10]=>
+ string(9) "12345.tmp"
+ [11]=>
+ string(16) "123456789000.tmp"
+ [12]=>
+ string(9) "Array.tmp"
+ [13]=>
+ string(15) "double_file.tmp"
+ [14]=>
+ string(11) "hd_file.tmp"
+ [15]=>
+ string(15) "single_file.tmp"
+}
+===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation9.phpt b/ext/standard/tests/dir/scandir_variation9.phpt
new file mode 100644
index 000000000..2b1904c98
--- /dev/null
+++ b/ext/standard/tests/dir/scandir_variation9.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test scandir() function : usage variations - different ints as $sorting_order arg
+--FILE--
+<?php
+/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
+ * Description: List files & directories inside the specified path
+ * Source code: ext/standard/dir.c
+ */
+
+/*
+ * Pass different integers as $sorting_order argument to test how scandir()
+ * re-orders the array
+ */
+
+echo "*** Testing scandir() : usage variations ***\n";
+
+// include for create_files/delete_files functions
+include(dirname(__FILE__) . '/../file/file.inc');
+
+// create directory and files
+$dir = dirname(__FILE__) . '/scandir_variation9';
+mkdir($dir);
+@create_files($dir, 2);
+
+// different ints to pass as $sorting_order argument
+$ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0);
+
+foreach($ints as $sorting_order) {
+ var_dump( scandir($dir, $sorting_order) );
+}
+
+delete_files($dir, 2);
+?>
+===DONE===
+--CLEAN--
+<?php
+$dir = dirname(__FILE__) . '/scandir_variation9';
+rmdir($dir);
+?>
+--EXPECTF--
+*** Testing scandir() : usage variations ***
+array(4) {
+ [0]=>
+ string(9) "file2.tmp"
+ [1]=>
+ string(9) "file1.tmp"
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(1) "."
+}
+array(4) {
+ [0]=>
+ string(9) "file2.tmp"
+ [1]=>
+ string(9) "file1.tmp"
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(1) "."
+}
+array(4) {
+ [0]=>
+ string(1) "."
+ [1]=>
+ string(2) ".."
+ [2]=>
+ string(9) "file1.tmp"
+ [3]=>
+ string(9) "file2.tmp"
+}
+===DONE===
diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt
index b60b865e7..f5036daa8 100644
--- a/ext/standard/tests/file/bug22414.phpt
+++ b/ext/standard/tests/file/bug22414.phpt
@@ -8,20 +8,21 @@ output_handler=
$php = getenv('TEST_PHP_EXECUTABLE');
$tmpfile = tempnam('/tmp', 'phpt');
+ $args = ' -n -dsafe_mode=off ';
/* Regular Data Test */
- passthru($php . ' -n -r " echo \"HELLO\"; "');
+ passthru($php . $args . ' -r " echo \"HELLO\"; "');
echo "\n";
/* Binary Data Test */
if (substr(PHP_OS, 0, 3) != 'WIN') {
- $cmd = $php . ' -n -r \"readfile(@getenv(\'TEST_PHP_EXECUTABLE\')); \"';
- $cmd = $php . ' -n -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
+ $cmd = $php . $args . ' -r \"readfile(@getenv(\'TEST_PHP_EXECUTABLE\')); \"';
+ $cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
} else {
- $cmd = $php . ' -n -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"';
- $cmd = $php . ' -n -r " passthru(\''.$cmd.'\');" > '.$tmpfile ;
+ $cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"';
+ $cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ;
}
exec($cmd);
diff --git a/ext/standard/tests/file/bug41655_2.phpt b/ext/standard/tests/file/bug41655_2.phpt
index 23086661f..d406f1ba0 100644
--- a/ext/standard/tests/file/bug41655_2.phpt
+++ b/ext/standard/tests/file/bug41655_2.phpt
@@ -5,13 +5,11 @@ open_basedir=/
--FILE--
<?php
$dir = dirname(__FILE__);
- $a=glob($dir . "/bug41655*.*");
+ $a=glob($dir . "/test.*");
print_r($a);
?>
--EXPECTF--
Array
(
- [0] => %sbug41655_1.phpt
- [1] => %sbug41655_2.php
- [2] => %sbug41655_2.phpt
+ [0] => %stest.csv
)
diff --git a/ext/standard/tests/file/bug43216.phpt b/ext/standard/tests/file/bug43216.phpt
new file mode 100755
index 000000000..b7e42534c
--- /dev/null
+++ b/ext/standard/tests/file/bug43216.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #43216 (stream_is_local() returns false on file://)
+--FILE--
+<?php
+var_dump(stream_is_local("file://"));
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/standard/tests/file/bug43248.phpt b/ext/standard/tests/file/bug43248.phpt
new file mode 100755
index 000000000..a20e0e06c
--- /dev/null
+++ b/ext/standard/tests/file/bug43248.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #43248 backward compatibility break in realpath()
+--FILE--
+<?php
+echo realpath(dirname(__FILE__) . '/../file/');
+?>
+--EXPECTF--
+%sfile
diff --git a/ext/standard/tests/file/bug43522.phpt b/ext/standard/tests/file/bug43522.phpt
new file mode 100644
index 000000000..10e44fc35
--- /dev/null
+++ b/ext/standard/tests/file/bug43522.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #43522 (stream_get_line() eats additional characters)
+--FILE--
+<?php // 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
+
+$fp = fopen(__FILE__, 'r'); // Open self
+
+DoTest($fp, 'ZZZ'); // test multi-char delimiter
+DoTest($fp, "Z"); // test single-char delimiter
+
+function DoTest($fp, $delim) {
+ echo "Delimiter: " . $delim . "\n";
+ rewind($fp);
+ echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
+ echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
+}
+
+?>
+--EXPECT--
+Delimiter: ZZZ
+ <?php // 1
+ 234567890A
+Delimiter: Z
+ <?php // 1
+ 234567890A
diff --git a/ext/standard/tests/file/fgetc_basic.phpt b/ext/standard/tests/file/fgetc_basic.phpt
index d82110f78..7851e432f 100644
--- a/ext/standard/tests/file/fgetc_basic.phpt
+++ b/ext/standard/tests/file/fgetc_basic.phpt
@@ -69,475 +69,475 @@ echo "Done\n";
string(1) "2"
int(1)
bool(false)
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(2)
bool(false)
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(3)
bool(false)
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(4)
bool(false)
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(5)
bool(false)
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(6)
bool(false)
-resource(8) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 2 of Outerloop Iteration 1 --
-- Testing fgetc() : file opened using rb mode --
string(1) "2"
int(1)
bool(false)
-resource(9) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(2)
bool(false)
-resource(9) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(3)
bool(false)
-resource(9) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(4)
bool(false)
-resource(9) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(5)
bool(false)
-resource(9) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(6)
bool(false)
-resource(9) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 3 of Outerloop Iteration 1 --
-- Testing fgetc() : file opened using rt mode --
string(1) "2"
int(1)
bool(false)
-resource(10) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(2)
bool(false)
-resource(10) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(3)
bool(false)
-resource(10) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(4)
bool(false)
-resource(10) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(5)
bool(false)
-resource(10) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(6)
bool(false)
-resource(10) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 4 of Outerloop Iteration 1 --
-- Testing fgetc() : file opened using r+ mode --
string(1) "2"
int(1)
bool(false)
-resource(11) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(2)
bool(false)
-resource(11) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(3)
bool(false)
-resource(11) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(4)
bool(false)
-resource(11) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(5)
bool(false)
-resource(11) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(6)
bool(false)
-resource(11) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 5 of Outerloop Iteration 1 --
-- Testing fgetc() : file opened using r+b mode --
string(1) "2"
int(1)
bool(false)
-resource(12) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(2)
bool(false)
-resource(12) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(3)
bool(false)
-resource(12) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(4)
bool(false)
-resource(12) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(5)
bool(false)
-resource(12) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(6)
bool(false)
-resource(12) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 6 of Outerloop Iteration 1 --
-- Testing fgetc() : file opened using r+t mode --
string(1) "2"
int(1)
bool(false)
-resource(13) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(2)
bool(false)
-resource(13) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(3)
bool(false)
-resource(13) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(4)
bool(false)
-resource(13) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(5)
bool(false)
-resource(13) of type (stream)
+resource(%d) of type (stream)
string(1) "2"
int(6)
bool(false)
-resource(13) of type (stream)
+resource(%d) of type (stream)
--- Outerloop iteration 2 ---
-- Innerloop iteration 1 of Outerloop Iteration 2 --
-- Testing fgetc() : file opened using r mode --
string(1) "t"
int(1)
bool(false)
-resource(16) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(2)
bool(false)
-resource(16) of type (stream)
+resource(%d) of type (stream)
string(1) "x"
int(3)
bool(false)
-resource(16) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(4)
bool(false)
-resource(16) of type (stream)
+resource(%d) of type (stream)
string(1) " "
int(5)
bool(false)
-resource(16) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(6)
bool(false)
-resource(16) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 2 of Outerloop Iteration 2 --
-- Testing fgetc() : file opened using rb mode --
string(1) "t"
int(1)
bool(false)
-resource(17) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(2)
bool(false)
-resource(17) of type (stream)
+resource(%d) of type (stream)
string(1) "x"
int(3)
bool(false)
-resource(17) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(4)
bool(false)
-resource(17) of type (stream)
+resource(%d) of type (stream)
string(1) " "
int(5)
bool(false)
-resource(17) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(6)
bool(false)
-resource(17) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 3 of Outerloop Iteration 2 --
-- Testing fgetc() : file opened using rt mode --
string(1) "t"
int(1)
bool(false)
-resource(18) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(2)
bool(false)
-resource(18) of type (stream)
+resource(%d) of type (stream)
string(1) "x"
int(3)
bool(false)
-resource(18) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(4)
bool(false)
-resource(18) of type (stream)
+resource(%d) of type (stream)
string(1) " "
int(5)
bool(false)
-resource(18) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(6)
bool(false)
-resource(18) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 4 of Outerloop Iteration 2 --
-- Testing fgetc() : file opened using r+ mode --
string(1) "t"
int(1)
bool(false)
-resource(19) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(2)
bool(false)
-resource(19) of type (stream)
+resource(%d) of type (stream)
string(1) "x"
int(3)
bool(false)
-resource(19) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(4)
bool(false)
-resource(19) of type (stream)
+resource(%d) of type (stream)
string(1) " "
int(5)
bool(false)
-resource(19) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(6)
bool(false)
-resource(19) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 5 of Outerloop Iteration 2 --
-- Testing fgetc() : file opened using r+b mode --
string(1) "t"
int(1)
bool(false)
-resource(20) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(2)
bool(false)
-resource(20) of type (stream)
+resource(%d) of type (stream)
string(1) "x"
int(3)
bool(false)
-resource(20) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(4)
bool(false)
-resource(20) of type (stream)
+resource(%d) of type (stream)
string(1) " "
int(5)
bool(false)
-resource(20) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(6)
bool(false)
-resource(20) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 6 of Outerloop Iteration 2 --
-- Testing fgetc() : file opened using r+t mode --
string(1) "t"
int(1)
bool(false)
-resource(21) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(2)
bool(false)
-resource(21) of type (stream)
+resource(%d) of type (stream)
string(1) "x"
int(3)
bool(false)
-resource(21) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(4)
bool(false)
-resource(21) of type (stream)
+resource(%d) of type (stream)
string(1) " "
int(5)
bool(false)
-resource(21) of type (stream)
+resource(%d) of type (stream)
string(1) "t"
int(6)
bool(false)
-resource(21) of type (stream)
+resource(%d) of type (stream)
--- Outerloop iteration 3 ---
-- Innerloop iteration 1 of Outerloop Iteration 3 --
-- Testing fgetc() : file opened using r mode --
string(1) "l"
int(1)
bool(false)
-resource(24) of type (stream)
+resource(%d) of type (stream)
string(1) "i"
int(2)
bool(false)
-resource(24) of type (stream)
+resource(%d) of type (stream)
string(1) "n"
int(3)
bool(false)
-resource(24) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(4)
bool(false)
-resource(24) of type (stream)
+resource(%d) of type (stream)
string(1) "
"
int(5)
bool(false)
-resource(24) of type (stream)
+resource(%d) of type (stream)
string(1) "l"
int(6)
bool(false)
-resource(24) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 2 of Outerloop Iteration 3 --
-- Testing fgetc() : file opened using rb mode --
string(1) "l"
int(1)
bool(false)
-resource(25) of type (stream)
+resource(%d) of type (stream)
string(1) "i"
int(2)
bool(false)
-resource(25) of type (stream)
+resource(%d) of type (stream)
string(1) "n"
int(3)
bool(false)
-resource(25) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(4)
bool(false)
-resource(25) of type (stream)
+resource(%d) of type (stream)
string(1) "
"
int(5)
bool(false)
-resource(25) of type (stream)
+resource(%d) of type (stream)
string(1) "l"
int(6)
bool(false)
-resource(25) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 3 of Outerloop Iteration 3 --
-- Testing fgetc() : file opened using rt mode --
string(1) "l"
int(1)
bool(false)
-resource(26) of type (stream)
+resource(%d) of type (stream)
string(1) "i"
int(2)
bool(false)
-resource(26) of type (stream)
+resource(%d) of type (stream)
string(1) "n"
int(3)
bool(false)
-resource(26) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(4)
bool(false)
-resource(26) of type (stream)
+resource(%d) of type (stream)
string(1) "
"
int(5)
bool(false)
-resource(26) of type (stream)
+resource(%d) of type (stream)
string(1) "l"
int(6)
bool(false)
-resource(26) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 4 of Outerloop Iteration 3 --
-- Testing fgetc() : file opened using r+ mode --
string(1) "l"
int(1)
bool(false)
-resource(27) of type (stream)
+resource(%d) of type (stream)
string(1) "i"
int(2)
bool(false)
-resource(27) of type (stream)
+resource(%d) of type (stream)
string(1) "n"
int(3)
bool(false)
-resource(27) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(4)
bool(false)
-resource(27) of type (stream)
+resource(%d) of type (stream)
string(1) "
"
int(5)
bool(false)
-resource(27) of type (stream)
+resource(%d) of type (stream)
string(1) "l"
int(6)
bool(false)
-resource(27) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 5 of Outerloop Iteration 3 --
-- Testing fgetc() : file opened using r+b mode --
string(1) "l"
int(1)
bool(false)
-resource(28) of type (stream)
+resource(%d) of type (stream)
string(1) "i"
int(2)
bool(false)
-resource(28) of type (stream)
+resource(%d) of type (stream)
string(1) "n"
int(3)
bool(false)
-resource(28) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(4)
bool(false)
-resource(28) of type (stream)
+resource(%d) of type (stream)
string(1) "
"
int(5)
bool(false)
-resource(28) of type (stream)
+resource(%d) of type (stream)
string(1) "l"
int(6)
bool(false)
-resource(28) of type (stream)
+resource(%d) of type (stream)
-- Innerloop iteration 6 of Outerloop Iteration 3 --
-- Testing fgetc() : file opened using r+t mode --
string(1) "l"
int(1)
bool(false)
-resource(29) of type (stream)
+resource(%d) of type (stream)
string(1) "i"
int(2)
bool(false)
-resource(29) of type (stream)
+resource(%d) of type (stream)
string(1) "n"
int(3)
bool(false)
-resource(29) of type (stream)
+resource(%d) of type (stream)
string(1) "e"
int(4)
bool(false)
-resource(29) of type (stream)
+resource(%d) of type (stream)
string(1) "
"
int(5)
bool(false)
-resource(29) of type (stream)
+resource(%d) of type (stream)
string(1) "l"
int(6)
bool(false)
-resource(29) of type (stream)
+resource(%d) of type (stream)
Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt
index d733c2909..e7f22b304 100644
--- a/ext/standard/tests/file/fgetc_variation2.phpt
+++ b/ext/standard/tests/file/fgetc_variation2.phpt
@@ -41,20 +41,7 @@ echo "Done";
*** Testing fgetc() : usage variations ***
-- Testing fgetc() with closed handle --
-Warning: fgetc(): 6 is not a valid stream resource in %s on line %d
-bool(false)
--- Testing fgetc() with unset handle --
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d
-bool(false)
-Done
---UEXPECTF--
-*** Testing fgetc() : usage variations ***
--- Testing fgetc() with closed handle --
-
-Warning: fgetc(): 6 is not a valid stream resource in %s on line %d
+Warning: fgetc(): %d is not a valid stream resource in %s on line %d
bool(false)
-- Testing fgetc() with unset handle --
diff --git a/ext/standard/tests/file/fopen_variation1.phpt b/ext/standard/tests/file/fopen_variation1.phpt
new file mode 100644
index 000000000..53f635b6e
--- /dev/null
+++ b/ext/standard/tests/file/fopen_variation1.phpt
@@ -0,0 +1,14 @@
+--TEST--
+fopen() with relative path on a file in the script directory
+--FILE--
+<?php
+
+$file = basename(__FILE__);
+
+$fd = fopen($file, "r", true);
+var_dump($fd);
+fclose($fd);
+
+?>
+--EXPECTF--
+resource(%d) of type (stream)
diff --git a/ext/standard/tests/file/fread_socket_variation1.phpt b/ext/standard/tests/file/fread_socket_variation1.phpt
new file mode 100644
index 000000000..bd3d23ac5
--- /dev/null
+++ b/ext/standard/tests/file/fread_socket_variation1.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Testing fread() on a TCP server socket
+--FILE--
+<?php
+
+$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
+
+socket_set_timeout($tcp_socket, 1);
+
+var_dump(fread($tcp_socket, 1));
+
+fclose($tcp_socket);
+
+?>
+--EXPECT--
+string(0) ""
diff --git a/ext/standard/tests/file/fseek_dir_basic.phpt b/ext/standard/tests/file/fseek_dir_basic.phpt
new file mode 100644
index 000000000..c6d0816e9
--- /dev/null
+++ b/ext/standard/tests/file/fseek_dir_basic.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Testing fseek() on a directory stream
+--FILE--
+<?php
+
+// include the file.inc for Function: function create_files()
+require(dirname(__FILE__) . '/file.inc');
+
+$path = dirname(__FILE__) . '/fseek_dir_basic';
+mkdir($path);
+create_files($path, 3);
+
+echo "call readdir():\n";
+var_dump($dh = opendir($path));
+$files = array();
+while( FALSE !== ($files[] = readdir($dh)) ) {}
+sort($files);
+var_dump($files);
+$files = array();
+
+echo "\ncall fseek() on directory resource:\n";
+var_dump(fseek($dh, 20));
+
+echo "call readdir():\n";
+while( FALSE !== ($files[] = readdir($dh)) ) {}
+sort($files);
+var_dump($files);
+$files = array();
+
+echo "\ncall fseek() with different arguments on directory resource:\n";
+var_dump(fseek($dh, 20, SEEK_END));
+
+echo "call readdir():\n";
+while( FALSE !== ($files[] = readdir($dh)) ) {}
+sort($files);
+var_dump($files);
+
+delete_files($path, 3);
+closedir($dh);
+var_dump(rmdir($path));
+
+?>
+--EXPECTF--
+call readdir():
+resource(12) of type (stream)
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "."
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(9) "file1.tmp"
+ [4]=>
+ string(9) "file2.tmp"
+ [5]=>
+ string(9) "file3.tmp"
+}
+
+call fseek() on directory resource:
+int(0)
+call readdir():
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "."
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(9) "file1.tmp"
+ [4]=>
+ string(9) "file2.tmp"
+ [5]=>
+ string(9) "file3.tmp"
+}
+
+call fseek() with different arguments on directory resource:
+int(0)
+call readdir():
+array(6) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "."
+ [2]=>
+ string(2) ".."
+ [3]=>
+ string(9) "file1.tmp"
+ [4]=>
+ string(9) "file2.tmp"
+ [5]=>
+ string(9) "file3.tmp"
+}
+bool(true)
diff --git a/ext/standard/tests/file/glob_variation2.phpt b/ext/standard/tests/file/glob_variation2.phpt
new file mode 100644
index 000000000..f95fd17e7
--- /dev/null
+++ b/ext/standard/tests/file/glob_variation2.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test glob() function with relative path
+--FILE--
+<?php
+/* Prototype: array glob ( string $pattern [, int $flags] );
+ Description: Find pathnames matching a pattern
+*/
+
+$file_path = dirname(__FILE__);
+
+// temp dirname used here
+$dir_name = 'glob_test';
+
+// create temp directory
+mkdir("$file_path/$dir_name");
+
+// create temp file
+$fp = fopen("$file_path/$dir_name/file.text", "w");
+fclose($fp);
+
+echo "Testing glob() with relative paths:\n";
+
+chdir("$file_path/$dir_name");
+var_dump( glob("./*") );
+var_dump( glob("../$dir_name/*"));
+
+chdir("$file_path");
+var_dump( glob("$dir_name/*"));
+var_dump( glob("$dir_name"));
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink("$file_path/glob_test/file.text");
+rmdir("$file_path/glob_test/");
+?>
+--EXPECT--
+Testing glob() with relative paths:
+array(1) {
+ [0]=>
+ string(11) "./file.text"
+}
+array(1) {
+ [0]=>
+ string(22) "../glob_test/file.text"
+}
+array(1) {
+ [0]=>
+ string(19) "glob_test/file.text"
+}
+array(1) {
+ [0]=>
+ string(9) "glob_test"
+}
+Done
diff --git a/ext/standard/tests/file/is_dir_variation2.phpt b/ext/standard/tests/file/is_dir_variation2.phpt
index df2464d3c..70fe94e44 100644
--- a/ext/standard/tests/file/is_dir_variation2.phpt
+++ b/ext/standard/tests/file/is_dir_variation2.phpt
@@ -70,7 +70,7 @@ bool(true)
-- With symlink --
bool(true)
-- With hardlink --
-Warning: link(): Operation not permitted in %s on line %d
+Warning: link(): %s in %s on line %d
bool(false)
*** Testing is_dir() with file and links to a file ***
diff --git a/ext/standard/tests/file/open_basedir.inc b/ext/standard/tests/file/open_basedir.inc
new file mode 100644
index 000000000..7fd0afc8b
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir.inc
@@ -0,0 +1,133 @@
+<?php
+
+// This file contains helper functions for testing open_basedir configuration
+// Care must be taken with where the directories are created because different
+// SAPIs set the working directory differently. So simply creating a directory
+// relative to the current working directory like this: mkdir("blah") might
+// actually create it in several different places depending on the SAPI..!
+//
+// Note also depending on the version of php being tested, so the open_basedir
+// configuration may or may not be changeable from a script (PHP_INI_SYSTEM).
+//
+// For this reason we set the open_basedir to . (current directory) and then
+// move around to various directories for testing using chdir(). This is NOT
+// recommended for production use as . bypasses all semblence of security..!
+//
+// Although safe mode has been removed in php 6.0, open_basedir is still valid.
+// See http://www.php.net/features.safe-mode for more information
+
+function recursive_delete_directory($directory) {
+
+ // Remove any trailing slash first
+ if (substr($directory, -1) == '/') {
+ $directory = substr($directory, 0, -1);
+ }
+
+ // Make sure the directory is valid
+ if (is_dir($directory) == FALSE) {
+ return FALSE;
+ }
+
+ // Check we can access the directory
+ if (is_readable($directory) == FALSE) {
+ return FALSE;
+ }
+
+ $handle = opendir($directory);
+
+ // Scan through the directory contents
+ while (FALSE !== ($item = readdir($handle))) {
+ if ($item != '.') {
+ if ($item != '..') {
+ $path = ($directory.'/'.$item);
+ if (is_dir($path) == TRUE) {
+ recursive_delete_directory($path);
+ } else {
+ @chmod($path, 0777);
+ unlink($path);
+ }
+ }
+ }
+ }
+
+ closedir($handle);
+ @chmod($directory, 0777);
+ rmdir($directory);
+
+ return TRUE;
+}
+
+function create_directories() {
+ delete_directories();
+ $directory = dirname(__FILE__);
+
+ var_dump(mkdir($directory."/test"));
+ var_dump(mkdir($directory."/test/ok"));
+ var_dump(mkdir($directory."/test/bad"));
+ file_put_contents($directory."/test/ok/ok.txt", "Hello World!");
+ file_put_contents($directory."/test/bad/bad.txt", "Hello World!");
+}
+
+function delete_directories() {
+ $directory = (dirname(__FILE__)."/test");
+ recursive_delete_directory($directory);
+}
+
+function test_open_basedir_error($function) {
+ var_dump($function("../bad"));
+ var_dump($function("../bad/bad.txt"));
+ var_dump($function(".."));
+ var_dump($function("../"));
+ var_dump($function("/"));
+ var_dump($function("../bad/."));
+ $directory = dirname(__FILE__);
+ var_dump($function($directory."/test/bad/bad.txt"));
+ var_dump($function($directory."/test/bad/../bad/bad.txt"));
+}
+
+function test_open_basedir_before($function, $change = TRUE) {
+ echo "*** Testing open_basedir configuration [$function] ***\n";
+ $directory = dirname(__FILE__);
+ var_dump(chdir($directory));
+ create_directories();
+
+ // Optionally change directory
+ if ($change == TRUE) {
+ var_dump(chdir($directory."/test/ok"));
+ }
+}
+
+// Delete directories using a --CLEAN-- section!
+function test_open_basedir_after($function) {
+ echo "*** Finished testing open_basedir configuration [$function] ***\n";
+}
+
+// This is used by functions that return an array on success
+function test_open_basedir_array($function) {
+ test_open_basedir_before($function);
+ test_open_basedir_error($function);
+ var_dump(is_array($function("./../.")));
+ var_dump(is_array($function("../ok")));
+ var_dump(is_array($function("ok.txt")));
+ var_dump(is_array($function("../ok/ok.txt")));
+ $directory = dirname(__FILE__);
+ var_dump(is_array($function($directory."/test/ok/ok.txt")));
+ var_dump(is_array($function($directory."/test/ok/../ok/ok.txt")));
+ test_open_basedir_after($function);
+}
+
+function test_open_basedir($function) {
+ test_open_basedir_before($function);
+ test_open_basedir_error($function);
+ var_dump($function("./../."));
+ var_dump($function("../ok"));
+ var_dump($function("ok.txt"));
+ var_dump($function("../ok/ok.txt"));
+ $directory = dirname(__FILE__);
+ var_dump($function($directory."/test/ok/ok.txt"));
+ var_dump($function($directory."/test/ok/../ok/ok.txt"));
+ test_open_basedir_after($function);
+}
+
+?>
+
diff --git a/ext/standard/tests/file/open_basedir_chdir.phpt b/ext/standard/tests/file/open_basedir_chdir.phpt
new file mode 100644
index 000000000..32ed4eb1e
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_chdir.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("chdir");
+$directory = dirname(__FILE__);
+
+var_dump(chdir("../bad"));
+var_dump(chdir(".."));
+var_dump(chdir("../"));
+var_dump(chdir("/"));
+var_dump(chdir("../bad/."));
+var_dump(chdir("./../."));
+
+test_open_basedir_after("chdir");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [chdir] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: chdir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chdir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chdir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chdir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chdir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chdir(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [chdir] ***
+
diff --git a/ext/standard/tests/file/open_basedir_chmod.phpt b/ext/standard/tests/file/open_basedir_chmod.phpt
new file mode 100644
index 000000000..02fdce5a1
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_chmod.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("chmod");
+$directory = dirname(__FILE__);
+
+var_dump(chmod("../bad", 0600));
+var_dump(chmod("../bad/bad.txt", 0600));
+var_dump(chmod("..", 0600));
+var_dump(chmod("../", 0600));
+var_dump(chmod("/", 0600));
+var_dump(chmod("../bad/.", 0600));
+var_dump(chmod("../bad/./bad.txt", 0600));
+var_dump(chmod("./../.", 0600));
+
+var_dump(chmod($directory."/test/ok/ok.txt", 0600));
+var_dump(chmod("./ok.txt", 0600));
+var_dump(chmod("ok.txt", 0600));
+var_dump(chmod("../ok/ok.txt", 0600));
+var_dump(chmod("../ok/./ok.txt", 0600));
+chmod($directory."/test/ok/ok.txt", 0777);
+
+test_open_basedir_after("chmod");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [chmod] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: chmod(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chmod(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chmod(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chmod(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chmod(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chmod(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chmod(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: chmod(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [chmod] ***
+
diff --git a/ext/standard/tests/file/open_basedir_copy.phpt b/ext/standard/tests/file/open_basedir_copy.phpt
new file mode 100644
index 000000000..8f0f7a91f
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_copy.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("copy");
+$directory = dirname(__FILE__);
+
+var_dump(copy("ok.txt", "../bad"));
+var_dump(copy("ok.txt", "../bad/bad.txt"));
+var_dump(copy("ok.txt", ".."));
+var_dump(copy("ok.txt", "../"));
+var_dump(copy("ok.txt", "/"));
+var_dump(copy("ok.txt", "../bad/."));
+var_dump(copy("ok.txt", "../bad/./bad.txt"));
+var_dump(copy("ok.txt", "./../."));
+
+var_dump(copy("ok.txt", "copy.txt"));
+var_dump(unlink("copy.txt"));
+test_open_basedir_after("copy");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [copy] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: copy(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(../bad): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: copy(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: copy(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(..): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: copy(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(../): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: copy(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(/): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: copy(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(../bad/.): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: copy(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(../bad/./bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: copy(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: copy(./../.): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [copy] ***
+
diff --git a/ext/standard/tests/file/open_basedir_copy_variation1.phpt b/ext/standard/tests/file/open_basedir_copy_variation1.phpt
new file mode 100644
index 000000000..de532e12c
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_copy_variation1.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("copy");
+$directory = dirname(__FILE__);
+
+var_dump(copy("../bad/bad.txt", "copy.txt"));
+var_dump(unlink("copy.txt"));
+
+test_open_basedir_after("copy");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [copy] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: copy(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: unlink(copy.txt): No such file or directory in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [copy] ***
+
diff --git a/ext/standard/tests/file/open_basedir_disk_free_space.phpt b/ext/standard/tests/file/open_basedir_disk_free_space.phpt
new file mode 100644
index 000000000..e3e36e670
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_disk_free_space.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+
+test_open_basedir_before("disk_free_space");
+test_open_basedir_error("disk_free_space");
+$directory = dirname(__FILE__);
+var_dump(disk_free_space($directory."/test/ok"));
+test_open_basedir_after("disk_free_space");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [disk_free_space] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: disk_free_space(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+float(%s)
+*** Finished testing open_basedir configuration [disk_free_space] ***
diff --git a/ext/standard/tests/file/open_basedir_file.phpt b/ext/standard/tests/file/open_basedir_file.phpt
new file mode 100644
index 000000000..fbc841e3f
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_file.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+$directory = dirname(__FILE__);
+test_open_basedir_before("file");
+test_open_basedir_error("file");
+
+var_dump(file("ok.txt"));
+var_dump(file("../ok/ok.txt"));
+var_dump(file($directory."/test/ok/ok.txt"));
+var_dump(file($directory."/test/ok/../ok/ok.txt"));
+
+test_open_basedir_after("file");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [file] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: file(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(../bad): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(..): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(../): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(/): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(../bad/.): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(%s/test/bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file(%s/test/bad/../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+array(1) {
+ [0]=>
+ string(12) "Hello World!"
+}
+array(1) {
+ [0]=>
+ string(12) "Hello World!"
+}
+array(1) {
+ [0]=>
+ string(12) "Hello World!"
+}
+array(1) {
+ [0]=>
+ string(12) "Hello World!"
+}
+*** Finished testing open_basedir configuration [file] ***
+
diff --git a/ext/standard/tests/file/open_basedir_file_exists.phpt b/ext/standard/tests/file/open_basedir_file_exists.phpt
new file mode 100644
index 000000000..c249fc116
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_file_exists.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("file_exists");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [file_exists] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: file_exists(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: file_exists(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [file_exists] ***
+
diff --git a/ext/standard/tests/file/open_basedir_file_get_contents.phpt b/ext/standard/tests/file/open_basedir_file_get_contents.phpt
new file mode 100644
index 000000000..637c499ea
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_file_get_contents.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+$directory = dirname(__FILE__);
+test_open_basedir_before("file_get_contents");
+test_open_basedir_error("file_get_contents");
+
+var_dump(file_get_contents("ok.txt"));
+var_dump(file_get_contents("../ok/ok.txt"));
+var_dump(file_get_contents($directory."/test/ok/ok.txt"));
+var_dump(file_get_contents($directory."/test/ok/../ok/ok.txt"));
+
+test_open_basedir_after("file_get_contents");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [file_get_contents] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(../bad): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(..): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(../): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(/): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(../bad/.): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(%s/test/bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_get_contents(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_get_contents(%s/test/bad/../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+string(12) "Hello World!"
+string(12) "Hello World!"
+string(12) "Hello World!"
+string(12) "Hello World!"
+*** Finished testing open_basedir configuration [file_get_contents] ***
diff --git a/ext/standard/tests/file/open_basedir_file_put_contents.phpt b/ext/standard/tests/file/open_basedir_file_put_contents.phpt
new file mode 100644
index 000000000..d4bd417b5
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_file_put_contents.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("file_put_contents");
+$directory = dirname(__FILE__);
+
+var_dump(file_put_contents("../bad/bad.txt", "Hello World!"));
+var_dump(file_put_contents(".././bad/bad.txt", "Hello World!"));
+var_dump(file_put_contents("../bad/../bad/bad.txt", "Hello World!"));
+var_dump(file_put_contents("./.././bad/bad.txt", "Hello World!"));
+var_dump(file_put_contents($directory."/test/bad/bad.txt", "Hello World!"));
+
+test_open_basedir_after("file_put_contents");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [file_put_contents] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: file_put_contents(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_put_contents(../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_put_contents(): open_basedir restriction in effect. File(.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_put_contents(.././bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_put_contents(): open_basedir restriction in effect. File(../bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_put_contents(../bad/../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_put_contents(): open_basedir restriction in effect. File(./.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_put_contents(./.././bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: file_put_contents(): open_basedir restriction in effect. File%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: file_put_contents%s/test/bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [file_put_contents] ***
+
diff --git a/ext/standard/tests/file/open_basedir_fileatime.phpt b/ext/standard/tests/file/open_basedir_fileatime.phpt
new file mode 100644
index 000000000..02cc94f83
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_fileatime.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("fileatime");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [fileatime] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fileatime(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileatime(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [fileatime] ***
+
diff --git a/ext/standard/tests/file/open_basedir_filectime.phpt b/ext/standard/tests/file/open_basedir_filectime.phpt
new file mode 100644
index 000000000..542c8423e
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_filectime.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("filectime");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [filectime] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: filectime(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filectime(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [filectime] ***
+
diff --git a/ext/standard/tests/file/open_basedir_filegroup.phpt b/ext/standard/tests/file/open_basedir_filegroup.phpt
new file mode 100644
index 000000000..5f6279aa8
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_filegroup.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("filegroup");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [filegroup] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: filegroup(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filegroup(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [filegroup] ***
+
diff --git a/ext/standard/tests/file/open_basedir_fileinode.phpt b/ext/standard/tests/file/open_basedir_fileinode.phpt
new file mode 100644
index 000000000..070c2c806
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_fileinode.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("fileinode");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [fileinode] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fileinode(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileinode(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [fileinode] ***
+
diff --git a/ext/standard/tests/file/open_basedir_filemtime.phpt b/ext/standard/tests/file/open_basedir_filemtime.phpt
new file mode 100644
index 000000000..7213ddb5b
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_filemtime.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("filemtime");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [filemtime] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: filemtime(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filemtime(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [filemtime] ***
+
diff --git a/ext/standard/tests/file/open_basedir_fileowner.phpt b/ext/standard/tests/file/open_basedir_fileowner.phpt
new file mode 100644
index 000000000..b363b7e0e
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_fileowner.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("fileowner");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [fileowner] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fileowner(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileowner(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [fileowner] ***
+
diff --git a/ext/standard/tests/file/open_basedir_fileperms.phpt b/ext/standard/tests/file/open_basedir_fileperms.phpt
new file mode 100644
index 000000000..a1e6511b0
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_fileperms.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("fileperms");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [fileperms] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fileperms(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: fileperms(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [fileperms] ***
+
diff --git a/ext/standard/tests/file/open_basedir_filesize.phpt b/ext/standard/tests/file/open_basedir_filesize.phpt
new file mode 100644
index 000000000..a335dfd17
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_filesize.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("filesize");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [filesize] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: filesize(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filesize(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+*** Finished testing open_basedir configuration [filesize] ***
+
diff --git a/ext/standard/tests/file/open_basedir_filetype.phpt b/ext/standard/tests/file/open_basedir_filetype.phpt
new file mode 100644
index 000000000..5091db56f
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_filetype.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("filetype");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [filetype] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: filetype(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: filetype(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+string(3) "dir"
+string(4) "file"
+string(4) "file"
+string(4) "file"
+string(4) "file"
+*** Finished testing open_basedir configuration [filetype] ***
+
diff --git a/ext/standard/tests/file/open_basedir_fopen.phpt b/ext/standard/tests/file/open_basedir_fopen.phpt
new file mode 100644
index 000000000..c6c9a253f
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_fopen.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("fopen");
+$directory = dirname(__FILE__);
+
+var_dump(fopen("../bad", "r"));
+var_dump(fopen("../bad/bad.txt", "r"));
+var_dump(fopen("..", "r"));
+var_dump(fopen("../", "r"));
+var_dump(fopen("/", "r"));
+var_dump(fopen("../bad/.", "r"));
+var_dump(fopen("../bad/./bad.txt", "r"));
+var_dump(fopen("./../.", "r"));
+
+var_dump(fopen($directory."/test/ok/ok.txt", "r"));
+var_dump(fopen("./ok.txt", "r"));
+var_dump(fopen("ok.txt", "r"));
+var_dump(fopen("../ok/ok.txt", "r"));
+var_dump(fopen("../ok/./ok.txt", "r"));
+
+test_open_basedir_after("fopen");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [fopen] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: fopen(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(../bad): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: fopen(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: fopen(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(..): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: fopen(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(../): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: fopen(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(/): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: fopen(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(../bad/.): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+
+Warning: fopen(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(../bad/./bad.txt): failed to open stream: Operation not permitted in %s on line 12
+bool(false)
+
+Warning: fopen(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: fopen(./../.): failed to open stream: Operation not permitted in %s on line %d
+bool(false)
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+*** Finished testing open_basedir configuration [fopen] ***
+
diff --git a/ext/standard/tests/file/open_basedir_glob-win32.phpt b/ext/standard/tests/file/open_basedir_glob-win32.phpt
new file mode 100644
index 000000000..3fa19afa3
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_glob-win32.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only variation');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("glob");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [glob] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+array(0) {
+}
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+array(1) {
+ [0]=>
+ string(5) "../ok"
+}
+array(1) {
+ [0]=>
+ string(6) "ok.txt"
+}
+array(1) {
+ [0]=>
+ string(12) "../ok/ok.txt"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/test/ok/ok.txt"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/test/ok/../ok/ok.txt"
+}
+*** Finished testing open_basedir configuration [glob] ***
+
diff --git a/ext/standard/tests/file/open_basedir_glob.phpt b/ext/standard/tests/file/open_basedir_glob.phpt
new file mode 100644
index 000000000..591cd8f4f
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_glob.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not for Windows variation');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("glob");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [glob] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+array(1) {
+ [0]=>
+ string(5) "../ok"
+}
+array(1) {
+ [0]=>
+ string(6) "ok.txt"
+}
+array(1) {
+ [0]=>
+ string(12) "../ok/ok.txt"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/test/ok/ok.txt"
+}
+array(1) {
+ [0]=>
+ string(%d) "%s/test/ok/../ok/ok.txt"
+}
+*** Finished testing open_basedir configuration [glob] ***
+
diff --git a/ext/standard/tests/file/open_basedir_is_dir.phpt b/ext/standard/tests/file/open_basedir_is_dir.phpt
new file mode 100644
index 000000000..e4ad620d7
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_is_dir.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("is_dir");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [is_dir] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: is_dir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_dir(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+*** Finished testing open_basedir configuration [is_dir] ***
+
diff --git a/ext/standard/tests/file/open_basedir_is_executable.phpt b/ext/standard/tests/file/open_basedir_is_executable.phpt
new file mode 100644
index 000000000..1bab86055
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_is_executable.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("is_executable");
+test_open_basedir_error("is_executable");
+
+var_dump(is_executable("ok.txt"));
+var_dump(is_executable("../ok/ok.txt"));
+$directory = dirname(__FILE__);
+var_dump(is_executable($directory."/test/ok/ok.txt"));
+var_dump(is_executable($directory."/test/ok/../ok/ok.txt"));
+
+test_open_basedir_after("is_executable");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [is_executable] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: is_executable(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_executable(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_executable(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_executable(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_executable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_executable(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_executable(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_executable(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+*** Finished testing open_basedir configuration [is_executable] ***
diff --git a/ext/standard/tests/file/open_basedir_is_file.phpt b/ext/standard/tests/file/open_basedir_is_file.phpt
new file mode 100644
index 000000000..51ef0a2d1
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_is_file.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("is_file");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [is_file] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: is_file(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_file(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [is_file] ***
+
diff --git a/ext/standard/tests/file/open_basedir_is_link.phpt b/ext/standard/tests/file/open_basedir_is_link.phpt
new file mode 100644
index 000000000..5d12148d8
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_is_link.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("is_link");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [is_link] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: is_link(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_link(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+*** Finished testing open_basedir configuration [is_link] ***
+
diff --git a/ext/standard/tests/file/open_basedir_is_readable.phpt b/ext/standard/tests/file/open_basedir_is_readable.phpt
new file mode 100644
index 000000000..951a19ac7
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_is_readable.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("is_readable");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [is_readable] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: is_readable(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_readable(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [is_readable] ***
+
diff --git a/ext/standard/tests/file/open_basedir_is_writable.phpt b/ext/standard/tests/file/open_basedir_is_writable.phpt
new file mode 100644
index 000000000..25ce1c63a
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_is_writable.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("is_writable");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [is_writable] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: is_writable(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: is_writable(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [is_writable] ***
+
diff --git a/ext/standard/tests/file/open_basedir_link.phpt b/ext/standard/tests/file/open_basedir_link.phpt
new file mode 100644
index 000000000..a54c22f4b
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_link.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no links on Windows');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("link");
+$directory = dirname(__FILE__);
+
+$target = ($directory."/test/ok/ok.txt");
+var_dump(link($target, "../bad/link.txt"));
+var_dump(link($target, "../link.txt"));
+var_dump(link($target, "../bad/./link.txt"));
+var_dump(link($target, "./.././link.txt"));
+
+$link = ($directory."/test/ok/link.txt");
+var_dump(link("../bad/bad.txt", $link));
+var_dump(link("../bad", $link));
+var_dump(link("../bad/./bad.txt", $link));
+var_dump(link("../bad/bad.txt", $link));
+var_dump(link("./.././bad", $link));
+
+$target = ($directory."/test/ok/ok.txt");
+
+var_dump(link($target, $link));
+var_dump(unlink($link));
+test_open_basedir_after("link");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [link] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/bad/link.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/link.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/bad/link.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/link.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: link(): open_basedir restriction in effect. File(%s/test/bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [link] ***
+
diff --git a/ext/standard/tests/file/open_basedir_linkinfo.phpt b/ext/standard/tests/file/open_basedir_linkinfo.phpt
new file mode 100644
index 000000000..ab12a5149
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_linkinfo.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("linkinfo", FALSE);
+$directory = dirname(__FILE__);
+
+chdir($directory);
+
+$target = ($directory."/test/bad/bad.txt");
+$symlink = ($directory."/test/ok/symlink.txt");
+var_dump(symlink($target, $symlink));
+
+chdir($directory."/test/ok");
+
+var_dump(linkinfo("symlink.txt"));
+var_dump(linkinfo("../ok/symlink.txt"));
+var_dump(linkinfo("../ok/./symlink.txt"));
+var_dump(linkinfo("./symlink.txt"));
+var_dump(linkinfo($directory."/test/ok/symlink.txt"));
+
+$target = ($directory."/test/ok/ok.txt");
+$symlink = ($directory."/test/ok/symlink.txt");
+var_dump(symlink($target, $symlink));
+var_dump(linkinfo($symlink));
+var_dump(unlink($symlink));
+
+test_open_basedir_after("linkinfo");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [linkinfo] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+int(%d)
+
+Warning: unlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [linkinfo] ***
+
diff --git a/ext/standard/tests/file/open_basedir_lstat.phpt b/ext/standard/tests/file/open_basedir_lstat.phpt
new file mode 100644
index 000000000..35e5a2201
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_lstat.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_array("lstat");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [lstat] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: lstat(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: lstat(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [lstat] ***
+
diff --git a/ext/standard/tests/file/open_basedir_mkdir.phpt b/ext/standard/tests/file/open_basedir_mkdir.phpt
new file mode 100644
index 000000000..253818ccf
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_mkdir.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip Windows only variation');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("mkdir");
+$directory = dirname(__FILE__);
+
+var_dump(mkdir("../bad/blah"));
+var_dump(mkdir("../blah"));
+var_dump(mkdir("../bad/./blah"));
+var_dump(mkdir("./.././blah"));
+
+var_dump(mkdir($directory."/test/ok/blah"));
+var_dump(rmdir($directory."/test/ok/blah"));
+test_open_basedir_after("mkdir");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [mkdir] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: mkdir(): open_basedir restriction in effect. File(../bad/blah) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: mkdir(): open_basedir restriction in effect. File(../blah) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: mkdir(): open_basedir restriction in effect. File(../bad/./blah) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: mkdir(): open_basedir restriction in effect. File(./.././blah) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [mkdir] ***
diff --git a/ext/standard/tests/file/open_basedir_parse_ini_file.phpt b/ext/standard/tests/file/open_basedir_parse_ini_file.phpt
new file mode 100644
index 000000000..dadddac98
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_parse_ini_file.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("parse_ini_file");
+$directory = dirname(__FILE__);
+
+var_dump(parse_ini_file("../bad"));
+var_dump(parse_ini_file("../bad/bad.txt"));
+var_dump(parse_ini_file(".."));
+var_dump(parse_ini_file("../"));
+var_dump(parse_ini_file("../bad/."));
+var_dump(parse_ini_file("../bad/./bad.txt"));
+var_dump(parse_ini_file("./../."));
+
+test_open_basedir_after("parse_ini_file");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [parse_ini_file] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: parse_ini_file(../bad): failed to open stream: Operation not permitted in %s on line %d
+array(0) {
+}
+
+Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: parse_ini_file(../bad/bad.txt): failed to open stream: Operation not permitted in %s on line %d
+array(0) {
+}
+
+Warning: parse_ini_file(..): failed to open stream: Operation not permitted in %s on line %d
+array(0) {
+}
+
+Warning: parse_ini_file(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: parse_ini_file(../): failed to open stream: Operation not permitted in %s on line %d
+array(0) {
+}
+
+Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: parse_ini_file(../bad/.): failed to open stream: Operation not permitted in %s on line %d
+array(0) {
+}
+
+Warning: parse_ini_file(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: parse_ini_file(../bad/./bad.txt): failed to open stream: Operation not permitted in %s on line %d
+array(0) {
+}
+
+Warning: parse_ini_file(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+
+Warning: parse_ini_file(./../.): failed to open stream: Operation not permitted in %s on line %d
+array(0) {
+}
+*** Finished testing open_basedir configuration [parse_ini_file] ***
+
diff --git a/ext/standard/tests/file/open_basedir_readlink.phpt b/ext/standard/tests/file/open_basedir_readlink.phpt
new file mode 100644
index 000000000..cbba4307e
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_readlink.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("readlink", FALSE);
+$directory = dirname(__FILE__);
+
+chdir($directory);
+
+$target = ($directory."/test/bad/bad.txt");
+$symlink = ($directory."/test/ok/symlink.txt");
+var_dump(symlink($target, $symlink));
+
+chdir($directory."/test/ok");
+
+var_dump(readlink("symlink.txt"));
+var_dump(readlink("../ok/symlink.txt"));
+var_dump(readlink("../ok/./symlink.txt"));
+var_dump(readlink("./symlink.txt"));
+var_dump(readlink($directory."/test/ok/symlink.txt"));
+
+$target = ($directory."/test/ok/ok.txt");
+$symlink = ($directory."/test/ok/symlink.txt");
+var_dump(symlink($target, $symlink));
+var_dump(readlink($symlink));
+var_dump(unlink($symlink));
+
+test_open_basedir_after("readlink");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [readlink] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: readlink(): open_basedir restriction in effect. File(symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: readlink(): open_basedir restriction in effect. File(../ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: readlink(): open_basedir restriction in effect. File(../ok/./symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: readlink(): open_basedir restriction in effect. File(./symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: readlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: readlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: unlink(): open_basedir restriction in effect. File(%s/test/ok/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [readlink] ***
+
diff --git a/ext/standard/tests/file/open_basedir_realpath.phpt b/ext/standard/tests/file/open_basedir_realpath.phpt
new file mode 100644
index 000000000..8cae890e9
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_realpath.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only run on Windows');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir("realpath");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [realpath] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test\bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test\bad\bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test\bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test\bad\bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test\bad\bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: realpath(): open_basedir restriction in effect. File(%s\test) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+string(%d) "%s\test\ok"
+string(%d) "%s\test\ok\ok.txt"
+string(%d) "%s\test\ok\ok.txt"
+string(%d) "%s\test\ok\ok.txt"
+string(%d) "%s\test\ok\ok.txt"
+*** Finished testing open_basedir configuration [realpath] ***
+
diff --git a/ext/standard/tests/file/open_basedir_rename.phpt b/ext/standard/tests/file/open_basedir_rename.phpt
new file mode 100644
index 000000000..428e7a070
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_rename.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("rename");
+$directory = dirname(__FILE__);
+
+var_dump(rename("../bad/bad.txt", "rename.txt"));
+var_dump(rename(".././bad/bad.txt", "rename.txt"));
+var_dump(rename("../bad/../bad/bad.txt", "rename.txt"));
+var_dump(rename("./.././bad/bad.txt", "rename.txt"));
+var_dump(rename($directory."/test/bad/bad.txt", "rename.txt"));
+
+test_open_basedir_after("rename");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [rename] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: rename(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rename(): open_basedir restriction in effect. File(.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rename(): open_basedir restriction in effect. File(../bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rename(): open_basedir restriction in effect. File(./.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rename(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [rename] ***
+
diff --git a/ext/standard/tests/file/open_basedir_rmdir.phpt b/ext/standard/tests/file/open_basedir_rmdir.phpt
new file mode 100644
index 000000000..b4d61f8b7
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_rmdir.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("rmdir");
+$directory = dirname(__FILE__);
+
+var_dump(rmdir("../bad"));
+var_dump(rmdir(".././bad"));
+var_dump(rmdir("../bad/../bad"));
+var_dump(rmdir("./.././bad"));
+var_dump(rmdir($directory."/test/bad"));
+
+test_open_basedir_after("rmdir");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [rmdir] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: rmdir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rmdir(): open_basedir restriction in effect. File(.././bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rmdir(): open_basedir restriction in effect. File(../bad/../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rmdir(): open_basedir restriction in effect. File(./.././bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: rmdir(): open_basedir restriction in effect. File(%s/test/bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [rmdir] ***
+
diff --git a/ext/standard/tests/file/open_basedir_stat.phpt b/ext/standard/tests/file/open_basedir_stat.phpt
new file mode 100644
index 000000000..b80b854d6
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_stat.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_array("stat");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [stat] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: stat(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: stat(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [stat] ***
+
diff --git a/ext/standard/tests/file/open_basedir_symlink.phpt b/ext/standard/tests/file/open_basedir_symlink.phpt
new file mode 100644
index 000000000..3b3f1d571
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_symlink.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test open_basedir configuration
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no symlinks on Windows');
+}
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("symlink");
+$directory = dirname(__FILE__);
+
+$target = ($directory."/test/ok/ok.txt");
+var_dump(symlink($target, "../bad/symlink.txt"));
+var_dump(symlink($target, "../symlink.txt"));
+var_dump(symlink($target, "../bad/./symlink.txt"));
+var_dump(symlink($target, "./.././symlink.txt"));
+
+$symlink = ($directory."/test/ok/symlink.txt");
+var_dump(symlink("../bad/bad.txt", $symlink));
+var_dump(symlink("../bad", $symlink));
+var_dump(symlink("../bad/./bad.txt", $symlink));
+var_dump(symlink("../bad/bad.txt", $symlink));
+var_dump(symlink("./.././bad", $symlink));
+
+$target = ($directory."/test/ok/ok.txt");
+
+var_dump(symlink($target, $symlink));
+var_dump(unlink($symlink));
+test_open_basedir_after("symlink");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [symlink] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/symlink.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: symlink(): open_basedir restriction in effect. File(%s/test/bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [symlink] ***
+
diff --git a/ext/standard/tests/file/open_basedir_tempnam.phpt b/ext/standard/tests/file/open_basedir_tempnam.phpt
new file mode 100644
index 000000000..247ac88d5
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_tempnam.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("tempnam");
+$directory = dirname(__FILE__);
+
+var_dump(tempnam("../bad", "test"));
+var_dump(tempnam("..", "test"));
+var_dump(tempnam("../", "test"));
+var_dump(tempnam("/", "test"));
+var_dump(tempnam("../bad/.", "test"));
+var_dump(tempnam("./../.", "test"));
+
+$file = tempnam($directory."/test/ok", "test");
+var_dump($file);
+var_dump(unlink($file));
+
+test_open_basedir_after("tempnam");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [tempnam] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: tempnam(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: tempnam(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: tempnam(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: tempnam(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: tempnam(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: tempnam(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+string(%d) "%s"
+bool(true)
+*** Finished testing open_basedir configuration [tempnam] ***
+
diff --git a/ext/standard/tests/file/open_basedir_touch.phpt b/ext/standard/tests/file/open_basedir_touch.phpt
new file mode 100644
index 000000000..b0a5aee61
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_touch.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("touch");
+$directory = dirname(__FILE__);
+
+var_dump(touch("../bad"));
+var_dump(touch("../bad/bad.txt"));
+var_dump(touch(".."));
+var_dump(touch("../"));
+var_dump(touch("/"));
+var_dump(touch("../bad/."));
+var_dump(touch("../bad/./bad.txt"));
+var_dump(touch("./../."));
+
+var_dump(touch($directory."/test/ok/ok.txt"));
+var_dump(touch("./ok.txt"));
+var_dump(touch("ok.txt"));
+var_dump(touch("../ok/ok.txt"));
+var_dump(touch("../ok/./ok.txt"));
+
+test_open_basedir_after("touch");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [touch] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: touch(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: touch(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: touch(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: touch(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: touch(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: touch(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: touch(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: touch(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+*** Finished testing open_basedir configuration [touch] ***
+
diff --git a/ext/standard/tests/file/open_basedir_unlink.phpt b/ext/standard/tests/file/open_basedir_unlink.phpt
new file mode 100644
index 000000000..75b0f3f4a
--- /dev/null
+++ b/ext/standard/tests/file/open_basedir_unlink.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test open_basedir configuration
+--INI--
+open_basedir=.
+--FILE--
+<?php
+require_once "open_basedir.inc";
+test_open_basedir_before("unlink");
+$directory = dirname(__FILE__);
+
+var_dump(unlink("../bad/bad.txt"));
+var_dump(unlink(".././bad/bad.txt"));
+var_dump(unlink("../bad/../bad/bad.txt"));
+var_dump(unlink("./.././bad/bad.txt"));
+var_dump(unlink($directory."/test/bad/bad.txt"));
+
+test_open_basedir_after("unlink");
+?>
+--CLEAN--
+<?php
+require_once "open_basedir.inc";
+delete_directories();
+?>
+--EXPECTF--
+*** Testing open_basedir configuration [unlink] ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+Warning: unlink(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: unlink(): open_basedir restriction in effect. File(.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: unlink(): open_basedir restriction in effect. File(../bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: unlink(): open_basedir restriction in effect. File(./.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+
+Warning: unlink(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
+bool(false)
+*** Finished testing open_basedir configuration [unlink] ***
+
diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt
new file mode 100644
index 000000000..65a6ac1d8
--- /dev/null
+++ b/ext/standard/tests/file/parse_ini_file_error.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test parse_ini_file() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array parse_ini_file(string filename [, bool process_sections])
+ * Description: Parse configuration file
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing parse_ini_file() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing parse_ini_file() function with Zero arguments --\n";
+var_dump( parse_ini_file() );
+
+//Test parse_ini_file with one more than the expected number of arguments
+echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n";
+$filename = 'string_val';
+$process_sections = true;
+$extra_arg = 10;
+var_dump( parse_ini_file($filename, $process_sections, $extra_arg) );
+
+echo "\n-- Testing parse_ini_file() function with a non-existent file --\n";
+$filename = __FILE__ . 'invalidfilename';
+var_dump( parse_ini_file($filename, $process_sections) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_ini_file() : error conditions ***
+
+-- Testing parse_ini_file() function with Zero arguments --
+
+Warning: Wrong parameter count for parse_ini_file() in %s on line %d
+NULL
+
+-- Testing parse_ini_file() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for parse_ini_file() in %s on line %d
+NULL
+
+-- Testing parse_ini_file() function with a non-existent file --
+
+Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/file/realpath_basic2.phpt b/ext/standard/tests/file/realpath_basic2.phpt
new file mode 100644
index 000000000..b71feb98b
--- /dev/null
+++ b/ext/standard/tests/file/realpath_basic2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+realpath() with relative directory
+--FILE--
+<?php
+
+var_dump(realpath('.') == getcwd());
+chdir('..');
+var_dump(realpath('.') == getcwd());
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/file/realpath_basic3.phpt b/ext/standard/tests/file/realpath_basic3.phpt
new file mode 100644
index 000000000..ce9385591
--- /dev/null
+++ b/ext/standard/tests/file/realpath_basic3.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test realpath() with relative paths
+--FILE--
+<?php
+/* Prototype: string realpath ( string $path );
+ Description: Returns canonicalized absolute pathname
+*/
+
+echo "\n*** Testing basic functions of realpath() with files ***\n";
+
+/* creating directories and files */
+$file_path = dirname(__FILE__);
+mkdir("$file_path/realpath_basic/home/test/", 0777, true);
+
+$file_handle1 = fopen("$file_path/realpath_basic/home/test/realpath_basic.tmp", "w");
+$file_handle2 = fopen("$file_path/realpath_basic/home/realpath_basic.tmp", "w");
+$file_handle3 = fopen("$file_path/realpath_basic/realpath_basic.tmp", "w");
+fclose($file_handle1);
+fclose($file_handle2);
+fclose($file_handle3);
+
+echo "\n*** Testing realpath() on filenames ***\n";
+$filenames = array (
+ /* filenames resulting in valid paths */
+ "./realpath_basic/home/realpath_basic.tmp",
+ "./realpath_basic/realpath_basic.tmp",
+ "./realpath_basic//home/test//../test/./realpath_basic.tmp",
+ "./realpath_basic/home//../././realpath_basic.tmp",
+
+ /* filenames with invalid path */
+ // checking for binary safe
+ "./realpath_basicx000/home/realpath_basic.tmp",
+
+ ".///realpath_basic/home//..//././test//realpath_basic.tmp",
+ "./realpath_basic/home/../home/../test/..realpath_basic.tmp"
+);
+
+chdir("$file_path/..");
+chdir($file_path);
+
+$counter = 1;
+/* loop through $files to read the filepath of $file in the above array */
+foreach($filenames as $file) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( realpath($file) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$name_prefix = dirname(__FILE__)."/realpath_basic";
+unlink("$name_prefix/home/test/realpath_basic.tmp");
+unlink("$name_prefix/home/realpath_basic.tmp");
+unlink("$name_prefix/realpath_basic.tmp");
+rmdir("$name_prefix/home/test/");
+rmdir("$name_prefix/home/");
+rmdir("$name_prefix/");
+?>
+--EXPECTF--
+*** Testing basic functions of realpath() with files ***
+
+*** Testing realpath() on filenames ***
+
+-- Iteration 1 --
+string(%d) "%srealpath_basic%shome%srealpath_basic.tmp"
+
+-- Iteration 2 --
+string(%d) "%srealpath_basic%srealpath_basic.tmp"
+
+-- Iteration 3 --
+string(%d) "%srealpath_basic%shome%stest%srealpath_basic.tmp"
+
+-- Iteration 4 --
+string(%d) "%srealpath_basic%srealpath_basic.tmp"
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+Done
diff --git a/ext/standard/tests/file/rename_basic.phpt b/ext/standard/tests/file/rename_basic.phpt
index 8a255ca6e..28d3b1988 100755
--- a/ext/standard/tests/file/rename_basic.phpt
+++ b/ext/standard/tests/file/rename_basic.phpt
@@ -6,7 +6,7 @@ Test rename() function: basic functionality
Description: Renames a file or directory
*/
-echo "*** Testing rename() for basic functions on existing file ***\n";
+echo "*** Testing rename() on non-existing file ***\n";
$file_path = dirname(__FILE__);
$src_name = "$file_path/rename_basic.tmp";
$dest_name = "$file_path/rename_basic_new.tmp";
@@ -16,103 +16,30 @@ $fp = fopen($src_name, "w");
$s1 = stat($src_name);
fclose($fp);
-var_dump( rename($src_name, $dest_name) );
-// ensure that $dest_name didn't get created
-var_dump( file_exists($src_name) ); // expecting false
+var_dump( rename($src_name, $dest_name) ); // expecting true
+var_dump( file_exists($src_name) ); // expecting false
var_dump( file_exists($dest_name) ); // expecting true
$s2 = stat("$file_path/rename_basic_new.tmp");
-// checking statistics of old and renamed file
-// both should be same
+
+// checking statistics of old and renamed file - both should be same
for ($i = 0; $i <= 12; $i++) {
if ($s1[$i] != $s2[$i]) {
echo "rename_basic.tmp and rename_basic_new.tmp stat differ at element $i\n";
}
}
-echo "\n*** Testing rename() on non-existing file ***\n";
-// try renaming a non existing file
-$src_name = $file_path."/non_existent_file.tmp";
-$dest_name = $file_path."/rename_basic_new1.tmp";
-var_dump( rename($src_name, $dest_name) );
-// ensure that $dest_name didn't get created
-var_dump( file_exists($src_name) ); // expecting false
-var_dump( file_exists($dest_name) ); // expecting false
-
-// rename a existing dir to new name
-echo "\n*** Testing rename() on existing directory ***\n";
-$dir_name = $file_path."/rename_basic_dir";
-mkdir($dir_name);
-$new_dir_name = $file_path."/rename_basic_dir1";
-var_dump( rename($dir_name, $new_dir_name) );
-//ensure that $new_dir_name got created
-var_dump( file_exists($dir_name) ); // expecting false
-var_dump( file_exists($new_dir_name) ); // expecting true
-
-// try to rename an non_existing dir
-echo "\n*** Testing rename() on non-existing directory ***\n";
-$non_existent_dir_name = $file_path."/non_existent_dir";
-$new_dir_name = "$file_path/rename_basic_dir2";
-var_dump( rename($non_existent_dir_name, $new_dir_name) );
-// ensure that $new_dir_name didn't get created
-var_dump( file_exists($non_existent_dir_name) ); // expecting flase
-var_dump( file_exists($new_dir_name) ); // expecting false
-
-echo "\n*** Testing rename() by giving stream context as third argument ***\n";
-$context = stream_context_create();
-// on directory
-$dir_name = "$file_path/rename_basic_dir1";
-$new_dir_name = "$file_path/rename_basic_dir3";
-var_dump( rename($dir_name, $new_dir_name, $context) );
-// ensure that $new_dir_name got created
-var_dump( file_exists($dir_name) ); // expecting flase
-var_dump( file_exists($new_dir_name) ); // expecting true
-
-//on file
-$src_name = "$file_path/rename_basic_new.tmp";
-$dest_name = "$file_path/rename_basic_new2.tmp";
-var_dump( rename($src_name, $dest_name, $context) );
-// ensure that $dest_name got created
-var_dump( file_exists($src_name) ); // expecting false
-var_dump( file_exists($dest_name) ); // expecting true
-
echo "Done\n";
?>
--CLEAN--
<?php
-unlink(dirname(__FILE__)."/rename_basic_new2.tmp");
-rmdir(dirname(__FILE__)."/rename_basic_dir3");
+unlink(dirname(__FILE__)."/rename_basic.tmp");
+unlink(dirname(__FILE__)."/rename_basic_new.tmp");
?>
--EXPECTF--
-*** Testing rename() for basic functions on existing file ***
-bool(true)
-bool(false)
-bool(true)
-
*** Testing rename() on non-existing file ***
-
-Warning: rename(%s/non_existent_file.tmp,%s/rename_basic_new1.tmp): No such file or directory in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-
-*** Testing rename() on existing directory ***
-bool(true)
-bool(false)
-bool(true)
-
-*** Testing rename() on non-existing directory ***
-
-Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): No such file or directory in %s on line %d
-bool(false)
-bool(false)
-bool(false)
-
-*** Testing rename() by giving stream context as third argument ***
-bool(true)
-bool(false)
-bool(true)
bool(true)
bool(false)
bool(true)
Done
+
diff --git a/ext/standard/tests/file/rename_variation-win32.phpt b/ext/standard/tests/file/rename_variation-win32.phpt
index 3cac5ccad..ae9555760 100644
--- a/ext/standard/tests/file/rename_variation-win32.phpt
+++ b/ext/standard/tests/file/rename_variation-win32.phpt
@@ -14,7 +14,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
require dirname(__FILE__).'/file.inc';
-/* creating directory */
+/* create directory */
$file_path = dirname(__FILE__);
mkdir("$file_path/rename_variation");
@@ -30,7 +30,9 @@ $src_filenames = array(
"$file_path/rename_variation//rename_variation.tmp",
"$file_path//rename_variation//rename_variation.tmp",
);
+
$counter = 1;
+
/* loop through each $file and rename it to rename_variation2.tmp */
foreach($src_filenames as $src_filename) {
echo "-- Iteration $counter --\n";
@@ -38,6 +40,7 @@ foreach($src_filenames as $src_filename) {
fclose($fp);
$dest_filename = "$file_path/rename_variation2.tmp";
var_dump( rename($src_filename, $dest_filename) );
+
// ensure that file got renamed to new name
var_dump( file_exists($src_filename) ); // expecting false
var_dump( file_exists($dest_filename) ); // expecting true
@@ -47,90 +50,8 @@ foreach($src_filenames as $src_filename) {
unlink($dest_filename);
}
-// clean the temp dir and file
rmdir("$file_path/rename_variation");
-// rename dirs across directories
-echo "\n*** Testing rename() : renaming directory across directories ***\n";
-$src_dirs = array (
- /* Testing simple directory tree */
- "$file_path/rename_variation/",
-
- /* Testing a dir with trailing slash */
- "$file_path/rename_variation/",
-
- /* Testing dir with double trailing slashes */
- "$file_path//rename_variation//",
-);
-
-$dest_dir = "$file_path/rename_variation_dir";
-// create the $dest_dir
-mkdir($dest_dir);
-
-$counter = 1;
-/* loop through each $src_dirs and rename it to $dest_dir */
-foreach($src_dirs as $src_dir) {
- echo "-- Iteration $counter --\n";
-
- // create the src dir
- mkdir("$file_path/rename_variation/");
- // rename the src dir to a new dir in dest dir
- var_dump( rename($src_dir, $dest_dir."/new_dir") );
- // ensure that dir was renamed
- var_dump( file_exists($src_dir) ); // expecting false
- var_dump( file_exists($dest_dir."/new_dir") ); // expecting true
-
- // remove the new dir
- rmdir($dest_dir."/new_dir");
- $counter++;
-}
-
-/* Renaming a file and directory to numeric name */
-echo "\n*** Testing rename() by renaming a file and directory to numeric name ***\n";
-$fp = fopen($file_path."/rename_variation.tmp", "w");
-fclose($fp);
-// renaming existing file to numeric name
-var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") );
-// ensure that rename worked fine
-var_dump( file_exists($file_path."/rename_variation.tmp" ) ); // expecting false
-var_dump( file_exists($file_path."/12345" ) ); // expecting true
-// remove the file
-unlink($file_path."/12345");
-
-// renaming a directory to numeric name
-var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") );
-// ensure that rename worked fine
-var_dump( file_exists($file_path."/rename_variation_dir" ) ); // expecting false
-var_dump( file_exists($file_path."/12345" ) ); // expecting true
-
-// delete the file and dir
-rmdir($file_path."/12345");
-
-/* test rename() by trying to rename an existing file/dir to the same name
- and one another */
-// create a dir
-$file_path = dirname(__FILE__);
-$dirname = "$file_path/rename_variation_dir";
-mkdir($dirname);
-//create a file
-$filename = "$file_path/rename_variation.tmp";
-$fp = fopen($filename, "w");
-fclose($fp);
-
-echo "\n-- Renaming file to same file name --\n";
-var_dump( rename($filename, $filename) );
-
-echo "\n-- Renaming directory to same directory name --\n";
-var_dump( rename($dirname, $dirname) );
-
-echo "\n-- Renaming existing file to existing directory name --\n";
-var_dump( rename($filename, $dirname) );
-
-echo "\n-- Renaming existing directory to existing file name --\n";
-$fp = fopen($filename, "w");
-fclose($fp);
-var_dump( rename($dirname, $filename) );
-
echo "Done\n";
?>
--CLEAN--
@@ -147,53 +68,20 @@ bool(true)
bool(false)
bool(true)
-- Iteration 2 --
-bool(true)
-bool(false)
-bool(true)
--- Iteration 3 --
-bool(true)
-bool(false)
-bool(true)
--- Iteration 4 --
-bool(true)
-bool(false)
-bool(true)
-*** Testing rename() : renaming directory across directories ***
--- Iteration 1 --
-bool(true)
+Warning: rename(%s/rename_variation/rename_variation.tmp/,%s/rename_variation2.tmp): Invalid argument in %s on line %d
bool(false)
bool(true)
--- Iteration 2 --
-bool(true)
bool(false)
-bool(true)
--- Iteration 3 --
-bool(true)
-bool(false)
-bool(true)
-*** Testing rename() by renaming a file and directory to numeric name ***
+Warning: unlink(%s/rename_variation2.tmp): No such file or directory in %s on line %d
+-- Iteration 3 --
bool(true)
bool(false)
bool(true)
+-- Iteration 4 --
bool(true)
bool(false)
bool(true)
+Done
--- Renaming file to same file name --
-bool(true)
-
--- Renaming directory to same directory name --
-bool(true)
-
--- Renaming existing file to existing directory name --
-
-Warning: rename(%s,%s): File exists in %s on line %d
-bool(false)
-
--- Renaming existing directory to existing file name --
-
-Warning: rename(%s,%s): File exists in %s on line %d
-bool(false)
-Done \ No newline at end of file
diff --git a/ext/standard/tests/file/rename_variation1-win32.phpt b/ext/standard/tests/file/rename_variation1-win32.phpt
new file mode 100644
index 000000000..0955096d7
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation1-win32.phpt
@@ -0,0 +1,81 @@
+--TEST--
+Test rename() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+/* creating directory */
+$file_path = dirname(__FILE__);
+
+// rename dirs across directories
+echo "\n*** Testing rename() : renaming directory across directories ***\n";
+$src_dirs = array (
+ /* Testing simple directory tree */
+ "$file_path/rename_variation/",
+
+ /* Testing a dir with trailing slash */
+ "$file_path/rename_variation/",
+
+ /* Testing dir with double trailing slashes */
+ "$file_path//rename_variation//",
+);
+
+$dest_dir = "$file_path/rename_variation_dir";
+
+// create the $dest_dir
+mkdir($dest_dir);
+
+$counter = 1;
+
+/* loop through each $src_dirs and rename it to $dest_dir */
+foreach($src_dirs as $src_dir) {
+ echo "-- Iteration $counter --\n";
+
+ // create the src dir
+ mkdir("$file_path/rename_variation/");
+ // rename the src dir to a new dir in dest dir
+ var_dump( rename($src_dir, $dest_dir."/new_dir") );
+ // ensure that dir was renamed
+ var_dump( file_exists($src_dir) ); // expecting false
+ var_dump( file_exists($dest_dir."/new_dir") ); // expecting true
+
+ // remove the new dir
+ rmdir($dest_dir."/new_dir");
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_link.tmp");
+unlink($file_path."/rename_variation.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() : renaming directory across directories ***
+-- Iteration 1 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation2-win32.phpt b/ext/standard/tests/file/rename_variation2-win32.phpt
new file mode 100644
index 000000000..87f4e7ddb
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation2-win32.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test rename() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+$file_path = dirname(__FILE__);
+mkdir("$file_path/rename_variation_dir");
+
+/* Renaming a file and directory to numeric name */
+echo "\n*** Testing rename() by renaming a file and directory to numeric name ***\n";
+$fp = fopen($file_path."/rename_variation.tmp", "w");
+fclose($fp);
+
+// renaming existing file to numeric name
+var_dump( rename($file_path."/rename_variation.tmp", $file_path."/12345") );
+
+// ensure that rename worked fine
+var_dump( file_exists($file_path."/rename_variation.tmp" ) ); // expecting false
+var_dump( file_exists($file_path."/12345" ) ); // expecting true
+
+unlink($file_path."/12345");
+
+// renaming a directory to numeric name
+var_dump( rename($file_path."/rename_variation_dir/", $file_path."/12345") );
+
+// ensure that rename worked fine
+var_dump( file_exists($file_path."/rename_variation_dir" ) ); // expecting false
+var_dump( file_exists($file_path."/12345" ) ); // expecting true
+
+rmdir($file_path."/12345");
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_link.tmp");
+unlink($file_path."/rename_variation.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+*** Testing rename() by renaming a file and directory to numeric name ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation3-win32.phpt b/ext/standard/tests/file/rename_variation3-win32.phpt
new file mode 100644
index 000000000..7ad17093d
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation3-win32.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test rename() function: usage variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+require dirname(__FILE__).'/file.inc';
+
+/* creating directory */
+$file_path = dirname(__FILE__);
+$dirname = "$file_path/rename_variation_dir";
+mkdir($dirname);
+
+/* test rename() by trying to rename an existing file/dir to the same name
+ and one another */
+
+$filename = "$file_path/rename_variation.tmp";
+$fp = fopen($filename, "w");
+fclose($fp);
+
+echo "\n-- Renaming file to same file name --\n";
+var_dump( rename($filename, $filename) );
+
+echo "\n-- Renaming directory to same directory name --\n";
+var_dump( rename($dirname, $dirname) );
+
+echo "\n-- Renaming existing file to existing directory name --\n";
+var_dump( rename($filename, $dirname) );
+
+echo "\n-- Renaming existing directory to existing file name --\n";
+$fp = fopen($filename, "w");
+fclose($fp);
+var_dump( rename($dirname, $filename) );
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$file_path = dirname(__FILE__);
+unlink($file_path."/rename_variation_link.tmp");
+unlink($file_path."/rename_variation.tmp");
+rmdir($file_path."/rename_variation_dir");
+?>
+--EXPECTF--
+-- Renaming file to same file name --
+bool(true)
+
+-- Renaming directory to same directory name --
+bool(true)
+
+-- Renaming existing file to existing directory name --
+
+Warning: rename(%s/rename_variation.tmp,%s/rename_variation_dir): File exists in %s on line %d
+bool(false)
+
+-- Renaming existing directory to existing file name --
+
+Warning: rename(%s/rename_variation_dir,%s/rename_variation.tmp): File exists in %s on line %d
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation8.phpt b/ext/standard/tests/file/rename_variation8.phpt
new file mode 100644
index 000000000..650b6c990
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation8.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test rename() function: variation
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "\n*** Testing rename() on non-existing file ***\n";
+$file_path = dirname(__FILE__);
+
+// try renaming a non existing file
+$src_name = $file_path."/non_existent_file.tmp";
+$dest_name = $file_path."/rename_variation8_new.tmp";
+var_dump( rename($src_name, $dest_name) );
+
+// ensure that $dest_name didn't get created
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting false
+
+// rename a existing dir to new name
+echo "\n*** Testing rename() on existing directory ***\n";
+$dir_name = $file_path."/rename_basic_dir";
+mkdir($dir_name);
+$new_dir_name = $file_path."/rename_basic_dir1";
+var_dump( rename($dir_name, $new_dir_name) );
+//ensure that $new_dir_name got created
+var_dump( file_exists($dir_name) ); // expecting false
+var_dump( file_exists($new_dir_name) ); // expecting true
+
+// try to rename an non_existing dir
+echo "\n*** Testing rename() on non-existing directory ***\n";
+$non_existent_dir_name = $file_path."/non_existent_dir";
+$new_dir_name = "$file_path/rename_basic_dir2";
+var_dump( rename($non_existent_dir_name, $new_dir_name) );
+// ensure that $new_dir_name didn't get created
+var_dump( file_exists($non_existent_dir_name) ); // expecting flase
+var_dump( file_exists($new_dir_name) ); // expecting false
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/rename_basic_new2.tmp");
+rmdir(dirname(__FILE__)."/rename_basic_dir1");
+?>
+--EXPECTF--
+*** Testing rename() on non-existing file ***
+
+Warning: rename(%s/non_existent_file.tmp,%s/rename_variation8_new.tmp): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing rename() on existing directory ***
+bool(true)
+bool(false)
+bool(true)
+
+*** Testing rename() on non-existing directory ***
+
+Warning: rename(%s/non_existent_dir,%s/rename_basic_dir2): No such file or directory in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+Done
+
diff --git a/ext/standard/tests/file/rename_variation9.phpt b/ext/standard/tests/file/rename_variation9.phpt
new file mode 100644
index 000000000..d923e4a3d
--- /dev/null
+++ b/ext/standard/tests/file/rename_variation9.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test rename() function: basic functionality
+--FILE--
+<?php
+/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
+ Description: Renames a file or directory
+*/
+
+echo "\n*** Testing rename() by giving stream context as third argument ***\n";
+$file_path = dirname(__FILE__);
+
+$context = stream_context_create();
+
+// on directory
+$dir_name = "$file_path/rename_variation_dir9";
+$new_dir_name = "$file_path/rename_variation_dir9_new";
+
+mkdir($dir_name);
+
+var_dump( rename($dir_name, $new_dir_name, $context) );
+var_dump( file_exists($dir_name) ); // expecting flase
+var_dump( file_exists($new_dir_name) ); // expecting true
+
+//on file
+$src_name = "$file_path/rename_variation9.tmp";
+$dest_name = "$file_path/rename_variation9_new.tmp";
+
+// create the file
+$fp = fopen($src_name, "w");
+$s1 = stat($src_name);
+fclose($fp);
+
+var_dump( rename($src_name, $dest_name, $context) );
+var_dump( file_exists($src_name) ); // expecting false
+var_dump( file_exists($dest_name) ); // expecting true
+
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/rename_variation9_new.tmp");
+rmdir(dirname(__FILE__)."/rename_variation_dir9_new");
+?>
+--EXPECTF--
+*** Testing rename() by giving stream context as third argument ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+Done
+
diff --git a/ext/standard/tests/general_functions/bug42272.phpt b/ext/standard/tests/general_functions/bug42272.phpt
new file mode 100644
index 000000000..5a455d725
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug42272.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #42272: var_export() incorrectly escapes char(0).
+--FILE--
+<?php
+$foo = var_export("\0", true );
+echo $foo, "\n";
+var_export("a\0b");
+?>
+--EXPECT--
+'' . "\0" . ''
+'a' . "\0" . 'b'
diff --git a/ext/standard/tests/general_functions/bug43293_1.phpt b/ext/standard/tests/general_functions/bug43293_1.phpt
new file mode 100644
index 000000000..b4be25233
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_1.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug#43293 (Multiple segfaults in getopt())
+--INI--
+register_argc_argv=Off
+--FILE--
+<?php
+$argv = array(1, 2, 3);
+var_dump(getopt("abcd"));
+var_dump($argv);
+$argv = null;
+var_dump(getopt("abcd"));
+?>
+--EXPECT--
+array(0) {
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(false)
+
diff --git a/ext/standard/tests/general_functions/bug43293_2.phpt b/ext/standard/tests/general_functions/bug43293_2.phpt
new file mode 100644
index 000000000..a91beebac
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug#43293 (Multiple segfaults in getopt())
+--INI--
+register_argc_argv=Off
+--FILE--
+<?php
+$argv = array(true, false);
+var_dump(getopt("abcd"));
+?>
+--EXPECT--
+array(0) {
+}
+
diff --git a/ext/standard/tests/general_functions/bug43293_3.phpt b/ext/standard/tests/general_functions/bug43293_3.phpt
new file mode 100644
index 000000000..6c846610b
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_3.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug#43293 (Multiple segfaults in getopt())
+--SKIPIF--
+<?php
+@getopt(null, array());
+if(error_get_last() !== null) {
+ echo "skip: longopts not enabled";
+}
+?>
+--ARGS--
+-f --f
+--INI--
+register_argc_argv=On
+--FILE--
+<?php
+$args = array(true, false, "f");
+var_dump(getopt("f", $args), $args);
+?>
+--EXPECT--
+array(1) {
+ ["f"]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+array(3) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ string(1) "f"
+}
+
diff --git a/ext/standard/tests/general_functions/bug44394.phpt b/ext/standard/tests/general_functions/bug44394.phpt
new file mode 100644
index 000000000..3a619283c
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44394.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #44394 Last two bytes missing from output
+--FILE--
+<?php
+
+$string = "<a href='a?q=1'>asd</a>";
+
+output_add_rewrite_var('a', 'b');
+
+echo $string;
+
+ob_flush();
+
+ob_end_clean();
+
+?>
+--EXPECT--
+<a href='a?q=1&a=b'>asd</a>
diff --git a/ext/standard/tests/general_functions/bug44394_2.phpt b/ext/standard/tests/general_functions/bug44394_2.phpt
new file mode 100644
index 000000000..68fae55d6
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44394_2.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #44394 (Last two bytes missing from output) with session.use_trans_id
+--SKIPIF--
+<?php if (!extension_loaded("session")) print "skip"; ?>
+--FILE--
+<?php
+
+ini_set('session.use_trans_sid', 1);
+
+session_start();
+
+ob_start();
+
+$string = "<a href='a?q=1'>asd</a>";
+
+output_add_rewrite_var('a', 'b');
+
+echo $string;
+
+ob_flush();
+
+ob_end_clean();
+
+?>
+--EXPECTF--
+<a href='a?q=1&PHPSESSID=%s&a=b'>asd</a>
diff --git a/ext/standard/tests/general_functions/bug44487.phpt b/ext/standard/tests/general_functions/bug44487.phpt
new file mode 100644
index 000000000..10c52c6b3
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44487.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #44487 (call_user_method_array issues a warning when throwing an exception)
+--INI--
+error_reporting = E_ALL & ~E_DEPRECATED
+--FILE--
+<?php
+
+class Foo
+{
+ public function test()
+ {
+ print 'test';
+ throw new Exception();
+ }
+}
+
+try {
+ $bar = new Foo();
+ call_user_method_array('test', $bar, array()) ;
+} catch (Exception $e) {
+}
+?>
+--EXPECT--
+test
diff --git a/ext/standard/tests/general_functions/bug44667.phpt b/ext/standard/tests/general_functions/bug44667.phpt
new file mode 100644
index 000000000..49183cc58
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44667.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly)
+--SKIPIF--
+<?php if (!is_executable('/bin/cat')) echo 'skip cat not found'; ?>
+--FILE--
+<?php
+
+$pipes = array();
+
+$descriptor_spec = array(
+ 0 => array('pipe', 'rb'),
+ 1 => array('pipe', 'wb'),
+);
+
+$proc = proc_open('cat', $descriptor_spec, $pipes);
+
+fwrite($pipes[0], 'Hello', 5);
+fflush($pipes[0]);
+fclose($pipes[0]);
+
+$result = fread($pipes[1], 5);
+fclose($pipes[1]);
+
+proc_close($proc);
+
+echo "Result is: ", $result, "\n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Result is: Hello
+Done
diff --git a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
index f8cb94fb5..b90d22636 100755
--- a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
+++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
@@ -1,5 +1,7 @@
--TEST--
dl() filename length checks (CVE-2007-4887)
+--INI--
+enable_dl=On
--FILE--
<?php
var_dump(dl(str_repeat("a", 8376757)));
diff --git a/ext/standard/tests/general_functions/getopt_002.phpt b/ext/standard/tests/general_functions/getopt_002.phpt
new file mode 100644
index 000000000..3912ec87c
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+getopt#002
+--ARGS--
+-vvv -a value -1111 -2 -v
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("2a:vcd1"));
+?>
+--EXPECT--
+array(4) {
+ ["v"]=>
+ array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ }
+ ["a"]=>
+ string(5) "value"
+ [1]=>
+ array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ }
+ [2]=>
+ bool(false)
+}
+
+
diff --git a/ext/standard/tests/general_functions/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt
index c48a8f3ed..d9f43e93b 100644
--- a/ext/standard/tests/general_functions/import_request.phpt
+++ b/ext/standard/tests/general_functions/import_request.phpt
@@ -4,6 +4,8 @@ import_request_variables() tests
a=1&b=heh&c=3&d[]=5&GLOBALS=test&1=hm
--POST--
ap=25&bp=test&cp=blah3&dp[]=ar
+--INI--
+register_globals=off
--FILE--
<?php
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
index 32125bfce..5b787ab55 100644
--- a/ext/standard/tests/general_functions/phpinfo.phpt
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -24,7 +24,7 @@ Configure Command => %s
Server API => Command Line Interface
Virtual Directory Support => %s
Configuration File (php.ini) Path => %s
-Loaded Configuration File => %s
+Loaded Configuration File => %a
PHP API => %d
PHP Extension => %d
Zend Extension => %d
diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt
index 6d2df8542..81896550b 100644
--- a/ext/standard/tests/general_functions/var_export-locale.phpt
+++ b/ext/standard/tests/general_functions/var_export-locale.phpt
@@ -572,9 +572,9 @@ string(3) "' '"
Iteration 12
-'\000'
-'\000'
-string(6) "'\000'"
+'' . "\0" . ''
+'' . "\0" . ''
+string(14) "'' . "\0" . ''"
Iteration 13
diff --git a/ext/standard/tests/general_functions/var_export.phpt b/ext/standard/tests/general_functions/var_export.phpt
index 2a99c5bd8..b5cc886e4 100644
--- a/ext/standard/tests/general_functions/var_export.phpt
+++ b/ext/standard/tests/general_functions/var_export.phpt
@@ -565,9 +565,9 @@ string(3) "' '"
Iteration 12
-'\000'
-'\000'
-string(6) "'\000'"
+'' . "\0" . ''
+'' . "\0" . ''
+string(14) "'' . "\0" . ''"
Iteration 13
diff --git a/ext/standard/tests/math/acos_error.phpt b/ext/standard/tests/math/acos_error.phpt
index 6e3f2ecfd..dd42fbb58 100644
--- a/ext/standard/tests/math/acos_error.phpt
+++ b/ext/standard/tests/math/acos_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for acos()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/acosh_error.phpt b/ext/standard/tests/math/acosh_error.phpt
index 8a4b9730e..fd2f92118 100644
--- a/ext/standard/tests/math/acosh_error.phpt
+++ b/ext/standard/tests/math/acosh_error.phpt
@@ -5,7 +5,6 @@ Test wrong number of arguments for acosh()
if(substr(PHP_OS, 0, 3) == "WIN" )
die ("skip - function not supported on Windows");
?>
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/asin_error.phpt b/ext/standard/tests/math/asin_error.phpt
index 21c824b55..ef2a322e0 100644
--- a/ext/standard/tests/math/asin_error.phpt
+++ b/ext/standard/tests/math/asin_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for asin()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/asinh_error.phpt b/ext/standard/tests/math/asinh_error.phpt
index e6439d1bd..96f7ba061 100644
--- a/ext/standard/tests/math/asinh_error.phpt
+++ b/ext/standard/tests/math/asinh_error.phpt
@@ -5,7 +5,6 @@ Test wrong number of arguments for asinh()
if(substr(PHP_OS, 0, 3) == "WIN" )
die ("skip - function not supported on Windows");
?>
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt
new file mode 100644
index 000000000..65a0622c6
--- /dev/null
+++ b/ext/standard/tests/math/atan2_basic.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test atan2() - basic function test of atan2()
+--INI--
+precision=14
+--FILE--
+<?php
+$valuesy = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+$valuesx = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($valuesy); $i++) {
+ for ($j = 0; $j < count($valuesx); $j++) {
+ $res = atan2($valuesy[$i], $valuesx[$j]);
+ echo "Y:$valuesy[$i] X:$valuesx[$j] ";
+ var_dump($res);
+ }
+}
+?>
+--EXPECTF--
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:-23 float(-2.3561944901923)
+Y:-23 X:23.45 float(-0.77571063007847)
+Y:-23 X:-23.45 float(-2.3658820235113)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23.45 float(-0.77571063007847)
+Y:-23 X:2.345e1 float(-0.77571063007847)
+Y:-23 X: float(-1.5707963267949)
+Y:-23 X:1 float(-1.5273454314034)
+Y:-23 X: float(-1.5707963267949)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:-23 float(2.3465069568734)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:-23.45 float(2.3561944901923)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:2.345e1 float(0.78539816339745)
+Y:23.45 X: float(1.5707963267949)
+Y:23.45 X:1 float(1.5281782247706)
+Y:23.45 X: float(1.5707963267949)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:-23 float(-2.3465069568734)
+Y:-23.45 X:23.45 float(-0.78539816339745)
+Y:-23.45 X:-23.45 float(-2.3561944901923)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23.45 float(-0.78539816339745)
+Y:-23.45 X:2.345e1 float(-0.78539816339745)
+Y:-23.45 X: float(-1.5707963267949)
+Y:-23.45 X:1 float(-1.5281782247706)
+Y:-23.45 X: float(-1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:-23 float(2.3465069568734)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:-23.45 float(2.3561944901923)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:2.345e1 float(0.78539816339745)
+Y:23.45 X: float(1.5707963267949)
+Y:23.45 X:1 float(1.5281782247706)
+Y:23.45 X: float(1.5707963267949)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:-23 float(2.3465069568734)
+Y:2.345e1 X:23.45 float(0.78539816339745)
+Y:2.345e1 X:-23.45 float(2.3561944901923)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23.45 float(0.78539816339745)
+Y:2.345e1 X:2.345e1 float(0.78539816339745)
+Y:2.345e1 X: float(1.5707963267949)
+Y:2.345e1 X:1 float(1.5281782247706)
+Y:2.345e1 X: float(1.5707963267949)
+Y: X:23 float(0)
+Y: X:-23 float(3.1415926535898)
+Y: X:23.45 float(0)
+Y: X:-23.45 float(3.1415926535898)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23.45 float(0)
+Y: X:2.345e1 float(0)
+Y: X: float(0)
+Y: X:1 float(0)
+Y: X: float(0)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:-23 float(3.0981417581983)
+Y:1 X:23.45 float(0.042618102024328)
+Y:1 X:-23.45 float(3.0989745515655)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23.45 float(0.042618102024328)
+Y:1 X:2.345e1 float(0.042618102024328)
+Y:1 X: float(1.5707963267949)
+Y:1 X:1 float(0.78539816339745)
+Y:1 X: float(1.5707963267949)
+Y: X:23 float(0)
+Y: X:-23 float(3.1415926535898)
+Y: X:23.45 float(0)
+Y: X:-23.45 float(3.1415926535898)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23.45 float(0)
+Y: X:2.345e1 float(0)
+Y: X: float(0)
+Y: X:1 float(0)
+Y: X: float(0)
diff --git a/ext/standard/tests/math/atan2_error.phpt b/ext/standard/tests/math/atan2_error.phpt
new file mode 100644
index 000000000..b56843e3a
--- /dev/null
+++ b/ext/standard/tests/math/atan2_error.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Test atan2() - wrong params atan2()
+--FILE--
+<?php
+atan2();
+atan2(36);
+atan2(36,25,0);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for atan2() in %s on line 2
+
+Warning: Wrong parameter count for atan2() in %s on line 3
+
+Warning: Wrong parameter count for atan2() in %s on line 4
diff --git a/ext/standard/tests/math/atan_error.phpt b/ext/standard/tests/math/atan_error.phpt
index 07cc93aea..c1cbc7c3c 100644
--- a/ext/standard/tests/math/atan_error.phpt
+++ b/ext/standard/tests/math/atan_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for atan()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/atanh_error.phpt b/ext/standard/tests/math/atanh_error.phpt
index cb6fb6def..3201eef20 100644
--- a/ext/standard/tests/math/atanh_error.phpt
+++ b/ext/standard/tests/math/atanh_error.phpt
@@ -5,7 +5,6 @@ Test wrong number of arguments for atanh()
if(substr(PHP_OS, 0, 3) == "WIN" )
die ("skip - function not supported on Windows");
?>
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/base_convert_basic.phpt b/ext/standard/tests/math/base_convert_basic.phpt
new file mode 100644
index 000000000..327f47c75
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_basic.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test base_convert() - basic function tests base_convert()
+--FILE--
+<?php
+$frombase = array(2,8,10,16,36);
+$tobase = array(2,8,10,16,36);
+
+$values = array(10,
+ 27,
+ 39,
+ 039,
+ 0x5F,
+ "10",
+ "27",
+ "39",
+ "5F",
+ "3XYZ"
+ );
+
+for ($f= 0; $f < count($frombase); $f++) {
+ echo "\n...from base is ", $frombase[$f], "\n";
+ for ($t= 0; $t < count($tobase); $t++) {
+ echo "......to base is ", $tobase[$t], "\n";
+ for ($i =0; $i < count($values); $i++){
+ $res = base_convert($values[$i],$frombase[$f],$tobase[$t]);
+ echo ".........value= ", $values[$i], " res = ", $res, "\n";
+ }
+ }
+}
+?>
+
+--EXPECTF--
+...from base is 2
+......to base is 2
+.........value= 10 res = 10
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 10
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 8
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 10
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 16
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 36
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+
+...from base is 8
+......to base is 2
+.........value= 10 res = 1000
+.........value= 27 res = 10111
+.........value= 39 res = 11
+.........value= 3 res = 11
+.........value= 95 res = 101
+.........value= 10 res = 1000
+.........value= 27 res = 10111
+.........value= 39 res = 11
+.........value= 5F res = 101
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 8
+.........value= 27 res = 23
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = 23
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = 8
+.........value= 27 res = 17
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = 17
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = 8
+.........value= 27 res = n
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = n
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+
+...from base is 10
+......to base is 2
+.........value= 10 res = 1010
+.........value= 27 res = 11011
+.........value= 39 res = 100111
+.........value= 3 res = 11
+.........value= 95 res = 1011111
+.........value= 10 res = 1010
+.........value= 27 res = 11011
+.........value= 39 res = 100111
+.........value= 5F res = 101
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 12
+.........value= 27 res = 33
+.........value= 39 res = 47
+.........value= 3 res = 3
+.........value= 95 res = 137
+.........value= 10 res = 12
+.........value= 27 res = 33
+.........value= 39 res = 47
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = a
+.........value= 27 res = 1b
+.........value= 39 res = 27
+.........value= 3 res = 3
+.........value= 95 res = 5f
+.........value= 10 res = a
+.........value= 27 res = 1b
+.........value= 39 res = 27
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = a
+.........value= 27 res = r
+.........value= 39 res = 13
+.........value= 3 res = 3
+.........value= 95 res = 2n
+.........value= 10 res = a
+.........value= 27 res = r
+.........value= 39 res = 13
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+
+...from base is 16
+......to base is 2
+.........value= 10 res = 10000
+.........value= 27 res = 100111
+.........value= 39 res = 111001
+.........value= 3 res = 11
+.........value= 95 res = 10010101
+.........value= 10 res = 10000
+.........value= 27 res = 100111
+.........value= 39 res = 111001
+.........value= 5F res = 1011111
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 20
+.........value= 27 res = 47
+.........value= 39 res = 71
+.........value= 3 res = 3
+.........value= 95 res = 225
+.........value= 10 res = 20
+.........value= 27 res = 47
+.........value= 39 res = 71
+.........value= 5F res = 137
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 16
+.........value= 27 res = 39
+.........value= 39 res = 57
+.........value= 3 res = 3
+.........value= 95 res = 149
+.........value= 10 res = 16
+.........value= 27 res = 39
+.........value= 39 res = 57
+.........value= 5F res = 95
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5f
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = g
+.........value= 27 res = 13
+.........value= 39 res = 1l
+.........value= 3 res = 3
+.........value= 95 res = 45
+.........value= 10 res = g
+.........value= 27 res = 13
+.........value= 39 res = 1l
+.........value= 5F res = 2n
+.........value= 3XYZ res = 3
+
+...from base is 36
+......to base is 2
+.........value= 10 res = 100100
+.........value= 27 res = 1001111
+.........value= 39 res = 1110101
+.........value= 3 res = 11
+.........value= 95 res = 101001001
+.........value= 10 res = 100100
+.........value= 27 res = 1001111
+.........value= 39 res = 1110101
+.........value= 5F res = 11000011
+.........value= 3XYZ res = 101100111010111011
+......to base is 8
+.........value= 10 res = 44
+.........value= 27 res = 117
+.........value= 39 res = 165
+.........value= 3 res = 3
+.........value= 95 res = 511
+.........value= 10 res = 44
+.........value= 27 res = 117
+.........value= 39 res = 165
+.........value= 5F res = 303
+.........value= 3XYZ res = 547273
+......to base is 10
+.........value= 10 res = 36
+.........value= 27 res = 79
+.........value= 39 res = 117
+.........value= 3 res = 3
+.........value= 95 res = 329
+.........value= 10 res = 36
+.........value= 27 res = 79
+.........value= 39 res = 117
+.........value= 5F res = 195
+.........value= 3XYZ res = 183995
+......to base is 16
+.........value= 10 res = 24
+.........value= 27 res = 4f
+.........value= 39 res = 75
+.........value= 3 res = 3
+.........value= 95 res = 149
+.........value= 10 res = 24
+.........value= 27 res = 4f
+.........value= 39 res = 75
+.........value= 5F res = c3
+.........value= 3XYZ res = 2cebb
+......to base is 36
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5f
+.........value= 3XYZ res = 3xyz \ No newline at end of file
diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt
new file mode 100644
index 000000000..7806c5648
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test base_convert() - wrong params base_convert()
+--FILE--
+<?php
+base_convert();
+base_convert(35);
+base_convert(35,2);
+base_convert(1234, 1, 10);
+base_convert(1234, 10, 37);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for base_convert() in %s on line 2
+
+Warning: Wrong parameter count for base_convert() in %s on line 3
+
+Warning: Wrong parameter count for base_convert() in %s on line 4
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line 5
+
+Warning: base_convert(): Invalid `to base' (37) in %s on line 6
diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt
new file mode 100644
index 000000000..e50dc8d48
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basic.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$values = array(111000111,
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = bindec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(455)
+int(0)
+int(32766)
+int(5)
+int(129)
+int(455)
+int(224)
+int(2147483647)
+float(2147483648)
+int(129)
+int(0)
+int(13)
+int(13)
+int(26)
+int(6)
+int(0)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt
new file mode 100644
index 000000000..006983717
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basic_64bit.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+$values = array(111000111,
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = bindec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(455)
+int(0)
+int(32766)
+int(5)
+int(129)
+int(455)
+int(224)
+int(2147483647)
+int(2147483648)
+int(129)
+int(0)
+int(13)
+int(13)
+int(26)
+int(6)
+int(0)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/bindec_error.phpt b/ext/standard/tests/math/bindec_error.phpt
new file mode 100644
index 000000000..36193b63e
--- /dev/null
+++ b/ext/standard/tests/math/bindec_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--FILE--
+<?php
+bindec();
+bindec('01010101111',true);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for bindec() in %s on line 2
+
+Warning: Wrong parameter count for bindec() in %s on line 3
diff --git a/ext/standard/tests/math/constants_basic.phpt b/ext/standard/tests/math/constants_basic.phpt
new file mode 100644
index 000000000..0220d9335
--- /dev/null
+++ b/ext/standard/tests/math/constants_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test for pre-defined math constants
+--INI--
+precision=14
+--FILE--
+<?php
+echo "M_E= ";
+var_dump(M_E);
+echo "M_LOG2E= ";
+var_dump(M_LOG2E);
+echo "M_LOG10E= ";
+var_dump(M_LOG10E);
+echo "M_LN2= ";
+var_dump(M_LN2);
+echo "M_LN10= ";
+var_dump(M_LN10);
+echo "M_PI= ";
+var_dump(M_PI);
+echo "M_PI_2= ";
+var_dump(M_PI_2);
+echo "M_PI_4= ";
+var_dump(M_PI_4);
+echo "M_1_PI= ";
+var_dump(M_1_PI);
+echo "M_2_PI= ";
+var_dump(M_2_PI);
+echo "M_SQRTPI= ";
+var_dump(M_SQRTPI);
+echo "M_2_SQRTPI= ";
+var_dump(M_2_SQRTPI);
+echo "M_LNPI= ";
+var_dump(M_LNPI);
+echo "M_EULER= ";
+var_dump(M_EULER);
+echo "M_SQRT2= ";
+var_dump(M_SQRT2);
+echo "M_SQRT1_2= ";
+var_dump(M_SQRT1_2);
+echo "M_SQRT3= ";
+var_dump(M_SQRT3);
+echo "INF= ";
+var_dump(INF);
+echo "NAN= ";
+var_dump(NAN);
+?>
+--EXPECT--
+M_E= float(2.718281828459)
+M_LOG2E= float(1.442695040889)
+M_LOG10E= float(0.43429448190325)
+M_LN2= float(0.69314718055995)
+M_LN10= float(2.302585092994)
+M_PI= float(3.1415926535898)
+M_PI_2= float(1.5707963267949)
+M_PI_4= float(0.78539816339745)
+M_1_PI= float(0.31830988618379)
+M_2_PI= float(0.63661977236758)
+M_SQRTPI= float(1.7724538509055)
+M_2_SQRTPI= float(1.1283791670955)
+M_LNPI= float(1.1447298858494)
+M_EULER= float(0.57721566490153)
+M_SQRT2= float(1.4142135623731)
+M_SQRT1_2= float(0.70710678118655)
+M_SQRT3= float(1.7320508075689)
+INF= float(INF)
+NAN= float(NAN)
diff --git a/ext/standard/tests/math/cos_error.phpt b/ext/standard/tests/math/cos_error.phpt
index 1a9a26ce6..3198b9e82 100644
--- a/ext/standard/tests/math/cos_error.phpt
+++ b/ext/standard/tests/math/cos_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for cos()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/cosh_error.phpt b/ext/standard/tests/math/cosh_error.phpt
index f91cb256a..f4552e61c 100644
--- a/ext/standard/tests/math/cosh_error.phpt
+++ b/ext/standard/tests/math/cosh_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for cosh()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt
new file mode 100644
index 000000000..e6fc5dc30
--- /dev/null
+++ b/ext/standard/tests/math/decbin_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test decbin() - basic function test
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = decbin($values[$i]);
+ var_dump($res);
+}
+?>
+
+--EXPECTF--
+string(4) "1010"
+string(12) "111101101110"
+string(12) "111101101110"
+string(2) "11"
+string(7) "1011111"
+string(4) "1010"
+string(12) "111101101110"
+string(2) "11"
+string(6) "100111"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0" \ No newline at end of file
diff --git a/ext/standard/tests/math/decbin_error.phpt b/ext/standard/tests/math/decbin_error.phpt
new file mode 100644
index 000000000..a350cee7f
--- /dev/null
+++ b/ext/standard/tests/math/decbin_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test decbin() - wrong params
+--FILE--
+<?php
+decbin();
+decbin(23,2,true);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for decbin() in %s on line 2
+
+Warning: Wrong parameter count for decbin() in %s on line 3
+
diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt
new file mode 100644
index 000000000..cba4aa632
--- /dev/null
+++ b/ext/standard/tests/math/dechex_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test dechex() - basic function dechex()
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = dechex($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+string(1) "a"
+string(3) "f6e"
+string(3) "f6e"
+string(1) "3"
+string(2) "5f"
+string(1) "a"
+string(3) "f6e"
+string(1) "3"
+string(2) "27"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0" \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_error.phpt b/ext/standard/tests/math/dechex_error.phpt
new file mode 100644
index 000000000..f83afb346
--- /dev/null
+++ b/ext/standard/tests/math/dechex_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test dechex() - wrong params dechex()
+--FILE--
+<?php
+dechex();
+dechex(23,2,true);
+?>
+
+--EXPECTF--
+
+Warning: Wrong parameter count for dechex() in %s on line 2
+
+Warning: Wrong parameter count for dechex() in %s on line 3
diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt
new file mode 100644
index 000000000..3021e6be1
--- /dev/null
+++ b/ext/standard/tests/math/decoct_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test decoct() - basic function test decoct()
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = decoct($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+string(2) "12"
+string(4) "7556"
+string(4) "7556"
+string(1) "3"
+string(3) "137"
+string(2) "12"
+string(4) "7556"
+string(1) "3"
+string(2) "47"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0"
diff --git a/ext/standard/tests/math/decoct_error.phpt b/ext/standard/tests/math/decoct_error.phpt
new file mode 100644
index 000000000..48c30644f
--- /dev/null
+++ b/ext/standard/tests/math/decoct_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test decoct() - wrong params decoct()
+--FILE--
+<?php
+decoct();
+decoct(23,2,true);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for decoct() in %s on line 2
+
+Warning: Wrong parameter count for decoct() in %s on line 3
+
diff --git a/ext/standard/tests/math/deg2rad_basic.phpt b/ext/standard/tests/math/deg2rad_basic.phpt
new file mode 100644
index 000000000..64771b998
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_basic.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test return type and value for expected input deg2rad()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 0.0;
+$arg_1 = 90.0;
+$arg_2 = 180.0;
+$arg_3 = 360.0;
+
+
+echo "deg2rad $arg_0 = ";
+$r0 = deg2rad($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "deg2rad $arg_1 = ";
+$r1 = deg2rad($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,1.5707963267949 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "deg2rad $arg_2 = ";
+$r2 = deg2rad($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,3.1415926535898 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "deg2rad $arg_3 = ";
+$r3 = deg2rad($arg_3);
+var_dump($r3);
+if (allowed_rounding_error($r3 ,6.2831853071796 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+deg2rad 0 = float(%f)
+Pass
+deg2rad 90 = float(%f)
+Pass
+deg2rad 180 = float(%f)
+Pass
+deg2rad 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/deg2rad_error.phpt b/ext/standard/tests/math/deg2rad_error.phpt
new file mode 100644
index 000000000..3cfdfc304
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for deg2rad()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(deg2rad($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(deg2rad());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for deg2rad() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for deg2rad() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt
new file mode 100644
index 000000000..4ce8900a9
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of deg2rad()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test deg2rad 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 = deg2rad($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(0.401425728)
+float(-0.401425728)
+float(0.4092797096)
+float(-0.4092797096)
+float(0.401425728)
+float(0.401425728)
+float(0.401425728)
+float(0.4092797096)
+float(0.4092797096)
+float(0)
+float(17.45329252)
+float(17.45329252)
+float(0)
+float(0.01745329252)
+float(0)
diff --git a/ext/standard/tests/math/exp_error.phpt b/ext/standard/tests/math/exp_error.phpt
new file mode 100644
index 000000000..21949f4a7
--- /dev/null
+++ b/ext/standard/tests/math/exp_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test exp() - wrong params for exp()
+--INI--
+precision=14
+--FILE--
+<?php
+exp();
+exp(23,true);
+?>
+--EXPECTF--
+
+Warning: exp() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: exp() expects exactly 1 parameter, 2 given in %s on line %d
diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt
new file mode 100644
index 000000000..c29abca9d
--- /dev/null
+++ b/ext/standard/tests/math/fmod_basic.phpt
@@ -0,0 +1,209 @@
+--TEST--
+Test fmod() - basic function test fmod()
+--INI--
+precision=14
+--FILE--
+<?php
+$values1 = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false);
+
+$values2 = array(2,
+ -2,
+ 2.3e1,
+ -2.3e1,
+ 0x2,
+ 02,
+ "2",
+ "2.3",
+ "2.3e1",
+ null,
+ true,
+ false);
+for ($i = 0; $i < count($values1); $i++) {
+ echo "\niteration ", $i, "\n";
+
+ for ($j = 0; $j < count($values2); $j++) {
+ $res = fmod($values1[$i], $values2[$j]);
+ var_dump($res);
+ }
+}
+?>
+--EXPECTF--
+
+iteration 0
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 1
+float(-0)
+float(-0)
+float(-4)
+float(-4)
+float(-0)
+float(-0)
+float(-0)
+float(-1.7)
+float(-4)
+float(NAN)
+float(-0)
+float(NAN)
+
+iteration 2
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 3
+float(-0.5)
+float(-0.5)
+float(-4.5)
+float(-4.5)
+float(-0.5)
+float(-0.5)
+float(-0.5)
+float(-2.2)
+float(-4.5)
+float(NAN)
+float(-0.5)
+float(NAN)
+
+iteration 4
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 5
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 6
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 7
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 8
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 9
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 10
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 11
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(NAN)
+float(0)
+float(NAN)
diff --git a/ext/standard/tests/math/fmod_error.phpt b/ext/standard/tests/math/fmod_error.phpt
new file mode 100644
index 000000000..42a6ad1a0
--- /dev/null
+++ b/ext/standard/tests/math/fmod_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test fmod() - wrong params test fmod()
+--INI--
+precision=14
+--FILE--
+<?php
+fmod();
+fmod(23);
+fmod(23,2,true);
+?>
+--EXPECTF--
+
+Warning: fmod() expects exactly 2 parameters, 0 given in %s on line 2
+
+Warning: fmod() expects exactly 2 parameters, 1 given in %s on line 3
+
+Warning: fmod() expects exactly 2 parameters, 3 given in %s on line 4
diff --git a/ext/standard/tests/math/getrandmax_basic.phpt b/ext/standard/tests/math/getrandmax_basic.phpt
new file mode 100644
index 000000000..4e52c192d
--- /dev/null
+++ b/ext/standard/tests/math/getrandmax_basic.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test getrandmax() - basic function test getrandmax()
+--FILE--
+<?php
+$biggest_int = getrandmax();
+var_dump($biggest_int);
+?>
+--EXPECTF--
+int(%d) \ No newline at end of file
diff --git a/ext/standard/tests/math/getrandmax_error.phpt b/ext/standard/tests/math/getrandmax_error.phpt
new file mode 100644
index 000000000..9f244a2a6
--- /dev/null
+++ b/ext/standard/tests/math/getrandmax_error.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test getrandmax() - wrong params test getrandmax()
+--FILE--
+<?php
+var_dump($biggest_int = getrandmax(true));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for getrandmax() in %s on line 2
+NULL
diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt
new file mode 100644
index 000000000..1c42ae7e4
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_basic.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test hexdec() - basic function test hexdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$values = array(0x123abc,
+ 0x789DEF,
+ 0x7FFFFFFF,
+ 0x80000000,
+ '0x123abc',
+ '0x789DEF',
+ '0x7FFFFFFF',
+ '0x80000000',
+ '0x123XYZABC',
+ 311015,
+ '311015',
+ 31101.3,
+ 31.1013e5,
+ 011237,
+ '011237',
+ true,
+ false,
+ null);
+for ($i = 0; $i < count($values); $i++) {
+ $res = hexdec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(18433668)
+int(126895953)
+float(142929835591)
+float(142929835592)
+int(1194684)
+int(7904751)
+int(2147483647)
+float(2147483648)
+int(1194684)
+int(3215381)
+int(3215381)
+int(3215379)
+int(51446064)
+int(18279)
+int(70199)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/hexdec_error.phpt b/ext/standard/tests/math/hexdec_error.phpt
new file mode 100644
index 000000000..06ce3fb20
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test hexdec() - wrong params test hexdec()
+--FILE--
+<?php
+hexdec();
+hexdec('0x123abc',true);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for hexdec() in %s on line 2
+
+Warning: Wrong parameter count for hexdec() in %s on line 3
diff --git a/ext/standard/tests/math/hypot_error.phpt b/ext/standard/tests/math/hypot_error.phpt
new file mode 100644
index 000000000..19a9ee085
--- /dev/null
+++ b/ext/standard/tests/math/hypot_error.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test hypot() - wrong params test hypot()
+--INI--
+precision=14
+--FILE--
+<?php
+hypot();
+hypot(36);
+hypot(36,25,0);
+?>
+--EXPECTF--
+
+
+Warning: Wrong parameter count for hypot() in %s on line 2
+
+Warning: Wrong parameter count for hypot() in %s on line 3
+
+Warning: Wrong parameter count for hypot() in %s on line 4
diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt
new file mode 100644
index 000000000..85d268527
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test is_finite() - basic function test is_finite()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+;
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_finite($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+
diff --git a/ext/standard/tests/math/is_finite_error.phpt b/ext/standard/tests/math/is_finite_error.phpt
new file mode 100644
index 000000000..e26563079
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test is_finite() - wrong params test is_finite()
+--FILE--
+<?php
+is_finite();
+is_finite(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_finite() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_finite() expects exactly 1 parameter, 3 given in %s on line 3
+
diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt
new file mode 100644
index 000000000..ca7992228
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test is_infinite() - basic function test is_infinite()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+;
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_infinite($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+
+
+
diff --git a/ext/standard/tests/math/is_infinite_error.phpt b/ext/standard/tests/math/is_infinite_error.phpt
new file mode 100644
index 000000000..5d6ad9d42
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test is_infinite() - wrong params test is_infinite()
+--FILE--
+<?php
+is_infinite();
+is_infinite(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_infinite() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_infinite() expects exactly 1 parameter, 3 given in %s on line 3
diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt
new file mode 100644
index 000000000..fb10737ce
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test is_nan() - basic function test is_nan()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_nan($values[$i]);
+ var_dump($res);
+}
+
+?>
+
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+
+
diff --git a/ext/standard/tests/math/is_nan_error.phpt b/ext/standard/tests/math/is_nan_error.phpt
new file mode 100644
index 000000000..7749e4e40
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test is_nan() - wrong params test is_nan()
+--FILE--
+<?php
+is_nan();
+is_nan(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_nan() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_nan() expects exactly 1 parameter, 3 given in %s on line 3
+
+
+
+
diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt
new file mode 100644
index 000000000..6d624d84a
--- /dev/null
+++ b/ext/standard/tests/math/lcg_value_basic.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Maths test for xapic versions of lcg_value()
+--FILE--
+<?php
+
+echo "MATHS test script started\n";
+
+
+echo "\n lcg_value tests...\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = lcg_value();
+
+ if (!is_float($res) || $res < 0 || $res > 1) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+echo "\n lcg_value error cases..spurious args get ignored\n";
+$res = lcg_value(23);
+
+if (!is_float($res) || $res < 0 || $res > 1) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+$res = lcg_value(10,false);
+if (!is_float($res) || $res < 0 || $res > 1) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+echo "MATHS test script completed\n";
+
+?>
+
+--EXPECT--
+MATHS test script started
+
+ lcg_value tests...
+PASSED
+
+ lcg_value error cases..spurious args get ignored
+PASSED
+PASSED
+MATHS test script completed
+
+
+
diff --git a/ext/standard/tests/math/log10_basic.phpt b/ext/standard/tests/math/log10_basic.phpt
new file mode 100644
index 000000000..0877df23d
--- /dev/null
+++ b/ext/standard/tests/math/log10_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test return type and value for expected input log10()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 1.0;
+$arg_1 = 10.0;
+$arg_2 = 100.0;
+
+echo "log10 $arg_0 = ";
+$r0 = log10($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "log10 $arg_1 = ";
+$r1 = log10($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,1.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "log10 $arg_2 = ";
+$r2 = log10($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,2.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+log10 1 = float(%f)
+Pass
+log10 10 = float(%f)
+Pass
+log10 100 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/log10_error.phpt b/ext/standard/tests/math/log10_error.phpt
new file mode 100644
index 000000000..083494a84
--- /dev/null
+++ b/ext/standard/tests/math/log10_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for log10()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(log10($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(log10());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for log10() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for log10() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt
new file mode 100644
index 000000000..746412a44
--- /dev/null
+++ b/ext/standard/tests/math/log10_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of log10()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test log10 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 = log10($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(1.361727836)
+float(NAN)
+float(1.370142847)
+float(NAN)
+float(1.361727836)
+float(1.361727836)
+float(1.361727836)
+float(1.370142847)
+float(1.370142847)
+float(-INF)
+float(3)
+float(3)
+float(-INF)
+float(0)
+float(-INF)
diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt
new file mode 100644
index 000000000..e2f9c9fe7
--- /dev/null
+++ b/ext/standard/tests/math/log_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log() - basic function test log()
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+echo "\n LOG tests...no base\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = log($values[$i]);
+ var_dump($res);
+}
+
+echo "\n LOG tests...base\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = log($values[$i], 4);
+ var_dump($res);
+}
+?>
+
+--EXPECTF--
+ LOG tests...no base
+float(3.1354942159291)
+float(NAN)
+float(3.1548704948923)
+float(NAN)
+float(3.1354942159291)
+float(3.1354942159291)
+float(3.1354942159291)
+float(3.1548704948923)
+float(3.1548704948923)
+float(-INF)
+float(0)
+float(-INF)
+
+ LOG tests...base
+float(2.2617809780285)
+float(NAN)
+float(2.275758008814)
+float(NAN)
+float(2.2617809780285)
+float(2.2617809780285)
+float(2.2617809780285)
+float(2.275758008814)
+float(2.275758008814)
+float(-INF)
+float(0)
+float(-INF)
diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt
new file mode 100644
index 000000000..77084a4ec
--- /dev/null
+++ b/ext/standard/tests/math/log_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test log() - wrong params test log()
+--INI--
+precision=14
+--FILE--
+<?php
+log();
+log(36,4,true);
+log(36, -4);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for log() in %s on line 2
+
+Warning: Wrong parameter count for log() in %s on line 3
+
+Warning: log(): base must be greater than 0 in %s on line 4
diff --git a/ext/standard/tests/math/mt_getrandmax_basic.phpt b/ext/standard/tests/math/mt_getrandmax_basic.phpt
new file mode 100644
index 000000000..29a30d088
--- /dev/null
+++ b/ext/standard/tests/math/mt_getrandmax_basic.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Test mt_getrandmax() - basic function test mt_getrandmax()
+--FILE--
+<?php
+var_dump(mt_getrandmax());
+?>
+--EXPECTF--
+int(%d) \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_getrandmax_error.phpt b/ext/standard/tests/math/mt_getrandmax_error.phpt
new file mode 100644
index 000000000..b30da3a91
--- /dev/null
+++ b/ext/standard/tests/math/mt_getrandmax_error.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test mt_getrandmax() - wrong paramas mt_getrandmax()
+--FILE--
+<?php
+var_dump(mt_getrandmax(true));
+?>
+--EXPECTF--
+Warning: Wrong parameter count for mt_getrandmax() in %s on line 2
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_rand_basic.phpt b/ext/standard/tests/math/mt_rand_basic.phpt
new file mode 100644
index 000000000..8b6b3cb2c
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_basic.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test mt_rand() - basic function test mt_rand()
+--FILE--
+<?php
+$default_max = mt_getrandmax();
+
+echo "\nmt_rand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand();
+
+// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+} else {
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
+}
+
+echo "\nmt_rand() tests with defined min and max value\n";
+
+$min = array(10,
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
+
+$max = array(100,
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
+
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], $max[$x]);
+
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
+}
+
+echo "\nNon-numeric cases\n";
+$min = array(true,
+ false,
+ null,
+ "10",
+ "0x10",
+ "10.5");
+
+// Eexepcted numerical equivalent of above non-numerics
+$minval = array(1,
+ 0,
+ 0,
+ 10,
+ 0,
+ 10);
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], 100);
+
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
+}
+?>
+--EXPECTF--
+mt_rand() tests with default min and max value (i.e 0 thru 2147483647)
+PASSED: range min = 0 max = 2147483647
+
+mt_rand() tests with defined min and max value
+PASSED: range min = 10 max = 100
+PASSED: range min = 100 max = 1000
+PASSED: range min = 10 max = 19
+PASSED: range min = 10500 max = 1050000
+PASSED: range min = 16 max = 65536
+PASSED: range min = 256 max = 448
+
+Non-numeric cases
+PASSED range min = 1 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
diff --git a/ext/standard/tests/math/mt_rand_error.phpt b/ext/standard/tests/math/mt_rand_error.phpt
new file mode 100644
index 000000000..e0a80586e
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test mt_rand() - wrong params test mt_rand()
+--FILE--
+<?php
+mt_rand(25);
+mt_rand(10,100,false);
+mt_rand("one", 100);
+mt_rand(1, "hundered");
+?>
+
+--EXPECTF--
+
+Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line 2
+
+Warning: mt_rand() expects exactly 2 parameters, 3 given in %s on line 3
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line 4
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line 5
diff --git a/ext/standard/tests/math/mt_srand_basic.phpt b/ext/standard/tests/math/mt_srand_basic.phpt
new file mode 100644
index 000000000..e28b1b9ea
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test mt_srand() - basic function (return values) mt_srand()
+--FILE--
+<?php
+// Should return NULL if given anything that it can convert to long
+// This doesn't actually test what it does with the input :-\
+var_dump(mt_srand());
+var_dump(mt_srand(500));
+var_dump(mt_srand(500.1));
+var_dump(mt_srand("500"));
+var_dump(mt_srand("500E3"));
+var_dump(mt_srand(true));
+var_dump(mt_srand(false));
+var_dump(mt_srand(NULL));
+?>
+--EXPECTF--
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_srand_error.phpt b/ext/standard/tests/math/mt_srand_error.phpt
new file mode 100644
index 000000000..5543d7841
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_error.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test mt_srand() - wrong params test mt_srand()
+--FILE--
+<?php
+var_dump(mt_srand(500, true));
+var_dump(mt_srand("fivehundred"));
+var_dump(mt_srand("500ABC"));
+?>
+--EXPECTF--
+Warning: mt_srand() expects at most 1 parameter, 2 given in %s on line 2
+NULL
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line 3
+NULL
+
+Notice: A non well formed numeric value encountered in %s on line 4
+NULL
+
+
+
diff --git a/ext/standard/tests/math/number_format_error.phpt b/ext/standard/tests/math/number_format_error.phpt
new file mode 100644
index 000000000..5ebe12931
--- /dev/null
+++ b/ext/standard/tests/math/number_format_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test number_format() - wrong params test number_format()
+--FILE--
+<?php
+number_format();
+number_format(23,2,true);
+number_format(23,2,true,false,36);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for number_format() in %s on line 2
+
+Warning: Wrong parameter count for number_format() in %s on line 3
+
+Warning: Wrong parameter count for number_format() in %s on line 4
+
diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt
new file mode 100644
index 000000000..8fd57ecfe
--- /dev/null
+++ b/ext/standard/tests/math/octdec_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test octdec() - basic function test octdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$values = array(01234567,
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = octdec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(14489)
+int(253)
+int(36947879)
+int(4618484)
+int(4104)
+int(5349)
+int(342391)
+int(375)
+int(2147483647)
+float(2147483648)
+int(668)
+int(5349)
+int(102923)
+int(823384)
+int(1)
+int(0)
+int(0) \ No newline at end of file
diff --git a/ext/standard/tests/math/octdec_error.phpt b/ext/standard/tests/math/octdec_error.phpt
new file mode 100644
index 000000000..8a3d1759a
--- /dev/null
+++ b/ext/standard/tests/math/octdec_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test octdec() - wrong params test octdec()
+--FILE--
+<?php
+octdec();
+octdec('0123567',true);
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for octdec() in %s on line 2
+
+Warning: Wrong parameter count for octdec() in %s on line 3
diff --git a/ext/standard/tests/math/pi_basic.phpt b/ext/standard/tests/math/pi_basic.phpt
new file mode 100644
index 000000000..fec569137
--- /dev/null
+++ b/ext/standard/tests/math/pi_basic.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test pi() - basic function test pi()
+--INI--
+precision=14
+--FILE--
+<?php
+echo pi(), "\n";
+echo M_PI, "\n";
+// N.B pi() ignores all specified arguments no error
+// messages are produced if arguments are spcified.
+?>
+--EXPECTF--
+3.1415926535898
+3.1415926535898
diff --git a/ext/standard/tests/math/pow_basic.phpt b/ext/standard/tests/math/pow_basic.phpt
new file mode 100644
index 000000000..96864e0ab
--- /dev/null
+++ b/ext/standard/tests/math/pow_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test pow() - basic function test pow()
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = pow($values[$i], 4);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(279841)
+int(279841)
+float(302392.75950625)
+float(302392.75950625)
+int(279841)
+int(279841)
+int(279841)
+float(302392.75950625)
+float(302392.75950625)
+int(0)
+int(1)
+int(0) \ No newline at end of file
diff --git a/ext/standard/tests/math/pow_error.phpt b/ext/standard/tests/math/pow_error.phpt
new file mode 100644
index 000000000..d00173eb4
--- /dev/null
+++ b/ext/standard/tests/math/pow_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test pow() - wrong params test pow()
+--INI--
+precision=14
+--FILE--
+<?php
+pow();
+pow(36);
+pow(36,4,true);
+?>
+--EXPECTF--
+
+Warning: pow() expects exactly 2 parameters, 0 given in %s line 2
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s line 3
+
+Warning: pow() expects exactly 2 parameters, 3 given in %s line 4
+
+
diff --git a/ext/standard/tests/math/rad2deg_basic.phpt b/ext/standard/tests/math/rad2deg_basic.phpt
new file mode 100644
index 000000000..0256ffbd9
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test return type and value for expected input rad2deg()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 0.0;
+$arg_1 = 1.570796327;
+$arg_2 = 3.141592654;
+$arg_3 = 6.283185307;
+
+echo "rad2deg $arg_0= ";
+$r0 = rad2deg($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_1 = ";
+$r1 = rad2deg($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,90.000000011752)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_2 = ";
+$r2 = rad2deg($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,180.0000000235 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_3 = ";
+$r3 = rad2deg($arg_3);
+var_dump($r3);
+if (allowed_rounding_error($r3 ,359.99999998971 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+rad2deg 0= float(%f)
+Pass
+rad2deg 1.570796327 = float(%f)
+Pass
+rad2deg 3.141592654 = float(%f)
+Pass
+rad2deg 6.283185307 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/rad2deg_error.phpt b/ext/standard/tests/math/rad2deg_error.phpt
new file mode 100644
index 000000000..989232106
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for rad2deg()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(rad2deg($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(rad2deg());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for rad2deg() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for rad2deg() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt
new file mode 100644
index 000000000..3fd6ec8cf
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of rad2deg()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test rad2deg 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 = rad2deg($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(1317.802929)
+float(-1317.802929)
+float(1343.58603)
+float(-1343.58603)
+float(1317.802929)
+float(1317.802929)
+float(1317.802929)
+float(1343.58603)
+float(1343.58603)
+float(0)
+float(57295.77951)
+float(57295.77951)
+float(0)
+float(57.29577951)
+float(0)
diff --git a/ext/standard/tests/math/rand_basic.phpt b/ext/standard/tests/math/rand_basic.phpt
new file mode 100644
index 000000000..525956017
--- /dev/null
+++ b/ext/standard/tests/math/rand_basic.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test rand() - basic function test rand()
+--FILE--
+<?php
+$default_max = getrandmax();
+
+echo "\nrand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = rand();
+
+// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+} else {
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
+}
+
+echo "\nrand() tests with defined min and max value\n";
+
+$min = array(10,
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
+
+$max = array(100,
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
+
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], $max[$x]);
+
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
+}
+
+echo "\nNon-numeric cases\n";
+$min = array(true,
+ false,
+ null,
+ "10",
+ "0x10",
+ "10.5");
+
+// Eexepcted numerical equivalent of above non-numerics
+$minval = array(1,
+ 0,
+ 0,
+ 10,
+ 0,
+ 10);
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], 100);
+
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
+}
+?>
+--EXPECTF--
+
+rand() tests with default min and max value (i.e 0 thru %i)
+PASSED: range min = 0 max = %i
+
+rand() tests with defined min and max value
+PASSED: range min = 10 max = 100
+PASSED: range min = 100 max = 1000
+PASSED: range min = 10 max = 19
+PASSED: range min = 10500 max = 1050000
+PASSED: range min = 16 max = 65536
+PASSED: range min = 256 max = 448
+
+Non-numeric cases
+PASSED range min = 1 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
diff --git a/ext/standard/tests/math/rand_error.phpt b/ext/standard/tests/math/rand_error.phpt
new file mode 100644
index 000000000..79aa0112d
--- /dev/null
+++ b/ext/standard/tests/math/rand_error.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test rand() - wrong params test rand()
+--FILE--
+<?php
+rand(25);
+rand(10,100,false);
+rand("one", 100);
+rand(1, "hundered");
+?>
+--EXPECTF--
+
+Warning: rand() expects exactly 2 parameters, 1 given in %s on line 2
+
+Warning: rand() expects exactly 2 parameters, 3 given in %s on line 3
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line 4
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line 5
diff --git a/ext/standard/tests/math/sin_error.phpt b/ext/standard/tests/math/sin_error.phpt
index e2693ea8f..3fdb10af1 100644
--- a/ext/standard/tests/math/sin_error.phpt
+++ b/ext/standard/tests/math/sin_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for sin()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/sinh_error.phpt b/ext/standard/tests/math/sinh_error.phpt
index 415d6b09b..8a3584dfc 100644
--- a/ext/standard/tests/math/sinh_error.phpt
+++ b/ext/standard/tests/math/sinh_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for sinh()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/sqrt_basic.phpt b/ext/standard/tests/math/sqrt_basic.phpt
new file mode 100644
index 000000000..076a11301
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test return type and value for expected input sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 9.0;
+
+var_dump(sqrt($arg_0));
+
+?>
+--EXPECT--
+float(3)
diff --git a/ext/standard/tests/math/sqrt_error.phpt b/ext/standard/tests/math/sqrt_error.phpt
new file mode 100644
index 000000000..318a18a35
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sqrt($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sqrt());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for sqrt() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for sqrt() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/srand_basic.phpt b/ext/standard/tests/math/srand_basic.phpt
new file mode 100644
index 000000000..16aa2dd69
--- /dev/null
+++ b/ext/standard/tests/math/srand_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Maths test for xapic versions of srand()
+--FILE--
+<?php
+// Should return NULL if given anything that it can convert to long
+// This doesn't actually test what it does with the input :-\
+var_dump(srand());
+var_dump(srand(500));
+var_dump(srand(500.1));
+var_dump(srand("500"));
+var_dump(srand("500E3"));
+var_dump(srand(true));
+var_dump(srand(false));
+var_dump(srand(NULL));
+?>
+--EXPECTF--
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/math/srand_error.phpt b/ext/standard/tests/math/srand_error.phpt
new file mode 100644
index 000000000..852867222
--- /dev/null
+++ b/ext/standard/tests/math/srand_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test srand() - wrong params test srand()
+--FILE--
+<?php
+var_dump(mt_srand(500, true));
+var_dump(mt_srand("fivehundred"));
+var_dump(mt_srand("500ABC"));
+?>
+--EXPECTF--
+Warning: mt_srand() expects at most 1 parameter, 2 given in %s on line 2
+NULL
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line 3
+NULL
+
+Notice: A non well formed numeric value encountered in %s on line 4
+NULL
diff --git a/ext/standard/tests/math/tan_error.phpt b/ext/standard/tests/math/tan_error.phpt
index 58dcc2a43..3508f0e78 100644
--- a/ext/standard/tests/math/tan_error.phpt
+++ b/ext/standard/tests/math/tan_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for tan()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/math/tanh_error.phpt b/ext/standard/tests/math/tanh_error.phpt
index 8ce3e9131..f90de5eb5 100644
--- a/ext/standard/tests/math/tanh_error.phpt
+++ b/ext/standard/tests/math/tanh_error.phpt
@@ -1,6 +1,5 @@
--TEST--
Test wrong number of arguments for tanh()
---INI--
--FILE--
<?php
/*
diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt
new file mode 100644
index 000000000..2c54ae994
--- /dev/null
+++ b/ext/standard/tests/network/gethostbyaddr_error.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test gethostbyaddr() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string gethostbyaddr(string ip_address)
+ * Description: Get the Internet host name corresponding to a given IP address
+ * Source code: ext/standard/dns.c
+ * Alias to functions:
+ */
+
+
+echo "Testing gethostbyaddr : error conditions\n";
+
+// Zero arguments
+echo "\n-- Testing gethostbyaddr function with Zero arguments --\n";
+var_dump( gethostbyaddr() );
+
+//Test gethostbyaddr with one more than the expected number of arguments
+echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n";
+$ip_address = 'string_val';
+$extra_arg = 10;
+var_dump( gethostbyaddr($ip_address, $extra_arg) );
+
+echo "\n-- Testing gethostbyaddr function with invalid addresses --\n";
+
+$ip_address = 'invalid';
+var_dump( gethostbyaddr($ip_address) );
+
+$ip_address = '300.1.2.3';
+var_dump( gethostbyaddr($ip_address) );
+
+$ip_address = '256.1.2.3';
+var_dump( gethostbyaddr($ip_address) );
+
+echo "Done";
+?>
+--EXPECTREGEX--
+Testing gethostbyaddr : error conditions
+
+-- Testing gethostbyaddr function with Zero arguments --
+
+Warning: Wrong parameter count for gethostbyaddr\(\) in .* on line \d+
+NULL
+
+-- Testing gethostbyaddr function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for gethostbyaddr\(\) in .* on line \d+
+NULL
+
+-- Testing gethostbyaddr function with invalid addresses --
+
+Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
+bool\(false\)
+
+Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
+bool\(false\)
+
+Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
+bool\(false\)
+Done
diff --git a/ext/standard/tests/network/gethostbynamel_error.phpt b/ext/standard/tests/network/gethostbynamel_error.phpt
new file mode 100644
index 000000000..7e58d5ad5
--- /dev/null
+++ b/ext/standard/tests/network/gethostbynamel_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test gethostbynamel() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array gethostbynamel(string hostname)
+ * Description: Return a list of IP addresses that a given hostname resolves to.
+ * Source code: ext/standard/dns.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gethostbynamel() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gethostbynamel() function with Zero arguments --\n";
+var_dump( gethostbynamel() );
+
+//Test gethostbynamel with one more than the expected number of arguments
+echo "\n-- Testing gethostbynamel() function with more than expected no. of arguments --\n";
+$hostname = 'string_val';
+$extra_arg = 10;
+var_dump( gethostbynamel($hostname, $extra_arg) );
+
+echo "\n-- Testing gethostbynamel() with an unknown host --\n";
+$hostname = 'unknownhost_zzz_xxx_yyy';
+var_dump( gethostbynamel($hostname) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing gethostbynamel() : error conditions ***
+
+-- Testing gethostbynamel() function with Zero arguments --
+
+Warning: Wrong parameter count for gethostbynamel() in %s on line %d
+NULL
+
+-- Testing gethostbynamel() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for gethostbynamel() in %s on line %d
+NULL
+
+-- Testing gethostbynamel() with an unknown host --
+bool(false)
+Done
diff --git a/ext/standard/tests/reg/ereg_basic_001.phpt b/ext/standard/tests/reg/ereg_basic_001.phpt
new file mode 100644
index 000000000..485b2d26e
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_basic_001.phpt
@@ -0,0 +1,127 @@
+--TEST--
+Test ereg() function : basic functionality (with $regs)
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with ereg, specifying $regs
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(ereg($pattern, $string, $regs));
+ var_dump($regs);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+int(6)
+array(3) {
+ [0]=>
+ string(6) "- ab -"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+}
+--> Pattern: '()'; string: ''
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '()'; string: 'abcdef'
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+int(15)
+array(6) {
+ [0]=>
+ string(15) "aaa bbb ccc ddd"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(2) "aa"
+ [3]=>
+ string(3) "bbb"
+ [4]=>
+ string(3) "ccc"
+ [5]=>
+ string(3) "ddd"
+}
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+int(14)
+array(1) {
+ [0]=>
+ string(14) "\`^.[$()|*+?{'"
+}
+--> Pattern: '\a'; string: 'a'
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+int(2)
+array(1) {
+ [0]=>
+ string(2) "2a"
+}
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+int(62)
+array(1) {
+ [0]=>
+ string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+int(5)
+array(1) {
+ [0]=>
+ string(5) "01234"
+}
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+int(5)
+array(1) {
+ [0]=>
+ string(5) "56789"
+}
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+int(2)
+array(1) {
+ [0]=>
+ string(2) " "
+}
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+int(3)
+array(1) {
+ [0]=>
+ string(3) " a "
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_basic_002.phpt b/ext/standard/tests/reg/ereg_basic_002.phpt
new file mode 100644
index 000000000..672632fc7
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_basic_002.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test ereg() function : basic functionality (without $regs)
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with ereg, without specifying $regs
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(ereg($pattern, $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+int(1)
+--> Pattern: '()'; string: ''
+int(1)
+--> Pattern: '()'; string: 'abcdef'
+int(1)
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+int(1)
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+int(1)
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+int(1)
+--> Pattern: '\a'; string: 'a'
+int(1)
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+int(1)
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+int(1)
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+int(1)
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+int(1)
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+int(1)
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+int(1)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_basic_003.phpt b/ext/standard/tests/reg/ereg_basic_003.phpt
new file mode 100644
index 000000000..8c1473883
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_basic_003.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test ereg() function : basic functionality - long RE
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a long RE with lots of matches
+ */
+
+var_dump(ereg(str_repeat('(.)', 2048), str_repeat('x', 2048)));
+var_dump(ereg(str_repeat('(.)', 2048), str_repeat('x', 2048), $regs));
+var_dump(count($regs));
+
+echo "Done";
+?>
+--EXPECTF--
+int(1)
+int(2048)
+int(2049)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_basic_004.phpt b/ext/standard/tests/reg/ereg_basic_004.phpt
new file mode 100644
index 000000000..1356eaf63
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_basic_004.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test ereg() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$regs = 'original';
+
+var_dump(ereg('A', 'a', $regs));
+var_dump(ereg('[A-Z]', '0', $regs));
+var_dump(ereg('(a){4}', 'aaa', $regs));
+var_dump(ereg('^a', 'ba', $regs));
+var_dump(ereg('b$', 'ba', $regs));
+var_dump(ereg('[:alpha:]', 'x', $regs));
+
+// Ensure $regs is unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+string(8) "original"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_error_001.phpt b/ext/standard/tests/reg/ereg_error_001.phpt
new file mode 100644
index 000000000..44bb1f965
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_error_001.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test ereg() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test wrong number of args
+ */
+
+echo "*** Testing ereg() : error conditions ***\n";
+
+
+//Test ereg with one more than the expected number of arguments
+echo "\n-- Testing ereg() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$registers = array(1, 2);
+$extra_arg = 10;
+var_dump( ereg($pattern, $string, $registers, $extra_arg) );
+
+// Testing ereg with one less than the expected number of arguments
+echo "\n-- Testing ereg() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( ereg($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : error conditions ***
+
+-- Testing ereg() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for ereg() in %s on line 21
+NULL
+
+-- Testing ereg() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for ereg() in %s on line 26
+NULL
+Done
diff --git a/ext/standard/tests/reg/ereg_error_002.phpt b/ext/standard/tests/reg/ereg_error_002.phpt
new file mode 100644
index 000000000..61166ee97
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_error_002.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test ereg() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing ereg() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(ereg("", "hello"));
+var_dump(ereg("c(d", "hello"));
+var_dump(ereg("a[b", "hello"));
+var_dump(ereg("c(d", "hello"));
+var_dump(ereg("*", "hello"));
+var_dump(ereg("+", "hello"));
+var_dump(ereg("?", "hello"));
+var_dump(ereg("(+?*)", "hello", $regs));
+var_dump(ereg("h{256}", "hello"));
+var_dump(ereg("h|", "hello"));
+var_dump(ereg("h{0}", "hello"));
+var_dump(ereg("h{2,1}", "hello"));
+var_dump(ereg('[a-c-e]', 'd'));
+var_dump(ereg('\\', 'x'));
+var_dump(ereg('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : error conditions ***
+
+Warning: ereg(): REG_EMPTY in %s on line 16
+bool(false)
+
+Warning: ereg(): REG_EPAREN in %s on line 17
+bool(false)
+
+Warning: ereg(): REG_EBRACK in %s on line 18
+bool(false)
+
+Warning: ereg(): REG_EPAREN in %s on line 19
+bool(false)
+
+Warning: ereg(): REG_BADRPT in %s on line 20
+bool(false)
+
+Warning: ereg(): REG_BADRPT in %s on line 21
+bool(false)
+
+Warning: ereg(): REG_BADRPT in %s on line 22
+bool(false)
+
+Warning: ereg(): REG_BADRPT in %s on line 23
+bool(false)
+
+Warning: ereg(): REG_BADBR in %s on line 24
+bool(false)
+
+Warning: ereg(): REG_EMPTY in %s on line 25
+bool(false)
+
+Warning: ereg(): REG_EMPTY in %s on line 26
+bool(false)
+
+Warning: ereg(): REG_BADBR in %s on line 27
+bool(false)
+
+Warning: ereg(): REG_ERANGE in %s on line 28
+bool(false)
+
+Warning: ereg(): REG_EESCAPE in %s on line 29
+bool(false)
+
+Warning: ereg(): REG_ERANGE in %s on line 30
+bool(false)
+string(8) "original"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_replace_basic_001.phpt b/ext/standard/tests/reg/ereg_replace_basic_001.phpt
new file mode 100644
index 000000000..e0a5dfb7b
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_replace_basic_001.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test ereg_replace() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with ereg_replace
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+$replacement = '[this is a replacement]';
+
+foreach ($expressions as $re) {
+ list($pattern, $match) = $re;
+ echo "--> Pattern: '$pattern'; match: '$match'\n";
+ var_dump(ereg_replace($pattern, $replacement, $match . ' this contains some matches ' . $match));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+string(82) "--[this is a replacement]-- this contains some matches --[this is a replacement]--"
+--> Pattern: '()'; match: ''
+string(695) "[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]"
+--> Pattern: '()'; match: 'abcdef'
+string(983) "[this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement]"
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+string(920) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement]"
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+string(90) "--- [this is a replacement] --- this contains some matches --- [this is a replacement] ---"
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '\a'; match: 'a'
+string(118) "[this is a replacement] this cont[this is a replacement]ins some m[this is a replacement]tches [this is a replacement]"
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+string(152) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ this contains some matches 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+string(66) "[this is a replacement]56789 this contains some matches 0123456789"
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+string(66) "0123456789 this contains some matches 01234[this is a replacement]"
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+string(163) "
+[this is a replacement]this[this is a replacement]contains[this is a replacement]some[this is a replacement]matches[this is a replacement]
+[this is a replacement]"
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+string(254) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement] "
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_replace_basic_002.phpt b/ext/standard/tests/reg/ereg_replace_basic_002.phpt
new file mode 100644
index 000000000..4ef9c4109
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_replace_basic_002.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test ereg_replace() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(ereg_replace('A', $replacement, 'a'));
+var_dump(ereg_replace('[A-Z]', $replacement, '0'));
+var_dump(ereg_replace('(a){4}', $replacement, 'aaa'));
+var_dump(ereg_replace('^a', $replacement, 'ba'));
+var_dump(ereg_replace('b$', $replacement, 'ba'));
+var_dump(ereg_replace('[:alpha:]', $replacement, 'x'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+string(1) "a"
+string(1) "0"
+string(3) "aaa"
+string(2) "ba"
+string(2) "ba"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_replace_error_001.phpt b/ext/standard/tests/reg/ereg_replace_error_001.phpt
new file mode 100644
index 000000000..e6aedf47e
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_replace_error_001.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test ereg_replace() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ereg_replace() : error conditions ***\n";
+
+
+//Test ereg_replace with one more than the expected number of arguments
+echo "\n-- Testing ereg_replace() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+$string = 'string_val';
+$extra_arg = 10;
+var_dump( ereg_replace($pattern, $replacement, $string, $extra_arg) );
+
+// Testing ereg_replace with one less than the expected number of arguments
+echo "\n-- Testing ereg_replace() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+var_dump( ereg_replace($pattern, $replacement) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : error conditions ***
+
+-- Testing ereg_replace() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for ereg_replace() in %s on line 17
+NULL
+
+-- Testing ereg_replace() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for ereg_replace() in %s on line 23
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_replace_error_002.phpt b/ext/standard/tests/reg/ereg_replace_error_002.phpt
new file mode 100644
index 000000000..6e7183c42
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_replace_error_002.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test ereg_replace() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ereg_replace() : bad REs ***\n";
+var_dump(ereg_replace("", "hello", "some string"));
+var_dump(ereg_replace("c(d", "hello", "some string"));
+var_dump(ereg_replace("a[b", "hello", "some string"));
+var_dump(ereg_replace("c(d", "hello", "some string"));;
+var_dump(ereg_replace("*", "hello", "some string"));
+var_dump(ereg_replace("+", "hello", "some string"));
+var_dump(ereg_replace("?", "hello", "some string"));
+var_dump(ereg_replace("(+?*)", "hello", "some string"));
+var_dump(ereg_replace("h{256}", "hello", "some string"));
+var_dump(ereg_replace("h|", "hello", "some string"));
+var_dump(ereg_replace("h{0}", "hello", "some string"));
+var_dump(ereg_replace("h{2,1}", "hello", "some string"));
+var_dump(ereg_replace('[a-c-e]', 'd', "some string"));
+var_dump(ereg_replace('\\', 'x', "some string"));
+var_dump(ereg_replace('([9-0])', '1', "some string"));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : bad REs ***
+
+Warning: ereg_replace(): REG_EMPTY in %s on line 9
+bool(false)
+
+Warning: ereg_replace(): REG_EPAREN in %s on line 10
+bool(false)
+
+Warning: ereg_replace(): REG_EBRACK in %s on line 11
+bool(false)
+
+Warning: ereg_replace(): REG_EPAREN in %s on line 12
+bool(false)
+
+Warning: ereg_replace(): REG_BADRPT in %s on line 13
+bool(false)
+
+Warning: ereg_replace(): REG_BADRPT in %s on line 14
+bool(false)
+
+Warning: ereg_replace(): REG_BADRPT in %s on line 15
+bool(false)
+
+Warning: ereg_replace(): REG_BADRPT in %s on line 16
+bool(false)
+
+Warning: ereg_replace(): REG_BADBR in %s on line 17
+bool(false)
+
+Warning: ereg_replace(): REG_EMPTY in %s on line 18
+bool(false)
+
+Warning: ereg_replace(): REG_EMPTY in %s on line 19
+bool(false)
+
+Warning: ereg_replace(): REG_BADBR in %s on line 20
+bool(false)
+
+Warning: ereg_replace(): REG_ERANGE in %s on line 21
+bool(false)
+
+Warning: ereg_replace(): REG_EESCAPE in %s on line 22
+bool(false)
+
+Warning: ereg_replace(): REG_ERANGE in %s on line 23
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_replace_variation_001.phpt b/ext/standard/tests/reg/ereg_replace_variation_001.phpt
new file mode 100644
index 000000000..446ac86e0
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_replace_variation_001.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test ereg_replace() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$replacement = 'new';
+$string = 'original';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg_replace($value, $replacement, $string) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+string(8) "original"
+
+Arg value 12345
+string(8) "original"
+
+Arg value -2345
+string(8) "original"
+
+Arg value 10.5
+string(8) "original"
+
+Arg value -10.5
+string(8) "original"
+
+Arg value 101234567000
+string(8) "original"
+
+Arg value 1.07654321E-9
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 0.5
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value Array
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value Array
+string(8) "original"
+
+Arg value Array
+string(8) "original"
+
+Arg value Array
+string(8) "original"
+
+Arg value Array
+string(8) "original"
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+string(8) "original"
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+string(8) "original"
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "original"
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_replace_variation_002.phpt b/ext/standard/tests/reg/ereg_replace_variation_002.phpt
new file mode 100644
index 000000000..bd55dbcde
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_replace_variation_002.phpt
@@ -0,0 +1,163 @@
+--TEST--
+Test ereg_replace() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'ell';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for replacement
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump(urlencode(ereg_replace($pattern, $value, $string)));
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(5) "ho%21"
+
+Arg value 1
+string(8) "h%01o%21"
+
+Arg value 12345
+string(6) "h9o%21"
+
+Arg value -2345
+string(8) "h%D7o%21"
+
+Arg value 10.5
+string(8) "h%0Ao%21"
+
+Arg value -10.5
+string(8) "h%F6o%21"
+
+Arg value 101234567000
+string(%d) "h%so%21"
+
+Arg value 1.07654321E-9
+string(5) "ho%21"
+
+Arg value 0.5
+string(5) "ho%21"
+
+Arg value Array
+string(5) "ho%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value 1
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value 1
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_replace_variation_003.phpt b/ext/standard/tests/reg/ereg_replace_variation_003.phpt
new file mode 100644
index 000000000..1d8353599
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_replace_variation_003.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test ereg_replace() function : usage variations - unexpected type arg 3
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$replacement = 'new value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg_replace($pattern, $replacement, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(9) "new value"
+
+Arg value 12345
+string(13) "new value2345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(12) "new value0.5"
+
+Arg value -10.5
+string(13) "-new value0.5"
+
+Arg value 101234567000
+string(28) "new value0new value234567000"
+
+Arg value 1.07654321E-9
+string(29) "new value.0765432new valueE-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(9) "new value"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(9) "new value"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+string(6) "Object"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_variation_001.phpt b/ext/standard/tests/reg/ereg_variation_001.phpt
new file mode 100644
index 000000000..977404d05
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_variation_001.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test ereg() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1';
+$registers = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg($value, $string, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(65)
+Error: 8 - Undefined variable: unset_var, %s(68)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(75)
+Error: 8 - Object of class stdClass to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_variation_002.phpt b/ext/standard/tests/reg/ereg_variation_002.phpt
new file mode 100644
index 000000000..c5f4e8e01
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_variation_002.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test ereg() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$registers = array();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg($pattern, $value, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value 12345
+int(1)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+int(1)
+
+Arg value -10.5
+int(1)
+
+Arg value 101234567000
+int(1)
+
+Arg value 1.07654321E-9
+int(1)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_variation_003.phpt b/ext/standard/tests/reg/ereg_variation_003.phpt
new file mode 100644
index 000000000..42c1ae1bb
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_variation_003.phpt
@@ -0,0 +1,283 @@
+--TEST--
+Test ereg() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'h(.*)lo!';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for registers
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg($pattern, $string, $value) );
+ var_dump($value);
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 0
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 12345
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -2345
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 10.5
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -10.5
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 101234567000
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1.07654321E-9
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 0.5
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/ereg_variation_004.phpt b/ext/standard/tests/reg/ereg_variation_004.phpt
new file mode 100644
index 000000000..cbbb3c15e
--- /dev/null
+++ b/ext/standard/tests/reg/ereg_variation_004.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test ereg() function : usage variations - pass non-variable as arg 3, which is pass-by-ref.
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+var_dump(ereg('l{2}', 'hello', str_repeat('x',1)));
+echo "Done";
+?>
+--EXPECTF--
+
+Strict Standards: Only variables should be passed by reference in %s on line 8
+int(2)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_basic.phpt b/ext/standard/tests/reg/eregi_basic.phpt
new file mode 100644
index 000000000..de1db0ed4
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test eregi() function : basic functionality - confirm case insensitivity
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Case-insensitive regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic funtionality of eregi()
+ */
+
+echo "*** Testing eregi() : basic functionality ***\n";
+$string = <<<END
+UPPERCASE WORDS
+lowercase words
+MIxED CaSe woRdS
+END;
+
+var_dump(eregi('words', $string, $match1));
+var_dump($match1);
+
+var_dump(eregi('[[:lower:]]+[[:space:]]case', $string, $match2)); //character class lower should just match [a-z] but in case insensitive search matches [a-zA-Z]
+var_dump($match2);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : basic functionality ***
+int(5)
+array(1) {
+ [0]=>
+ string(5) "WORDS"
+}
+int(10)
+array(1) {
+ [0]=>
+ string(10) "MIxED CaSe"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_basic_001.phpt b/ext/standard/tests/reg/eregi_basic_001.phpt
new file mode 100644
index 000000000..8557b8111
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_basic_001.phpt
@@ -0,0 +1,127 @@
+--TEST--
+Test eregi() function : basic functionality (with $regs)
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with eregi, specifying $regs
+ */
+
+echo "*** Testing eregi() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(eregi($pattern, $string, $regs));
+ var_dump($regs);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+int(6)
+array(3) {
+ [0]=>
+ string(6) "- ab -"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+}
+--> Pattern: '()'; string: ''
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '()'; string: 'abcdef'
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+int(15)
+array(6) {
+ [0]=>
+ string(15) "aaa bbb ccc ddd"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(2) "aa"
+ [3]=>
+ string(3) "bbb"
+ [4]=>
+ string(3) "ccc"
+ [5]=>
+ string(3) "ddd"
+}
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+int(14)
+array(1) {
+ [0]=>
+ string(14) "\`^.[$()|*+?{'"
+}
+--> Pattern: '\a'; string: 'a'
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+int(2)
+array(1) {
+ [0]=>
+ string(2) "2a"
+}
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+int(62)
+array(1) {
+ [0]=>
+ string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+int(5)
+array(1) {
+ [0]=>
+ string(5) "01234"
+}
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+int(5)
+array(1) {
+ [0]=>
+ string(5) "56789"
+}
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+int(2)
+array(1) {
+ [0]=>
+ string(2) " "
+}
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+int(3)
+array(1) {
+ [0]=>
+ string(3) " a "
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_basic_002.phpt b/ext/standard/tests/reg/eregi_basic_002.phpt
new file mode 100644
index 000000000..8c5d0e471
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_basic_002.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test eregi() function : basic functionality (without $regs)
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with eregi, without specifying $regs
+ */
+
+echo "*** Testing eregi() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(eregi($pattern, $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+int(1)
+--> Pattern: '()'; string: ''
+int(1)
+--> Pattern: '()'; string: 'abcdef'
+int(1)
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+int(1)
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+int(1)
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+int(1)
+--> Pattern: '\a'; string: 'a'
+int(1)
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+int(1)
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+int(1)
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+int(1)
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+int(1)
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+int(1)
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+int(1)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_basic_003.phpt b/ext/standard/tests/reg/eregi_basic_003.phpt
new file mode 100644
index 000000000..a4861caa8
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_basic_003.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test eregi() function : basic functionality - long RE
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a long RE with lots of matches
+ */
+
+var_dump(eregi(str_repeat('(.)', 2048), str_repeat('x', 2048)));
+var_dump(eregi(str_repeat('(.)', 2048), str_repeat('x', 2048), $regs));
+var_dump(count($regs));
+
+echo "Done";
+?>
+--EXPECTF--
+int(1)
+int(2048)
+int(2049)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_basic_004.phpt b/ext/standard/tests/reg/eregi_basic_004.phpt
new file mode 100644
index 000000000..ad411e21f
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_basic_004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test eregi() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$regs = 'original';
+
+var_dump(eregi('[A-Z]', '0', $regs));
+var_dump(eregi('(a){4}', 'aaa', $regs));
+var_dump(eregi('^a', 'ba', $regs));
+var_dump(eregi('b$', 'ba', $regs));
+var_dump(eregi('[:alpha:]', 'x', $regs));
+
+// Ensure $regs is unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+string(8) "original"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_error_001.phpt b/ext/standard/tests/reg/eregi_error_001.phpt
new file mode 100644
index 000000000..a767e24b5
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_error_001.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test eregi() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test wrong number of args
+ */
+
+echo "*** Testing eregi() : error conditions ***\n";
+
+
+//Test eregi with one more than the expected number of arguments
+echo "\n-- Testing eregi() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$registers = array(1, 2);
+$extra_arg = 10;
+var_dump( eregi($pattern, $string, $registers, $extra_arg) );
+
+// Testing eregi with one less than the expected number of arguments
+echo "\n-- Testing eregi() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( eregi($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : error conditions ***
+
+-- Testing eregi() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for eregi() in %s on line 21
+NULL
+
+-- Testing eregi() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for eregi() in %s on line 26
+NULL
+Done
diff --git a/ext/standard/tests/reg/eregi_error_002.phpt b/ext/standard/tests/reg/eregi_error_002.phpt
new file mode 100644
index 000000000..3c3bd7c99
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_error_002.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test eregi() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing eregi() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(eregi("", "hello"));
+var_dump(eregi("c(d", "hello"));
+var_dump(eregi("a[b", "hello"));
+var_dump(eregi("c(d", "hello"));
+var_dump(eregi("*", "hello"));
+var_dump(eregi("+", "hello"));
+var_dump(eregi("?", "hello"));
+var_dump(eregi("(+?*)", "hello", $regs));
+var_dump(eregi("h{256}", "hello"));
+var_dump(eregi("h|", "hello"));
+var_dump(eregi("h{0}", "hello"));
+var_dump(eregi("h{2,1}", "hello"));
+var_dump(eregi('[a-c-e]', 'd'));
+var_dump(eregi('\\', 'x'));
+var_dump(eregi('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : error conditions ***
+
+Warning: eregi(): REG_EMPTY in %s on line 16
+bool(false)
+
+Warning: eregi(): REG_EPAREN in %s on line 17
+bool(false)
+
+Warning: eregi(): REG_EBRACK in %s on line 18
+bool(false)
+
+Warning: eregi(): REG_EPAREN in %s on line 19
+bool(false)
+
+Warning: eregi(): REG_BADRPT in %s on line 20
+bool(false)
+
+Warning: eregi(): REG_BADRPT in %s on line 21
+bool(false)
+
+Warning: eregi(): REG_BADRPT in %s on line 22
+bool(false)
+
+Warning: eregi(): REG_BADRPT in %s on line 23
+bool(false)
+
+Warning: eregi(): REG_BADBR in %s on line 24
+bool(false)
+
+Warning: eregi(): REG_EMPTY in %s on line 25
+bool(false)
+
+Warning: eregi(): REG_EMPTY in %s on line 26
+bool(false)
+
+Warning: eregi(): REG_BADBR in %s on line 27
+bool(false)
+
+Warning: eregi(): REG_ERANGE in %s on line 28
+bool(false)
+
+Warning: eregi(): REG_EESCAPE in %s on line 29
+bool(false)
+
+Warning: eregi(): REG_ERANGE in %s on line 30
+bool(false)
+string(8) "original"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_basic.phpt b/ext/standard/tests/reg/eregi_replace_basic.phpt
new file mode 100644
index 000000000..f9f025fe9
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test eregi_replace() function : basic functionality - confirm case insensitivity
+--FILE--
+
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Case insensitive replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic functionality of eregi_replace()
+ */
+
+echo "*** Testing eregi_replace() : basic functionality ***\n";
+
+$string = 'UPPERCASE WORDS, lowercase words, MIxED CaSe woRdS';
+
+echo "String Before...\n";
+var_dump($string);
+echo "\nString after...\n";
+
+var_dump(eregi_replace('([[:lower:]]+) word', '\\1_character', $string));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing eregi_replace() : basic functionality ***
+String Before...
+string(50) "UPPERCASE WORDS, lowercase words, MIxED CaSe woRdS"
+
+String after...
+string(65) "UPPERCASE_characterS, lowercase_characters, MIxED CaSe_characterS"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_basic_001.phpt b/ext/standard/tests/reg/eregi_replace_basic_001.phpt
new file mode 100644
index 000000000..bffcd0637
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_basic_001.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test ereg() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with eregi_replace
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+$replacement = '[this is a replacement]';
+
+foreach ($expressions as $re) {
+ list($pattern, $match) = $re;
+ echo "--> Pattern: '$pattern'; match: '$match'\n";
+ var_dump(eregi_replace($pattern, $replacement, $match . ' this contains some matches ' . $match));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+string(82) "--[this is a replacement]-- this contains some matches --[this is a replacement]--"
+--> Pattern: '()'; match: ''
+string(695) "[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]"
+--> Pattern: '()'; match: 'abcdef'
+string(983) "[this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement]"
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+string(920) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement]"
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+string(90) "--- [this is a replacement] --- this contains some matches --- [this is a replacement] ---"
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '\a'; match: 'a'
+string(118) "[this is a replacement] this cont[this is a replacement]ins some m[this is a replacement]tches [this is a replacement]"
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+string(152) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ this contains some matches 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+string(66) "[this is a replacement]56789 this contains some matches 0123456789"
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+string(66) "0123456789 this contains some matches 01234[this is a replacement]"
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+string(163) "
+[this is a replacement]this[this is a replacement]contains[this is a replacement]some[this is a replacement]matches[this is a replacement]
+[this is a replacement]"
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+string(254) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement] "
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_basic_002.phpt b/ext/standard/tests/reg/eregi_replace_basic_002.phpt
new file mode 100644
index 000000000..7a4bd3d84
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_basic_002.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test eregi_replace() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(eregi_replace('[A-Z]', $replacement, '0'));
+var_dump(eregi_replace('(a){4}', $replacement, 'aaa'));
+var_dump(eregi_replace('^a', $replacement, 'ba'));
+var_dump(eregi_replace('b$', $replacement, 'ba'));
+var_dump(eregi_replace('[:alpha:]', $replacement, 'x'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+string(1) "0"
+string(3) "aaa"
+string(2) "ba"
+string(2) "ba"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_error_001.phpt b/ext/standard/tests/reg/eregi_replace_error_001.phpt
new file mode 100644
index 000000000..8b7f90d9a
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_error_001.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test eregi_replace() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing eregi_replace() : error conditions ***\n";
+
+
+//Test eregi_replace with one more than the expected number of arguments
+echo "\n-- Testing eregi_replace() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+$string = 'string_val';
+$extra_arg = 10;
+var_dump( eregi_replace($pattern, $replacement, $string, $extra_arg) );
+
+// Testing eregi_replace with one less than the expected number of arguments
+echo "\n-- Testing eregi_replace() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+var_dump( eregi_replace($pattern, $replacement) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : error conditions ***
+
+-- Testing eregi_replace() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for eregi_replace() in %s on line 17
+NULL
+
+-- Testing eregi_replace() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for eregi_replace() in %s on line 23
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_error_002.phpt b/ext/standard/tests/reg/eregi_replace_error_002.phpt
new file mode 100644
index 000000000..35684b8bd
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_error_002.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test eregi_replace() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing eregi_replace() : bad REs ***\n";
+var_dump(eregi_replace("", "hello", "some string"));
+var_dump(eregi_replace("c(d", "hello", "some string"));
+var_dump(eregi_replace("a[b", "hello", "some string"));
+var_dump(eregi_replace("c(d", "hello", "some string"));;
+var_dump(eregi_replace("*", "hello", "some string"));
+var_dump(eregi_replace("+", "hello", "some string"));
+var_dump(eregi_replace("?", "hello", "some string"));
+var_dump(eregi_replace("(+?*)", "hello", "some string"));
+var_dump(eregi_replace("h{256}", "hello", "some string"));
+var_dump(eregi_replace("h|", "hello", "some string"));
+var_dump(eregi_replace("h{0}", "hello", "some string"));
+var_dump(eregi_replace("h{2,1}", "hello", "some string"));
+var_dump(eregi_replace('[a-c-e]', 'd', "some string"));
+var_dump(eregi_replace('\\', 'x', "some string"));
+var_dump(eregi_replace('([9-0])', '1', "some string"));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : bad REs ***
+
+Warning: eregi_replace(): REG_EMPTY in %s on line 9
+bool(false)
+
+Warning: eregi_replace(): REG_EPAREN in %s on line 10
+bool(false)
+
+Warning: eregi_replace(): REG_EBRACK in %s on line 11
+bool(false)
+
+Warning: eregi_replace(): REG_EPAREN in %s on line 12
+bool(false)
+
+Warning: eregi_replace(): REG_BADRPT in %s on line 13
+bool(false)
+
+Warning: eregi_replace(): REG_BADRPT in %s on line 14
+bool(false)
+
+Warning: eregi_replace(): REG_BADRPT in %s on line 15
+bool(false)
+
+Warning: eregi_replace(): REG_BADRPT in %s on line 16
+bool(false)
+
+Warning: eregi_replace(): REG_BADBR in %s on line 17
+bool(false)
+
+Warning: eregi_replace(): REG_EMPTY in %s on line 18
+bool(false)
+
+Warning: eregi_replace(): REG_EMPTY in %s on line 19
+bool(false)
+
+Warning: eregi_replace(): REG_BADBR in %s on line 20
+bool(false)
+
+Warning: eregi_replace(): REG_ERANGE in %s on line 21
+bool(false)
+
+Warning: eregi_replace(): REG_EESCAPE in %s on line 22
+bool(false)
+
+Warning: eregi_replace(): REG_ERANGE in %s on line 23
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_variation_001.phpt b/ext/standard/tests/reg/eregi_replace_variation_001.phpt
new file mode 100644
index 000000000..87f9aa277
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_variation_001.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test eregi_replace() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$replacement = 'new';
+$string = 'original';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi_replace($value, $replacement, $string) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+string(8) "original"
+
+Arg value 12345
+string(8) "original"
+
+Arg value -2345
+string(8) "original"
+
+Arg value 10.5
+string(8) "original"
+
+Arg value -10.5
+string(8) "original"
+
+Arg value 101234567000
+string(8) "original"
+
+Arg value 1.07654321E-9
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 0.5
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value Array
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value Array
+string(8) "original"
+
+Arg value Array
+string(8) "original"
+
+Arg value Array
+string(8) "original"
+
+Arg value Array
+string(8) "original"
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+string(8) "original"
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+string(8) "original"
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "original"
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_variation_002.phpt b/ext/standard/tests/reg/eregi_replace_variation_002.phpt
new file mode 100644
index 000000000..786de9978
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_variation_002.phpt
@@ -0,0 +1,163 @@
+--TEST--
+Test eregi_replace() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'ell';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for replacement
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump(urlencode(eregi_replace($pattern, $value, $string)));
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(5) "ho%21"
+
+Arg value 1
+string(8) "h%01o%21"
+
+Arg value 12345
+string(6) "h9o%21"
+
+Arg value -2345
+string(8) "h%D7o%21"
+
+Arg value 10.5
+string(8) "h%0Ao%21"
+
+Arg value -10.5
+string(8) "h%F6o%21"
+
+Arg value 101234567000
+string(%d) "h%so%21"
+
+Arg value 1.07654321E-9
+string(5) "ho%21"
+
+Arg value 0.5
+string(5) "ho%21"
+
+Arg value Array
+string(5) "ho%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value Array
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value 1
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value 1
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+string(5) "ho%21"
+
+Arg value
+string(5) "ho%21"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_replace_variation_003.phpt b/ext/standard/tests/reg/eregi_replace_variation_003.phpt
new file mode 100644
index 000000000..f4426fd3c
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_replace_variation_003.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test eregi_replace() function : usage variations - unexpected type arg 3
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$replacement = 'new value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi_replace($pattern, $replacement, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(9) "new value"
+
+Arg value 12345
+string(13) "new value2345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(12) "new value0.5"
+
+Arg value -10.5
+string(13) "-new value0.5"
+
+Arg value 101234567000
+string(28) "new value0new value234567000"
+
+Arg value 1.07654321E-9
+string(29) "new value.0765432new valueE-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+string(5) "Array"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(9) "new value"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(9) "new value"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+string(6) "Object"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_variation_001.phpt b/ext/standard/tests/reg/eregi_variation_001.phpt
new file mode 100644
index 000000000..ea8b8440d
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_variation_001.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test eregi() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing eregi() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1';
+$registers = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi($value, $string, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(65)
+Error: 8 - Undefined variable: unset_var, %s(68)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(75)
+Error: 8 - Object of class stdClass to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_variation_002.phpt b/ext/standard/tests/reg/eregi_variation_002.phpt
new file mode 100644
index 000000000..766a48abd
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_variation_002.phpt
@@ -0,0 +1,169 @@
+--TEST--
+Test eregi() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$registers = array();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi($pattern, $value, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value 12345
+int(1)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+int(1)
+
+Arg value -10.5
+int(1)
+
+Arg value 101234567000
+int(1)
+
+Arg value 1.07654321E-9
+int(1)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+bool(false)
+
+Arg value 1
+int(1)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+bool(false)
+
+Arg value
+bool(false)
+
+Arg value
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_variation_003.phpt b/ext/standard/tests/reg/eregi_variation_003.phpt
new file mode 100644
index 000000000..43785871a
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_variation_003.phpt
@@ -0,0 +1,283 @@
+--TEST--
+Test eregi() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'h(.*)lo!';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for registers
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi($pattern, $string, $value) );
+ var_dump($value);
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 0
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 12345
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -2345
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 10.5
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -10.5
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 101234567000
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1.07654321E-9
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 0.5
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/eregi_variation_004.phpt b/ext/standard/tests/reg/eregi_variation_004.phpt
new file mode 100644
index 000000000..bf4f03695
--- /dev/null
+++ b/ext/standard/tests/reg/eregi_variation_004.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test eregi() function : usage variations - pass non-variable as arg 3, which is pass-by-ref.
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+var_dump(eregi('l{2}', 'hello', str_repeat('x',1)));
+echo "Done";
+?>
+--EXPECTF--
+
+Strict Standards: Only variables should be passed by reference in %s on line 8
+int(2)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/regular_expressions.inc b/ext/standard/tests/reg/regular_expressions.inc
new file mode 100644
index 000000000..98fae4b11
--- /dev/null
+++ b/ext/standard/tests/reg/regular_expressions.inc
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * POSIX regular expressions each coupled with a string that they match,
+ * based on documentation on http://www.tin.org/bin/man.cgi?section=7&topic=regex .
+ */
+$expressions = array(
+ //array(pattern, string to match)
+ array('..(a|b|c)(a|b|c)..', '--- ab ---'),
+ array('()', ''),
+ array('()', 'abcdef'),
+ array('[x]|[^x]', 'abcdef'),
+ array('(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)', '--- aaa bbb ccc ddd ---'),
+ array('\\\\\`\^\.\[\$\(\)\|\*\+\?\{\\\'', '\\`^.[$()|*+?{\''),
+ array('\\a', 'a'),
+ array('[0-9][^0-9]', '2a'),
+ array('^[[:alnum:]]{62,62}$', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'),
+ array('^[[:digit:]]{5}', '0123456789'),
+ array('[[:digit:]]{5}$', '0123456789'),
+ array('[[:blank:]]{1,10}', "\n \t"),
+ array('[[:print:]]{3}', " a "),
+);
+
+?> \ No newline at end of file
diff --git a/ext/standard/tests/reg/split_basic_001.phpt b/ext/standard/tests/reg/split_basic_001.phpt
new file mode 100644
index 000000000..e122e2c15
--- /dev/null
+++ b/ext/standard/tests/reg/split_basic_001.phpt
@@ -0,0 +1,129 @@
+--TEST--
+Test split() function : basic functionality - test a number of simple split, specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple split, specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(split($pattern, $string . ' |1| ' . $string . ' |2| ' . $string, 2));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+array(2) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(32) "-- |1| --- ab --- |2| --- ab ---"
+}
+
+--> Pattern: '()'; match: ''
+
+Warning: split(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Warning: split(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(27) "bcdef |1| abcdef |2| abcdef"
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(60) " --- |1| --- aaa bbb ccc ddd --- |2| --- aaa bbb ccc ddd ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'"
+}
+
+--> Pattern: '\a'; match: 'a'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(12) " |1| a |2| a"
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(14) " |1| 2a |2| 2a"
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(35) "56789 |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+array(2) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(15) "|1|
+ |2|
+ "
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(16) " |1| a |2| a "
+}
+Done
diff --git a/ext/standard/tests/reg/split_basic_002.phpt b/ext/standard/tests/reg/split_basic_002.phpt
new file mode 100644
index 000000000..110007d3e
--- /dev/null
+++ b/ext/standard/tests/reg/split_basic_002.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test split() function : basic functionality - test a number of simple split, without specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple split, without specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(split($pattern, $string . ' |1| ' . $string . ' |2| ' . $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+array(4) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(9) "-- |1| --"
+ [2]=>
+ string(9) "-- |2| --"
+ [3]=>
+ string(2) "--"
+}
+
+--> Pattern: '()'; match: ''
+
+Warning: split(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Warning: split(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+array(29) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(0) ""
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+ [10]=>
+ string(0) ""
+ [11]=>
+ string(0) ""
+ [12]=>
+ string(0) ""
+ [13]=>
+ string(0) ""
+ [14]=>
+ string(0) ""
+ [15]=>
+ string(0) ""
+ [16]=>
+ string(0) ""
+ [17]=>
+ string(0) ""
+ [18]=>
+ string(0) ""
+ [19]=>
+ string(0) ""
+ [20]=>
+ string(0) ""
+ [21]=>
+ string(0) ""
+ [22]=>
+ string(0) ""
+ [23]=>
+ string(0) ""
+ [24]=>
+ string(0) ""
+ [25]=>
+ string(0) ""
+ [26]=>
+ string(0) ""
+ [27]=>
+ string(0) ""
+ [28]=>
+ string(0) ""
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+array(4) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(13) " --- |1| --- "
+ [2]=>
+ string(13) " --- |2| --- "
+ [3]=>
+ string(4) " ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '\a'; match: 'a'
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+array(6) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(2) " |"
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(2) " |"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(30) " |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+array(6) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(3) "|1|"
+ [2]=>
+ string(1) "
+"
+ [3]=>
+ string(3) "|2|"
+ [4]=>
+ string(1) "
+"
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) " "
+}
+Done
diff --git a/ext/standard/tests/reg/split_basic_003.phpt b/ext/standard/tests/reg/split_basic_003.phpt
new file mode 100644
index 000000000..4d36fcddb
--- /dev/null
+++ b/ext/standard/tests/reg/split_basic_003.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test split() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(split('A', '-- a --'));
+var_dump(split('[A-Z]', '-- 0 --'));
+var_dump(split('(a){4}', '--- aaa ---'));
+var_dump(split('^a', '--- ba ---'));
+var_dump(split('b$', '--- ba ---'));
+var_dump(split('[:alpha:]', '--- x ---'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ string(7) "-- a --"
+}
+array(1) {
+ [0]=>
+ string(7) "-- 0 --"
+}
+array(1) {
+ [0]=>
+ string(11) "--- aaa ---"
+}
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+array(1) {
+ [0]=>
+ string(9) "--- x ---"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/split_error_001.phpt b/ext/standard/tests/reg/split_error_001.phpt
new file mode 100644
index 000000000..ff8e6cbdd
--- /dev/null
+++ b/ext/standard/tests/reg/split_error_001.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test split() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing split() : error conditions - wrong number of args ***\n";
+
+
+//Test split with one more than the expected number of arguments
+echo "\n-- Testing split() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$limit = 10;
+$extra_arg = 10;
+var_dump( split($pattern, $string, $limit, $extra_arg) );
+
+// Testing split with one less than the expected number of arguments
+echo "\n-- Testing split() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( split($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : error conditions - wrong number of args ***
+
+-- Testing split() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for split() in %s on line 17
+NULL
+
+-- Testing split() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for split() in %s on line 22
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/split_error_002.phpt b/ext/standard/tests/reg/split_error_002.phpt
new file mode 100644
index 000000000..8c4ce345d
--- /dev/null
+++ b/ext/standard/tests/reg/split_error_002.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test split() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing split() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(split("", "hello"));
+var_dump(split("c(d", "hello"));
+var_dump(split("a[b", "hello"));
+var_dump(split("c(d", "hello"));
+var_dump(split("*", "hello"));
+var_dump(split("+", "hello"));
+var_dump(split("?", "hello"));
+var_dump(split("(+?*)", "hello", $regs));
+var_dump(split("h{256}", "hello"));
+var_dump(split("h|", "hello"));
+var_dump(split("h{0}", "hello"));
+var_dump(split("h{2,1}", "hello"));
+var_dump(split('[a-c-e]', 'd'));
+var_dump(split('\\', 'x'));
+var_dump(split('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : error conditions ***
+
+Warning: split(): REG_EMPTY in %s on line 16
+bool(false)
+
+Warning: split(): REG_EPAREN in %s on line 17
+bool(false)
+
+Warning: split(): REG_EBRACK in %s on line 18
+bool(false)
+
+Warning: split(): REG_EPAREN in %s on line 19
+bool(false)
+
+Warning: split(): REG_BADRPT in %s on line 20
+bool(false)
+
+Warning: split(): REG_BADRPT in %s on line 21
+bool(false)
+
+Warning: split(): REG_BADRPT in %s on line 22
+bool(false)
+
+Warning: split(): REG_BADRPT in %s on line 23
+bool(false)
+
+Warning: split(): REG_BADBR in %s on line 24
+bool(false)
+
+Warning: split(): REG_EMPTY in %s on line 25
+bool(false)
+
+Warning: split(): REG_EMPTY in %s on line 26
+bool(false)
+
+Warning: split(): REG_BADBR in %s on line 27
+bool(false)
+
+Warning: split(): REG_ERANGE in %s on line 28
+bool(false)
+
+Warning: split(): REG_EESCAPE in %s on line 29
+bool(false)
+
+Warning: split(): REG_ERANGE in %s on line 30
+bool(false)
+string(8) "original"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/split_variation_001.phpt b/ext/standard/tests/reg/split_variation_001.phpt
new file mode 100644
index 000000000..625bf0625
--- /dev/null
+++ b/ext/standard/tests/reg/split_variation_001.phpt
@@ -0,0 +1,256 @@
+--TEST--
+Test split() function : usage variations - unexpected type for arg 1
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1 a 1 Array 1 c ';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( split($value, $string, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value 12345
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -2345
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 10.5
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -10.5
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 101234567000
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1.07654321E-9
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 0.5
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/split_variation_002.phpt b/ext/standard/tests/reg/split_variation_002.phpt
new file mode 100644
index 000000000..d7fa8445b
--- /dev/null
+++ b/ext/standard/tests/reg/split_variation_002.phpt
@@ -0,0 +1,268 @@
+--TEST--
+Test split() function : usage variations - unexpected type for arg 2
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'r|j|E';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( split($pattern, $value, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value 12345
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+
+Arg value -2345
+array(1) {
+ [0]=>
+ string(5) "-2345"
+}
+
+Arg value 10.5
+array(1) {
+ [0]=>
+ string(4) "10.5"
+}
+
+Arg value -10.5
+array(1) {
+ [0]=>
+ string(5) "-10.5"
+}
+
+Arg value 101234567000
+array(1) {
+ [0]=>
+ string(12) "101234567000"
+}
+
+Arg value 1.07654321E-9
+array(2) {
+ [0]=>
+ string(10) "1.07654321"
+ [1]=>
+ string(2) "-9"
+}
+
+Arg value 0.5
+array(1) {
+ [0]=>
+ string(3) "0.5"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(2) "Ob"
+ [1]=>
+ string(3) "ect"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Done
diff --git a/ext/standard/tests/reg/split_variation_003.phpt b/ext/standard/tests/reg/split_variation_003.phpt
new file mode 100644
index 000000000..7686c0886
--- /dev/null
+++ b/ext/standard/tests/reg/split_variation_003.phpt
@@ -0,0 +1,225 @@
+--TEST--
+Test split() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+echo "*** Testing split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '[[:space:]]';
+$string = '1 2 3 4 5';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through each element of the array for limit
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( split($pattern, $string, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+
+Arg value 10.5
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ [4]=>
+ string(1) "5"
+}
+
+Arg value -10.5
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1.07654321E-9
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 0.5
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value string
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value string
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
+
+Arg value
+Error: 8 - Object of class stdClass could not be converted to int, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/split_variation_004.phpt b/ext/standard/tests/reg/split_variation_004.phpt
new file mode 100644
index 000000000..537070908
--- /dev/null
+++ b/ext/standard/tests/reg/split_variation_004.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test split() function : usage variations - out-of-range values for limit
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+echo "*** Testing split() : usage variations ***\n";
+
+$pattern = '[[:space:]]';
+$string = '1 2 3 4 5';
+var_dump(split($pattern, $string, 0));
+var_dump(split($pattern, $string, -10));
+var_dump(split($pattern, $string, 10E20));
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/spliti_basic_001.phpt b/ext/standard/tests/reg/spliti_basic_001.phpt
new file mode 100644
index 000000000..04f138d4e
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_basic_001.phpt
@@ -0,0 +1,129 @@
+--TEST--
+Test spliti() function : basic functionality - test a number of simple spliti, specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple spliti, specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(spliti($pattern, $string . ' |1| ' . $string . ' |2| ' . $string, 2));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+array(2) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(32) "-- |1| --- ab --- |2| --- ab ---"
+}
+
+--> Pattern: '()'; match: ''
+
+Warning: spliti(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Warning: spliti(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(27) "bcdef |1| abcdef |2| abcdef"
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(60) " --- |1| --- aaa bbb ccc ddd --- |2| --- aaa bbb ccc ddd ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'"
+}
+
+--> Pattern: '\a'; match: 'a'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(12) " |1| a |2| a"
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(14) " |1| 2a |2| 2a"
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(35) "56789 |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+array(2) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(15) "|1|
+ |2|
+ "
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(16) " |1| a |2| a "
+}
+Done
diff --git a/ext/standard/tests/reg/spliti_basic_002.phpt b/ext/standard/tests/reg/spliti_basic_002.phpt
new file mode 100644
index 000000000..79784d324
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_basic_002.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test spliti() function : basic functionality - test a number of simple spliti, without specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple spliti, without specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(spliti($pattern, $string . ' |1| ' . $string . ' |2| ' . $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+array(4) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(9) "-- |1| --"
+ [2]=>
+ string(9) "-- |2| --"
+ [3]=>
+ string(2) "--"
+}
+
+--> Pattern: '()'; match: ''
+
+Warning: spliti(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Warning: spliti(): Invalid Regular Expression in %s on line 19
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+array(29) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(0) ""
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+ [10]=>
+ string(0) ""
+ [11]=>
+ string(0) ""
+ [12]=>
+ string(0) ""
+ [13]=>
+ string(0) ""
+ [14]=>
+ string(0) ""
+ [15]=>
+ string(0) ""
+ [16]=>
+ string(0) ""
+ [17]=>
+ string(0) ""
+ [18]=>
+ string(0) ""
+ [19]=>
+ string(0) ""
+ [20]=>
+ string(0) ""
+ [21]=>
+ string(0) ""
+ [22]=>
+ string(0) ""
+ [23]=>
+ string(0) ""
+ [24]=>
+ string(0) ""
+ [25]=>
+ string(0) ""
+ [26]=>
+ string(0) ""
+ [27]=>
+ string(0) ""
+ [28]=>
+ string(0) ""
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+array(4) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(13) " --- |1| --- "
+ [2]=>
+ string(13) " --- |2| --- "
+ [3]=>
+ string(4) " ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '\a'; match: 'a'
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+array(6) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(2) " |"
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(2) " |"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(30) " |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+array(6) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(3) "|1|"
+ [2]=>
+ string(1) "
+"
+ [3]=>
+ string(3) "|2|"
+ [4]=>
+ string(1) "
+"
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) " "
+}
+Done
diff --git a/ext/standard/tests/reg/spliti_basic_003.phpt b/ext/standard/tests/reg/spliti_basic_003.phpt
new file mode 100644
index 000000000..143f1a196
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_basic_003.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test spliti() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(spliti('[A-Z]', '-- 0 --'));
+var_dump(spliti('(a){4}', '--- aaa ---'));
+var_dump(spliti('^a', '--- ba ---'));
+var_dump(spliti('b$', '--- ba ---'));
+var_dump(spliti('[:alpha:]', '--- x ---'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ string(7) "-- 0 --"
+}
+array(1) {
+ [0]=>
+ string(11) "--- aaa ---"
+}
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+array(1) {
+ [0]=>
+ string(9) "--- x ---"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/spliti_basic_004.phpt b/ext/standard/tests/reg/spliti_basic_004.phpt
new file mode 100644
index 000000000..95edc158d
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_basic_004.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test spliti() function : basic functionality - confirm case insensitivity
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(spliti('[a-z]', '--- A ---'));
+var_dump(spliti('[A-Z]', '--- a ---'));
+var_dump(spliti('[[:lower:]]', '--- A ---'));
+var_dump(spliti('[[:upper:]]', '--- a ---'));
+
+echo "Done";
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/spliti_error_001.phpt b/ext/standard/tests/reg/spliti_error_001.phpt
new file mode 100644
index 000000000..44d2be618
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_error_001.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test spliti() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing spliti() : error conditions - wrong number of args ***\n";
+
+
+//Test spliti with one more than the expected number of arguments
+echo "\n-- Testing spliti() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$limit = 10;
+$extra_arg = 10;
+var_dump( spliti($pattern, $string, $limit, $extra_arg) );
+
+// Testing spliti with one less than the expected number of arguments
+echo "\n-- Testing spliti() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( spliti($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : error conditions - wrong number of args ***
+
+-- Testing spliti() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for spliti() in %s on line 17
+NULL
+
+-- Testing spliti() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for spliti() in %s on line 22
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/spliti_error_002.phpt b/ext/standard/tests/reg/spliti_error_002.phpt
new file mode 100644
index 000000000..030fb2b24
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_error_002.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test spliti() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing spliti() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(spliti("", "hello"));
+var_dump(spliti("c(d", "hello"));
+var_dump(spliti("a[b", "hello"));
+var_dump(spliti("c(d", "hello"));
+var_dump(spliti("*", "hello"));
+var_dump(spliti("+", "hello"));
+var_dump(spliti("?", "hello"));
+var_dump(spliti("(+?*)", "hello", $regs));
+var_dump(spliti("h{256}", "hello"));
+var_dump(spliti("h|", "hello"));
+var_dump(spliti("h{0}", "hello"));
+var_dump(spliti("h{2,1}", "hello"));
+var_dump(spliti('[a-c-e]', 'd'));
+var_dump(spliti('\\', 'x'));
+var_dump(spliti('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : error conditions ***
+
+Warning: spliti(): REG_EMPTY in %s on line 16
+bool(false)
+
+Warning: spliti(): REG_EPAREN in %s on line 17
+bool(false)
+
+Warning: spliti(): REG_EBRACK in %s on line 18
+bool(false)
+
+Warning: spliti(): REG_EPAREN in %s on line 19
+bool(false)
+
+Warning: spliti(): REG_BADRPT in %s on line 20
+bool(false)
+
+Warning: spliti(): REG_BADRPT in %s on line 21
+bool(false)
+
+Warning: spliti(): REG_BADRPT in %s on line 22
+bool(false)
+
+Warning: spliti(): REG_BADRPT in %s on line 23
+bool(false)
+
+Warning: spliti(): REG_BADBR in %s on line 24
+bool(false)
+
+Warning: spliti(): REG_EMPTY in %s on line 25
+bool(false)
+
+Warning: spliti(): REG_EMPTY in %s on line 26
+bool(false)
+
+Warning: spliti(): REG_BADBR in %s on line 27
+bool(false)
+
+Warning: spliti(): REG_ERANGE in %s on line 28
+bool(false)
+
+Warning: spliti(): REG_EESCAPE in %s on line 29
+bool(false)
+
+Warning: spliti(): REG_ERANGE in %s on line 30
+bool(false)
+string(8) "original"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/spliti_variation_001.phpt b/ext/standard/tests/reg/spliti_variation_001.phpt
new file mode 100644
index 000000000..b9b15b589
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_variation_001.phpt
@@ -0,0 +1,256 @@
+--TEST--
+Test spliti() function : usage variations - unexpected type for arg 1
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing spliti() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1 a 1 Array 1 c ';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( spliti($value, $string, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value 12345
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -2345
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 10.5
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -10.5
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 101234567000
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1.07654321E-9
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 0.5
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(2) {
+ [0]=>
+ string(6) "1 a 1 "
+ [1]=>
+ string(5) " 1 c "
+}
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/spliti_variation_002.phpt b/ext/standard/tests/reg/spliti_variation_002.phpt
new file mode 100644
index 000000000..a1e51bdb6
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_variation_002.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test spliti() function : usage variations - unexpected type for arg 2
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing spliti() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'r|j|E';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( spliti($pattern, $value, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value 12345
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+
+Arg value -2345
+array(1) {
+ [0]=>
+ string(5) "-2345"
+}
+
+Arg value 10.5
+array(1) {
+ [0]=>
+ string(4) "10.5"
+}
+
+Arg value -10.5
+array(1) {
+ [0]=>
+ string(5) "-10.5"
+}
+
+Arg value 101234567000
+array(1) {
+ [0]=>
+ string(12) "101234567000"
+}
+
+Arg value 1.07654321E-9
+array(2) {
+ [0]=>
+ string(10) "1.07654321"
+ [1]=>
+ string(2) "-9"
+}
+
+Arg value 0.5
+array(1) {
+ [0]=>
+ string(3) "0.5"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ay"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+Error: 8 - Object of class stdClass to string conversion, %s(74)
+array(3) {
+ [0]=>
+ string(2) "Ob"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(2) "ct"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Done
diff --git a/ext/standard/tests/reg/spliti_variation_003.phpt b/ext/standard/tests/reg/spliti_variation_003.phpt
new file mode 100644
index 000000000..e6c8f10b5
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_variation_003.phpt
@@ -0,0 +1,225 @@
+--TEST--
+Test spliti() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+echo "*** Testing spliti() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '[[:space:]]';
+$string = '1 2 3 4 5';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through each element of the array for limit
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( spliti($pattern, $string, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+
+Arg value 10.5
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ [4]=>
+ string(1) "5"
+}
+
+Arg value -10.5
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1.07654321E-9
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 0.5
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value Array
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value string
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value string
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
+
+Arg value
+Error: 8 - Object of class stdClass could not be converted to int, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/spliti_variation_004.phpt b/ext/standard/tests/reg/spliti_variation_004.phpt
new file mode 100644
index 000000000..e6c8e3c21
--- /dev/null
+++ b/ext/standard/tests/reg/spliti_variation_004.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test spliti() function : usage variations - out-of-range values for limit
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+echo "*** Testing spliti() : usage variations ***\n";
+
+$pattern = '[[:space:]]';
+$string = '1 2 3 4 5';
+var_dump(spliti($pattern, $string, 0));
+var_dump(spliti($pattern, $string, -10));
+var_dump(spliti($pattern, $string, 10E20));
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/sql_regcase_basic_001.phpt b/ext/standard/tests/reg/sql_regcase_basic_001.phpt
new file mode 100644
index 000000000..7657fa28c
--- /dev/null
+++ b/ext/standard/tests/reg/sql_regcase_basic_001.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test sql_regcase() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto string sql_regcase(string string)
+ * Description: Make regular expression for case insensitive match
+ * Source code: ext/standard/reg.c
+ * Alias to functions: msql_regcase
+ */
+
+echo "*** Testing sql_regcase() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$string = 'string_Val-0';
+
+// Calling sql_regcase() with all possible arguments
+var_dump( sql_regcase($string) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sql_regcase() : basic functionality ***
+string(39) "[Ss][Tt][Rr][Ii][Nn][Gg]_[Vv][Aa][Ll]-0"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/sql_regcase_error_001.phpt b/ext/standard/tests/reg/sql_regcase_error_001.phpt
new file mode 100644
index 000000000..3ab9fd8db
--- /dev/null
+++ b/ext/standard/tests/reg/sql_regcase_error_001.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test sql_regcase() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string sql_regcase(string string)
+ * Description: Make regular expression for case insensitive match
+ * Source code: ext/standard/reg.c
+ * Alias to functions: msql_regcase
+ */
+
+echo "*** Testing sql_regcase() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing sql_regcase() function with Zero arguments --\n";
+var_dump( sql_regcase() );
+
+//Test sql_regcase with one more than the expected number of arguments
+echo "\n-- Testing sql_regcase() function with more than expected no. of arguments --\n";
+$string = 'string_val';
+$extra_arg = 10;
+var_dump( sql_regcase($string, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sql_regcase() : error conditions ***
+
+-- Testing sql_regcase() function with Zero arguments --
+
+Warning: Wrong parameter count for sql_regcase() in %s on line 12
+NULL
+
+-- Testing sql_regcase() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for sql_regcase() in %s on line 18
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/reg/sql_regcase_variation_001.phpt b/ext/standard/tests/reg/sql_regcase_variation_001.phpt
new file mode 100644
index 000000000..ed0bef06d
--- /dev/null
+++ b/ext/standard/tests/reg/sql_regcase_variation_001.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test sql_regcase() function : usage variations - unexpected arg type
+--FILE--
+<?php
+/* Prototype : proto string sql_regcase(string string)
+ * Description: Make regular expression for case insensitive match
+ * Source code: ext/standard/reg.c
+ * Alias to functions: msql_regcase
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing sql_regcase() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( sql_regcase($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sql_regcase() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(62)
+Error: 8 - Undefined variable: unset_var, %s(65)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(16) "1.07654321[Ee]-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(72)
+string(20) "[Aa][Rr][Rr][Aa][Yy]"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(72)
+string(20) "[Aa][Rr][Rr][Aa][Yy]"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(72)
+string(20) "[Aa][Rr][Rr][Aa][Yy]"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(72)
+string(20) "[Aa][Rr][Rr][Aa][Yy]"
+
+Arg value Array
+Error: 8 - Array to string conversion, %s(72)
+string(20) "[Aa][Rr][Rr][Aa][Yy]"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(71)
+
+Arg value
+Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
+Error: 8 - Object of class stdClass to string conversion, %s(72)
+string(24) "[Oo][Bb][Jj][Ee][Cc][Tt]"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt
index d67f6fbf7..e7b23db70 100755
--- a/ext/standard/tests/serialize/005.phpt
+++ b/ext/standard/tests/serialize/005.phpt
@@ -179,7 +179,7 @@ do_autoload(autoload_not_available)
do_autoload(autoload_not_available)
Warning: unserialize(): Function unserializer() hasn't defined the class it was called for in %s005.php on line %d
-object(__PHP_Incomplete_Class)#1 (1) {
+object(__PHP_Incomplete_Class)#%d (1) {
["__PHP_Incomplete_Class_Name"]=>
string(22) "autoload_not_available"
}
diff --git a/ext/standard/tests/serialize/bug43614.phpt b/ext/standard/tests/serialize/bug43614.phpt
new file mode 100644
index 000000000..127dfba58
--- /dev/null
+++ b/ext/standard/tests/serialize/bug43614.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #43614 (incorrect processing of numerical string keys of array in arbitrary serialized data)
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+var_dump($a = unserialize('a:2:{s:2:"10";i:1;s:2:"01";i:2;}'));
+var_dump($a['10']);
+var_dump($a['01']);
+
+?>
+--EXPECT--
+array(2) {
+ [10]=>
+ int(1)
+ ["01"]=>
+ int(2)
+}
+int(1)
+int(2)
diff --git a/ext/standard/tests/serialize/serialization_arrays_001.phpt b/ext/standard/tests/serialize/serialization_arrays_001.phpt
new file mode 100644
index 000000000..e39954277
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_001.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test serialize() & unserialize() functions: arrays (circular references)
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n--- Testing Circular reference of an array ---\n";
+
+echo "-- Normal array --\n";
+$arr_circ = array(0, 1, -2, 3.333333, "a", array(), &$arr_circ);
+$serialize_data = serialize($arr_circ);
+$arr_circ[6] = null;
+var_dump( $serialize_data );
+$arr_circ = unserialize($serialize_data);
+var_dump( $arr_circ );
+$arr_circ[6] = null;
+
+echo "\n-- Associative array --\n";
+$arr_asso = array("a" => "test");
+$arr_asso[ "b" ] = &$arr_asso[ "a" ];
+var_dump($arr_asso);
+$serialize_data = serialize($arr_asso);
+var_dump($serialize_data);
+$arr_asso = unserialize($serialize_data);
+var_dump($arr_asso);
+
+echo "\nDone";
+?>
+--EXPECTF--
+
+--- Testing Circular reference of an array ---
+-- Normal array --
+string(238) "a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;s:1:"a";i:5;a:0:{}i:6;a:7:{i:0;i:0;i:1;i:1;i:2;i:-2;i:3;d:3.333333000000000101437080957111902534961700439453125;i:4;s:1:"a";i:5;a:0:{}i:6;R:8;}}"
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-2)
+ [3]=>
+ float(3.333333)
+ [4]=>
+ string(1) "a"
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ &array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-2)
+ [3]=>
+ float(3.333333)
+ [4]=>
+ string(1) "a"
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ &array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-2)
+ [3]=>
+ float(3.333333)
+ [4]=>
+ string(1) "a"
+ [5]=>
+ array(0) {
+ }
+ [6]=>
+ *RECURSION*
+ }
+ }
+}
+
+-- Associative array --
+array(2) {
+ ["a"]=>
+ &string(4) "test"
+ ["b"]=>
+ &string(4) "test"
+}
+string(37) "a:2:{s:1:"a";s:4:"test";s:1:"b";R:2;}"
+array(2) {
+ ["a"]=>
+ &string(4) "test"
+ ["b"]=>
+ &string(4) "test"
+}
+
+Done
diff --git a/ext/standard/tests/serialize/serialization_arrays_002.phpt b/ext/standard/tests/serialize/serialization_arrays_002.phpt
new file mode 100644
index 000000000..f8cef7818
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_002.phpt
@@ -0,0 +1,544 @@
+--TEST--
+serialization: arrays with references amonst elements
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
+}
+
+echo "\n\n--- No references:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 0 refs 1:\n";
+$a = array();
+$a[0] = &$a[1];
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 0 refs 2:\n";
+$a = array();
+$a[0] = &$a[2];
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1 refs 0:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = &$a[0];
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1 refs 2:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = &$a[2];
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 2 refs 0:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = &$a[0];
+check($a);
+
+echo "\n\n--- 2 refs 1:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = &$a[1];
+check($a);
+
+echo "\n\n--- 0,1 ref 2:\n";
+$a = array();
+$a[0] = &$a[2];
+$a[1] = &$a[2];
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 0,2 ref 1:\n";
+$a = array();
+$a[0] = &$a[1];
+$a[1] = 1;
+$a[2] = &$a[1];
+check($a);
+
+echo "\n\n--- 1,2 ref 0:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = &$a[0];
+$a[2] = &$a[0];
+check($a);
+
+echo "Done";
+?>
+--EXPECTF--
+
+
+--- No references:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 0 refs 1:
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:1;i:1;i:0;R:2;i:2;i:1;}"
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 0 refs 2:
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+}
+string(30) "a:3:{i:2;i:1;i:0;R:2;i:1;i:1;}"
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+}
+array(3) {
+ [2]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+}
+array(3) {
+ [2]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+}
+array(3) {
+ [2]=>
+ &string(10) "b2.changed"
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ string(10) "b1.changed"
+}
+
+
+--- 1 refs 0:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1 refs 2:
+array(3) {
+ [0]=>
+ int(1)
+ [2]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:2;i:1;i:1;R:3;}"
+array(3) {
+ [0]=>
+ int(1)
+ [2]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [2]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [2]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [2]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 2 refs 0:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 2 refs 1:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;R:3;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 0,1 ref 2:
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+string(30) "a:3:{i:2;i:1;i:0;R:2;i:1;R:2;}"
+array(3) {
+ [2]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+}
+array(3) {
+ [2]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [2]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [2]=>
+ &string(10) "b2.changed"
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 0,2 ref 1:
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:1;i:1;i:0;R:2;i:2;R:2;}"
+array(3) {
+ [1]=>
+ &int(1)
+ [0]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [1]=>
+ &string(10) "b0.changed"
+ [0]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [1]=>
+ &string(10) "b1.changed"
+ [0]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [1]=>
+ &string(10) "b2.changed"
+ [0]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+
+
+--- 1,2 ref 0:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_arrays_003.phpt b/ext/standard/tests/serialize/serialization_arrays_003.phpt
new file mode 100644
index 000000000..8d664fccf
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_003.phpt
@@ -0,0 +1,294 @@
+--TEST--
+serialization: arrays with references to an external variable
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
+}
+
+echo "\n\n--- 0 refs external:\n";
+$ext = 1;
+$a = array();
+$a[0] = &$ext;
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1 refs external:\n";
+$ext = 1;
+$a = array();
+$a[0] = 1;
+$a[1] = &$ext;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 2 refs external:\n";
+$ext = 1;
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$a[2] = &$ext;
+check($a);
+
+echo "\n\n--- 1,2 ref external:\n";
+$ext = 1;
+$a = array();
+$a[0] = &$ext;
+$a[1] = &$ext;
+$a[2] = 1;
+check($a);
+
+echo "\n\n--- 1,2,3 ref external:\n";
+$ext = 1;
+$a = array();
+$a[0] = &$ext;
+$a[1] = &$ext;
+$a[2] = &$ext;
+check($a);
+
+echo "Done";
+?>
+--EXPECTF--
+
+
+--- 0 refs external:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1 refs external:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 2 refs external:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2 ref external:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2,3 ref external:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+string(30) "a:3:{i:0;i:1;i:1;R:2;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_arrays_004.phpt b/ext/standard/tests/serialize/serialization_arrays_004.phpt
new file mode 100644
index 000000000..b6dfc733a
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_004.phpt
@@ -0,0 +1,474 @@
+--TEST--
+serialization: arrays with references to the containing array
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
+}
+
+echo "\n\n--- 1 refs container:\n";
+$a = array();
+$a[0] = &$a;
+$a[1] = 1;
+$a[2] = 1;
+check($a);
+$a[0] = null;
+
+echo "\n\n--- 1,2 ref container:\n";
+$a = array();
+$a[0] = &$a;
+$a[1] = &$a;
+$a[2] = 1;
+check($a);
+$a[0] = null;
+$a[1] = null;
+
+echo "\n\n--- 1,2,3 ref container:\n";
+$a = array();
+$a[0] = &$a;
+$a[1] = &$a;
+$a[2] = &$a;
+check($a);
+$a[0] = null;
+$a[1] = null;
+$a[2] = null;
+
+
+echo "Done";
+?>
+--EXPECTF--
+
+
+--- 1 refs container:
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;i:1;i:2;i:1;}i:1;i:1;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ %string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ %string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ %string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2 ref container:
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+}
+string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;i:1;}i:1;R:2;i:2;i:1;}"
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- 1,2,3 ref container:
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ }
+}
+string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;R:2;}i:1;R:2;i:2;R:2;}"
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [1]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ [2]=>
+ &array(3) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ *RECURSION*
+ [2]=>
+ *RECURSION*
+ }
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ [2]=>
+ &string(10) "b0.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ &string(10) "b1.changed"
+}
+array(3) {
+ [0]=>
+ &string(10) "b2.changed"
+ [1]=>
+ &string(10) "b2.changed"
+ [2]=>
+ &string(10) "b2.changed"
+}
+Done
diff --git a/ext/standard/tests/serialize/serialization_arrays_005.phpt b/ext/standard/tests/serialize/serialization_arrays_005.phpt
new file mode 100644
index 000000000..c291ed764
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_arrays_005.phpt
@@ -0,0 +1,571 @@
+--TEST--
+serialization: arrays with references, nested
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$a) {
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
+
+ $b = unserialize($ser);
+
+ // Change each element and dump result.
+ foreach($b as $k=>$v) {
+ if (is_array($v)){
+ foreach($b[$k] as $sk=>$sv) {
+ $b[$k][$sk] = "b$k.$sk.changed";
+ var_dump($b);
+ }
+ } else {
+ $b[$k] = "b$k.changed";
+ var_dump($b);
+ }
+ }
+}
+
+echo "\n\n--- Nested array references 1 element in containing array:\n";
+$a = array();
+$c = array(1,1,&$a);
+$a[0] = &$c[0];
+$a[1] = 1;
+check($c);
+
+echo "\n\n--- Nested array references 1 element in containing array (slightly different):\n";
+$a = array();
+$c = array(1,&$a,1);
+$a[0] = 1;
+$a[1] = &$c[0];
+check($c);
+
+echo "\n\n--- Nested array references 2 elements in containing array:\n";
+$a = array();
+$c = array(1,1,&$a);
+$a[0] = &$c[0];
+$a[1] = &$c[1];
+check($c);
+
+echo "\n\n--- Containing array references 1 element in nested array:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$c = array(1,&$a[0],&$a);
+check($c);
+
+echo "\n\n--- Containing array references 2 elements in nested array:\n";
+$a = array();
+$a[0] = 1;
+$a[1] = 1;
+$c = array(&$a[0],&$a[1],&$a);
+check($c);
+
+echo "\n\n--- Nested array references container:\n";
+$a = array();
+$c = array(1,1,&$a);
+$a[0] = 1;
+$a[1] = &$c;
+check($c);
+$a[1] = null;
+
+?>
+--EXPECTF--
+
+
+--- Nested array references 1 element in containing array:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;i:1;}}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(12) "b2.1.changed"
+ }
+}
+
+
+--- Nested array references 1 element in containing array (slightly different):
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ }
+ [2]=>
+ int(1)
+}
+string(48) "a:3:{i:0;i:1;i:1;a:2:{i:0;i:1;i:1;R:2;}i:2;i:1;}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ &string(10) "b0.changed"
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(12) "b1.0.changed"
+ [1]=>
+ &string(10) "b0.changed"
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(12) "b1.1.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(12) "b1.0.changed"
+ [1]=>
+ &string(12) "b1.1.changed"
+ }
+ [2]=>
+ int(1)
+}
+array(3) {
+ [0]=>
+ &string(12) "b1.1.changed"
+ [1]=>
+ array(2) {
+ [0]=>
+ string(12) "b1.0.changed"
+ [1]=>
+ &string(12) "b1.1.changed"
+ }
+ [2]=>
+ string(10) "b2.changed"
+}
+
+
+--- Nested array references 2 elements in containing array:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ }
+}
+
+
+--- Containing array references 1 element in nested array:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:3;i:1;i:1;}}"
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b1.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(12) "b2.0.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ int(1)
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ &string(12) "b2.0.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ string(12) "b2.1.changed"
+ }
+}
+
+
+--- Containing array references 2 elements in nested array:
+array(3) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ &int(1)
+ [1]=>
+ &int(1)
+ }
+}
+string(48) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;R:2;i:1;R:3;}}"
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &int(1)
+ }
+}
+array(3) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(10) "b0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(10) "b1.changed"
+ }
+}
+array(3) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ [2]=>
+ array(2) {
+ [0]=>
+ &string(12) "b2.0.changed"
+ [1]=>
+ &string(12) "b2.1.changed"
+ }
+}
+
+
+--- Nested array references container:
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+ }
+ }
+}
+string(74) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;i:1;i:1;a:3:{i:0;i:1;i:1;i:1;i:2;R:4;}}}"
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+ }
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+ }
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &array(2) {
+ [0]=>
+ string(12) "b2.0.changed"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ &array(2) {
+ [0]=>
+ string(12) "b2.0.changed"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ *RECURSION*
+ }
+ }
+ }
+ }
+}
+array(3) {
+ [0]=>
+ string(10) "b0.changed"
+ [1]=>
+ string(10) "b1.changed"
+ [2]=>
+ &array(2) {
+ [0]=>
+ string(12) "b2.0.changed"
+ [1]=>
+ string(12) "b2.1.changed"
+ }
+}
diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt b/ext/standard/tests/serialize/serialization_error_001.phpt
new file mode 100644
index 000000000..3f530580d
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_error_001.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test serialize() & unserialize() functions: error conditions - wrong number of args.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing serialize()/unserialize() : error conditions ***\n";
+
+// Zero arguments
+var_dump( serialize() );
+var_dump( unserialize() );
+
+//Test serialize with one more than the expected number of arguments
+var_dump( serialize(1,2) );
+var_dump( unserialize(1,2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing serialize()/unserialize() : error conditions ***
+
+Warning: Wrong parameter count for serialize() in %s on line 16
+NULL
+
+Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17
+bool(false)
+
+Warning: Wrong parameter count for serialize() in %s on line 20
+NULL
+
+Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_miscTypes_001.phpt b/ext/standard/tests/serialize/serialization_miscTypes_001.phpt
new file mode 100644
index 000000000..276913524
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_miscTypes_001.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_001.phpt b/ext/standard/tests/serialize/serialization_objects_001.phpt
new file mode 100644
index 000000000..5eba5304b
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_001.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_002.phpt b/ext/standard/tests/serialize/serialization_objects_002.phpt
new file mode 100644
index 000000000..aeca6d81a
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_002.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_003.phpt b/ext/standard/tests/serialize/serialization_objects_003.phpt
new file mode 100644
index 000000000..c20590b79
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_003.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test serialize() & unserialize() functions: objects (abstract classes)
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n--- Testing Abstract Class ---\n";
+// abstract class
+abstract class Name
+{
+ public function Name() {
+ $this->a = 10;
+ $this->b = 12.222;
+ $this->c = "string";
+ }
+ abstract protected function getClassName();
+ public function printClassName () {
+ return $this->getClassName();
+ }
+}
+// implement abstract class
+class extendName extends Name
+{
+ var $a, $b, $c;
+
+ protected function getClassName() {
+ return "extendName";
+ }
+}
+
+$obj_extendName = new extendName();
+$serialize_data = serialize($obj_extendName);
+var_dump( $serialize_data );
+$unserialize_data = unserialize($serialize_data);
+var_dump( $unserialize_data );
+
+$serialize_data = serialize($obj_extendName->printClassName());
+var_dump( $serialize_data );
+$unserialize_data = unserialize($serialize_data);
+var_dump( $unserialize_data );
+
+echo "\nDone";
+?>
+--EXPECTF--
+--- Testing Abstract Class ---
+string(119) "O:10:"extendName":3:{s:1:"a";i:10;s:1:"b";d:12.2219999999999995310417943983338773250579833984375;s:1:"c";s:6:"string";}"
+object(extendName)#%d (3) {
+ ["a"]=>
+ int(10)
+ ["b"]=>
+ float(12.222)
+ ["c"]=>
+ string(6) "string"
+}
+string(18) "s:10:"extendName";"
+string(10) "extendName"
+
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_004.phpt b/ext/standard/tests/serialize/serialization_objects_004.phpt
new file mode 100644
index 000000000..6b826a398
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_004.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test serialize() & unserialize() functions: objects - ensure that COW references of objects are not serialized separately (unlike other types).
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$x = new stdClass;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = 1;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = "a";
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = true;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = null;
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+$x = array();
+$ref = &$x;
+var_dump(serialize(array($x, $x)));
+
+echo "Done";
+?>
+--EXPECTF--
+string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}"
+string(22) "a:2:{i:0;i:1;i:1;i:1;}"
+string(30) "a:2:{i:0;s:1:"a";i:1;s:1:"a";}"
+string(22) "a:2:{i:0;b:1;i:1;b:1;}"
+string(18) "a:2:{i:0;N;i:1;N;}"
+string(26) "a:2:{i:0;a:0:{}i:1;a:0:{}}"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt
new file mode 100644
index 000000000..35b159387
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_005.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Check behaviour of incomplete class
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$serialized = 'O:1:"C":1:{s:1:"p";i:1;}';
+
+$incomplete = unserialize($serialized);
+eval('Class C {}');
+$complete = unserialize($serialized);
+
+
+echo "\n\n---> Various types of access on complete class:\n" ;
+var_dump($complete);
+var_dump(is_object($complete));
+var_dump($complete->p);
+
+$ref1 = "ref1.original";
+$complete->p = &$ref1;
+var_dump($complete->p);
+$ref1 = "ref1.changed";
+var_dump($complete->p);
+$complete->p = "p.changed";
+var_dump($ref1);
+
+var_dump(isset($complete->x));
+$complete->x = "x.new";
+var_dump(isset($complete->x));
+unset($complete->x);
+var_dump($complete->x);
+
+
+echo "\n\n---> Same types of access on incomplete class:\n" ;
+var_dump($incomplete);
+var_dump(is_object($incomplete));
+var_dump($incomplete->p);
+
+$ref2 = "ref1.original";
+$incomplete->p = &$ref2;
+var_dump($incomplete->p);
+$ref2 = "ref1.changed";
+var_dump($incomplete->p);
+$incomplete->p = "p.changed";
+var_dump($ref1);
+
+var_dump(isset($incomplete->x));
+$incomplete->x = "x.new";
+var_dump(isset($incomplete->x));
+unset($incomplete->x);
+var_dump($incomplete->x);
+
+$incomplete->f();
+
+echo "Done";
+?>
+--EXPECTF--
+---> Various types of access on complete class:
+object(C)#%d (1) {
+ ["p"]=>
+ int(1)
+}
+bool(true)
+int(1)
+string(13) "ref1.original"
+string(12) "ref1.changed"
+string(9) "p.changed"
+bool(false)
+bool(true)
+
+Notice: Undefined property: C::$x in %s on line 37
+NULL
+
+
+---> Same types of access on incomplete class:
+object(__PHP_Incomplete_Class)#%d (2) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(1) "C"
+ ["p"]=>
+ int(1)
+}
+bool(false)
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 43
+NULL
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 46
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 47
+NULL
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 49
+NULL
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 50
+string(9) "p.changed"
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 53
+bool(false)
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 54
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 55
+bool(false)
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 56
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 57
+NULL
+
+Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 59 \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_006.phpt b/ext/standard/tests/serialize/serialization_objects_006.phpt
new file mode 100644
index 000000000..e223f4ee1
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_006.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Behaviour of incomplete class is preserved even when it was not created by unserialize().
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$a = new __PHP_Incomplete_Class;
+var_dump($a);
+var_dump($a->p);
+
+echo "Done";
+?>
+--EXPECTF--
+object(__PHP_Incomplete_Class)#%d (0) {
+}
+
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line 15
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_007.phpt b/ext/standard/tests/serialize/serialization_objects_007.phpt
new file mode 100644
index 000000000..9cba9d13b
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_007.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Ensure __autoload is called twice if unserialize_callback_func is defined.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function __autoload($name) {
+ echo "in __autoload($name)\n";
+}
+
+ini_set('unserialize_callback_func','check');
+
+function check($name) {
+ echo "in check($name)\n";
+}
+
+$o = unserialize('O:3:"FOO":0:{}');
+
+var_dump($o);
+
+echo "Done";
+?>
+--EXPECTF--
+in __autoload(FOO)
+in check(FOO)
+in __autoload(FOO)
+
+Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23
+object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(3) "FOO"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_008.phpt b/ext/standard/tests/serialize/serialization_objects_008.phpt
new file mode 100644
index 000000000..b963872f2
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_008.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bad unserialize_callback_func
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+ini_set('unserialize_callback_func','Nonexistent');
+$o = unserialize('O:3:"FOO":0:{}');
+var_dump($o);
+echo "Done";
+?>
+--EXPECTF--
+
+Warning: unserialize(): defined (Nonexistent) but not found in %s on line 14
+object(__PHP_Incomplete_Class)#%d (1) {
+ ["__PHP_Incomplete_Class_Name"]=>
+ string(3) "FOO"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_009.phpt b/ext/standard/tests/serialize/serialization_objects_009.phpt
new file mode 100644
index 000000000..2e8b2dc80
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_009.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Custom unserialization of classes with no custom unserializer.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$ser = 'C:1:"C":6:{dasdas}';
+$a = unserialize($ser);
+eval('class C {}');
+$b = unserialize($ser);
+
+var_dump($a, $b);
+
+echo "Done";
+?>
+--EXPECTF--
+
+Warning: Class __PHP_Incomplete_Class has no unserializer in %s on line 14
+
+Notice: unserialize(): Error at offset 6 of 18 bytes in %s on line 14
+
+Warning: Class C has no unserializer in %s on line 16
+
+Notice: unserialize(): Error at offset 6 of 18 bytes in %s on line 16
+bool(false)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_010.phpt b/ext/standard/tests/serialize/serialization_objects_010.phpt
new file mode 100644
index 000000000..0fbf0723d
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_010.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Serialize() must return a string or NULL
+--SKIPIF--
+<?php if (!interface_exists('Serializable')) die('skip Interface Serialzable not defined'); ?>
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+Class C implements Serializable {
+ public function serialize() {
+ return $this;
+ }
+
+ public function unserialize($blah) {
+ }
+}
+
+try {
+ var_dump(serialize(new C));
+} catch (Exception $e) {
+ echo $e->getMessage(). "\n";
+}
+
+echo "Done";
+?>
+--EXPECTF--
+C::serialize() must return a string or NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_011.phpt b/ext/standard/tests/serialize/serialization_objects_011.phpt
new file mode 100644
index 000000000..870793780
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_011.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Object serialization / unserialization with inherited and hidden properties.
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+Class A {
+ private $APriv = "A.APriv";
+ protected $AProt = "A.AProt";
+ public $APub = "A.APub";
+
+ function audit() {
+ return isset($this->APriv, $this->AProt, $this->APub);
+ }
+}
+
+Class B extends A {
+ private $BPriv = "B.BPriv";
+ protected $BProt = "B.BProt";
+ public $BPub = "B.BPub";
+
+ function audit() {
+ return parent::audit() && isset($this->AProt, $this->APub,
+ $this->BPriv, $this->BProt, $this->BPub);
+ }
+}
+
+Class C extends B {
+ private $APriv = "C.APriv";
+ protected $AProt = "C.AProt";
+ public $APub = "C.APub";
+
+ private $CPriv = "C.CPriv";
+ protected $CProt = "C.BProt";
+ public $CPub = "C.CPub";
+
+ function audit() {
+ return parent::audit() && isset($this->APriv, $this->AProt, $this->APub,
+ $this->BProt, $this->BPub,
+ $this->CPriv, $this->CProt, $this->CPub);
+ }
+}
+
+function prettyPrint($obj) {
+ echo "\n\nBefore serialization:\n";
+ var_dump($obj);
+
+ echo "Serialized form:\n";
+ $ser = serialize($obj);
+ $serPrintable = str_replace("\0", '\0', $ser);
+ var_dump($serPrintable);
+
+ echo "Unserialized:\n";
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+
+ echo "Sanity check: ";
+ var_dump($uobj->audit());
+}
+
+echo "-- Test instance of A --\n";
+prettyPrint(new A);
+echo "\n\n-- Test instance of B --\n";
+prettyPrint(new B);
+echo "\n\n-- Test instance of C --\n";
+prettyPrint(new C);
+
+echo "Done";
+?>
+--EXPECTF--
+-- Test instance of A --
+
+
+Before serialization:
+object(A)#%d (3) {
+ ["APriv:private"]=>
+ string(7) "A.APriv"
+ ["AProt:protected"]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Serialized form:
+string(98) "O:1:"A":3:{s:8:"\0A\0APriv";s:7:"A.APriv";s:8:"\0*\0AProt";s:7:"A.AProt";s:4:"APub";s:6:"A.APub";}"
+Unserialized:
+object(A)#%d (3) {
+ ["APriv:private"]=>
+ string(7) "A.APriv"
+ ["AProt:protected"]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Sanity check: bool(true)
+
+
+-- Test instance of B --
+
+
+Before serialization:
+object(B)#%d (6) {
+ ["BPriv:private"]=>
+ string(7) "B.BPriv"
+ ["BProt:protected"]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv:private"]=>
+ string(7) "A.APriv"
+ ["AProt:protected"]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Serialized form:
+string(184) "O:1:"B":6:{s:8:"\0B\0BPriv";s:7:"B.BPriv";s:8:"\0*\0BProt";s:7:"B.BProt";s:4:"BPub";s:6:"B.BPub";s:8:"\0A\0APriv";s:7:"A.APriv";s:8:"\0*\0AProt";s:7:"A.AProt";s:4:"APub";s:6:"A.APub";}"
+Unserialized:
+object(B)#%d (6) {
+ ["BPriv:private"]=>
+ string(7) "B.BPriv"
+ ["BProt:protected"]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv:private"]=>
+ string(7) "A.APriv"
+ ["AProt:protected"]=>
+ string(7) "A.AProt"
+ ["APub"]=>
+ string(6) "A.APub"
+}
+Sanity check: bool(true)
+
+
+-- Test instance of C --
+
+
+Before serialization:
+object(C)#%d (10) {
+ ["APriv:private"]=>
+ string(7) "C.APriv"
+ ["AProt:protected"]=>
+ string(7) "C.AProt"
+ ["APub"]=>
+ string(6) "C.APub"
+ ["CPriv:private"]=>
+ string(7) "C.CPriv"
+ ["CProt:protected"]=>
+ string(7) "C.BProt"
+ ["CPub"]=>
+ string(6) "C.CPub"
+ ["BPriv:private"]=>
+ string(7) "B.BPriv"
+ ["BProt:protected"]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv:private"]=>
+ string(7) "A.APriv"
+}
+Serialized form:
+string(302) "O:1:"C":10:{s:8:"\0C\0APriv";s:7:"C.APriv";s:8:"\0*\0AProt";s:7:"C.AProt";s:4:"APub";s:6:"C.APub";s:8:"\0C\0CPriv";s:7:"C.CPriv";s:8:"\0*\0CProt";s:7:"C.BProt";s:4:"CPub";s:6:"C.CPub";s:8:"\0B\0BPriv";s:7:"B.BPriv";s:8:"\0*\0BProt";s:7:"B.BProt";s:4:"BPub";s:6:"B.BPub";s:8:"\0A\0APriv";s:7:"A.APriv";}"
+Unserialized:
+object(C)#%d (10) {
+ ["APriv:private"]=>
+ string(7) "C.APriv"
+ ["AProt:protected"]=>
+ string(7) "C.AProt"
+ ["APub"]=>
+ string(6) "C.APub"
+ ["CPriv:private"]=>
+ string(7) "C.CPriv"
+ ["CProt:protected"]=>
+ string(7) "C.BProt"
+ ["CPub"]=>
+ string(6) "C.CPub"
+ ["BPriv:private"]=>
+ string(7) "B.BPriv"
+ ["BProt:protected"]=>
+ string(7) "B.BProt"
+ ["BPub"]=>
+ string(6) "B.BPub"
+ ["APriv:private"]=>
+ string(7) "A.APriv"
+}
+Sanity check: bool(true)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_012.phpt b/ext/standard/tests/serialize/serialization_objects_012.phpt
new file mode 100644
index 000000000..f994d8e26
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_012.phpt
@@ -0,0 +1,244 @@
+--TEST--
+Object serialization / unserialization: real references and COW references
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n\nArray containing same object twice:\n";
+$obj = new stdclass;
+$a[0] = $obj;
+$a[1] = $a[0];
+var_dump($a);
+
+$ser = serialize($a);
+var_dump($ser);
+
+$ua = unserialize($ser);
+var_dump($ua);
+$ua[0]->a = "newProp";
+var_dump($ua);
+$ua[0] = "a0.changed";
+var_dump($ua);
+
+
+echo "\n\nArray containing object and reference to that object:\n";
+$obj = new stdclass;
+$a[0] = $obj;
+$a[1] = &$a[0];
+var_dump($a);
+
+$ser = serialize($a);
+var_dump($ser);
+
+$ua = unserialize($ser);
+var_dump($ua);
+$ua[0]->a = "newProp";
+var_dump($ua);
+$ua[0] = "a0.changed";
+var_dump($ua);
+
+echo "\n\nObject containing same object twice:";
+$obj = new stdclass;
+$contaner = new stdclass;
+$contaner->a = $obj;
+$contaner->b = $contaner->a;
+var_dump($contaner);
+
+$ser = serialize($contaner);
+var_dump($ser);
+
+$ucontainer = unserialize($ser);
+var_dump($ucontainer);
+$ucontainer->a->a = "newProp";
+var_dump($ucontainer);
+$ucontainer->a = "container->a.changed";
+var_dump($ucontainer);
+
+
+echo "\n\nObject containing object and reference to that object:\n";
+$obj = new stdclass;
+$contaner = new stdclass;
+$contaner->a = $obj;
+$contaner->b = &$contaner->a;
+var_dump($contaner);
+
+$ser = serialize($contaner);
+var_dump($ser);
+
+$ucontainer = unserialize($ser);
+var_dump($ucontainer);
+$ucontainer->a->a = "newProp";
+var_dump($ucontainer);
+$ucontainer->b = "container->a.changed";
+var_dump($ucontainer);
+
+echo "Done";
+?>
+--EXPECTF--
+
+
+Array containing same object twice:
+array(2) {
+ [0]=>
+ object(stdClass)#%d (0) {
+ }
+ [1]=>
+ object(stdClass)#%d (0) {
+ }
+}
+string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}"
+array(2) {
+ [0]=>
+ object(stdClass)#%d (0) {
+ }
+ [1]=>
+ object(stdClass)#%d (0) {
+ }
+}
+array(2) {
+ [0]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ [1]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+array(2) {
+ [0]=>
+ string(10) "a0.changed"
+ [1]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+
+
+Array containing object and reference to that object:
+array(2) {
+ [0]=>
+ &object(stdClass)#%d (0) {
+ }
+ [1]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+string(37) "a:2:{i:0;O:8:"stdClass":0:{}i:1;R:2;}"
+array(2) {
+ [0]=>
+ &object(stdClass)#%d (0) {
+ }
+ [1]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+array(2) {
+ [0]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ [1]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+array(2) {
+ [0]=>
+ &string(10) "a0.changed"
+ [1]=>
+ &string(10) "a0.changed"
+}
+
+
+Object containing same object twice:object(stdClass)#%d (2) {
+ ["a"]=>
+ object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ object(stdClass)#%d (0) {
+ }
+}
+string(58) "O:8:"stdClass":2:{s:1:"a";O:8:"stdClass":0:{}s:1:"b";r:2;}"
+object(stdClass)#%d (2) {
+ ["a"]=>
+ object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ object(stdClass)#%d (0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ ["b"]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ string(20) "container->a.changed"
+ ["b"]=>
+ object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+
+
+Object containing object and reference to that object:
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+string(58) "O:8:"stdClass":2:{s:1:"a";O:8:"stdClass":0:{}s:1:"b";R:2;}"
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &object(stdClass)#%d (0) {
+ }
+ ["b"]=>
+ &object(stdClass)#%d (0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+ ["b"]=>
+ &object(stdClass)#%d (1) {
+ ["a"]=>
+ string(7) "newProp"
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &string(20) "container->a.changed"
+ ["b"]=>
+ &string(20) "container->a.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_013.phpt b/ext/standard/tests/serialize/serialization_objects_013.phpt
new file mode 100644
index 000000000..01b623cb0
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_013.phpt
@@ -0,0 +1,494 @@
+--TEST--
+Object serialization / unserialization: references amongst properties
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$obj) {
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
+
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
+}
+
+echo "\n\n--- a refs b:\n";
+$obj = new stdClass;
+$obj->a = &$obj->b;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a refs c:\n";
+$obj = new stdClass;
+$obj->a = &$obj->c;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- b refs a:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$obj->a;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- b refs c:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$obj->c;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- c refs a:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = 1;
+$obj->c = &$obj->a;
+check($obj);
+
+echo "\n\n--- c refs b:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = 1;
+$obj->c = &$obj->b;
+check($obj);
+
+echo "\n\n--- a,b refs c:\n";
+$obj = new stdClass;
+$obj->a = &$obj->c;
+$obj->b = &$obj->c;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,c refs b:\n";
+$obj = new stdClass;
+$obj->a = &$obj->b;
+$obj->b = 1;
+$obj->c = &$obj->b;
+check($obj);
+
+echo "\n\n--- b,c refs a:\n";
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$obj->a;
+$obj->c = &$obj->a;
+check($obj);
+
+echo "Done";
+?>
+--EXPECTF--
+
+--- a refs b:
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"b";i:1;s:1:"a";R:2;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a refs c:
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"c";i:1;s:1:"a";R:2;s:1:"b";i:1;}"
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->c.changed"
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+}
+
+
+--- b refs a:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- b refs c:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"c";i:1;s:1:"b";R:3;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["c"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- c refs a:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- c refs b:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";R:3;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- a,b refs c:
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"c";i:1;s:1:"a";R:2;s:1:"b";R:2;}"
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["c"]=>
+ &string(14) "obj->c.changed"
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- a,c refs b:
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"b";i:1;s:1:"a";R:2;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &int(1)
+ ["a"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- b,c refs a:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_014.phpt b/ext/standard/tests/serialize/serialization_objects_014.phpt
new file mode 100644
index 000000000..234f5e084
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_014.phpt
@@ -0,0 +1,295 @@
+--TEST--
+Object serialization / unserialization: references to external values
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+function check(&$obj) {
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
+
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
+}
+
+echo "\n\n--- a refs external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$ext;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- b refs external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = &$ext;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- c refs external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = 1;
+$obj->b = 1;
+$obj->c = &$ext;
+check($obj);
+
+echo "\n\n--- a,b ref external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$ext;
+$obj->b = &$ext;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b,c ref external:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$ext;
+$obj->b = &$ext;
+$obj->c = &$ext;
+check($obj);
+
+echo "Done";
+?>
+--EXPECTF--
+
+--- a refs external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- b refs external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- c refs external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b ref external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b,c ref external:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";i:1;s:1:"b";R:2;s:1:"c";R:2;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &int(1)
+ ["b"]=>
+ &int(1)
+ ["c"]=>
+ &int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_objects_015.phpt b/ext/standard/tests/serialize/serialization_objects_015.phpt
new file mode 100644
index 000000000..02e8279c4
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_objects_015.phpt
@@ -0,0 +1,532 @@
+--TEST--
+Object serialization / unserialization: properties reference containing object
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+
+function check(&$obj) {
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
+
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
+}
+
+echo "\n\n--- a refs container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$obj;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a eqs container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = $obj;
+$obj->b = 1;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b ref container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$obj;
+$obj->b = &$obj;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b eq container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = $obj;
+$obj->b = $obj;
+$obj->c = 1;
+check($obj);
+
+echo "\n\n--- a,b,c ref container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = &$obj;
+$obj->b = &$obj;
+$obj->c = &$obj;
+check($obj);
+
+echo "\n\n--- a,b,c eq container:\n";
+$ext = 1;
+$obj = new stdClass;
+$obj->a = $obj;
+$obj->b = $obj;
+$obj->c = $obj;
+check($obj);
+
+echo "Done";
+?>
+--EXPECTF--
+--- a refs container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a eqs container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";i:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ int(1)
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b ref container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b eq container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["c"]=>
+ int(1)
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";i:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["b"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ int(1)
+ }
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ int(1)
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+
+
+--- a,b,c ref container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["b"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["c"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";R:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["b"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["c"]=>
+ &object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->a.changed"
+ ["b"]=>
+ &string(14) "obj->a.changed"
+ ["c"]=>
+ &string(14) "obj->a.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->b.changed"
+ ["b"]=>
+ &string(14) "obj->b.changed"
+ ["c"]=>
+ &string(14) "obj->b.changed"
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ &string(14) "obj->c.changed"
+ ["b"]=>
+ &string(14) "obj->c.changed"
+ ["c"]=>
+ &string(14) "obj->c.changed"
+}
+
+
+--- a,b,c eq container:
+object(stdClass)#%d (3) {
+ ["a"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["b"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["c"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+}
+string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";r:1;}"
+object(stdClass)#%d (3) {
+ ["a"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["b"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["c"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ *RECURSION*
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+ ["c"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ *RECURSION*
+ ["c"]=>
+ *RECURSION*
+ }
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ *RECURSION*
+ }
+}
+object(stdClass)#%d (3) {
+ ["a"]=>
+ string(14) "obj->a.changed"
+ ["b"]=>
+ string(14) "obj->b.changed"
+ ["c"]=>
+ string(14) "obj->c.changed"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_precision_001.phpt b/ext/standard/tests/serialize/serialization_precision_001.phpt
new file mode 100644
index 000000000..eb633beb7
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_precision_001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test serialize_precision (part 1)
+--INI--
+serialize_precision=10
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+var_dump(serialize(0.1));
+?>
+--EXPECTF--
+string(6) "d:0.1;" \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_precision_002.phpt b/ext/standard/tests/serialize/serialization_precision_002.phpt
new file mode 100644
index 000000000..653fabea3
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_precision_002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test serialize_precision (part 2)
+--INI--
+serialize_precision=75
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+var_dump(serialize(0.1));
+?>
+--EXPECTF--
+string(60) "d:0.1000000000000000055511151231257827021181583404541015625;" \ No newline at end of file
diff --git a/ext/standard/tests/serialize/serialization_resources_001.phpt b/ext/standard/tests/serialize/serialization_resources_001.phpt
new file mode 100644
index 000000000..dbb7d3d3e
--- /dev/null
+++ b/ext/standard/tests/serialize/serialization_resources_001.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test serialize() & unserialize() functions: resources
+--FILE--
+<?php
+/* Prototype : proto string serialize(mixed variable)
+ * Description: Returns a string representation of variable (which can later be unserialized)
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+/* Prototype : proto mixed unserialize(string variable_representation)
+ * Description: Takes a string representation of variable and recreates it
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n--- Testing Resource ---\n";
+$file_handle = fopen( __FILE__, "r" );
+$serialized_data = serialize( $file_handle );
+fclose($file_handle);
+var_dump($serialized_data);
+var_dump(unserialize($serialized_data));
+
+echo "\nDone";
+?>
+--EXPECTF--
+--- Testing Resource ---
+string(4) "i:%d;"
+int(%d)
+
+Done \ No newline at end of file
diff --git a/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt
new file mode 100644
index 000000000..f46c8fd70
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt
@@ -0,0 +1,50 @@
+--TEST--
+stream_get_meta_data() on directories
+--FILE--
+<?php
+
+$dir = opendir(dirname(__FILE__));
+var_dump(stream_get_meta_data($dir));
+closedir($dir);
+
+$dirObject = dir(dirname(__FILE__));
+var_dump(stream_get_meta_data($dirObject->handle));
+
+?>
+--EXPECT--
+array(8) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(3) "dir"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(8) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(3) "dir"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt
new file mode 100644
index 000000000..4758c750f
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+stream_get_meta_data() basic functionality
+--FILE--
+<?php
+
+$fp = fopen(__FILE__, "r");
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+?>
+--EXPECTF--
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%sstream_get_meta_data_file_basic.php"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
new file mode 100644
index 000000000..912c4055a
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test stream_get_meta_data() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto array stream_get_meta_data(resource fp)
+ * Description: Retrieves header/meta data from streams/file pointers
+ * Source code: ext/standard/streamsfuncs.c
+ * Alias to functions: socket_get_status
+ */
+
+echo "*** Testing stream_get_meta_data() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n";
+var_dump( stream_get_meta_data() );
+
+//Test stream_get_meta_data with one more than the expected number of arguments
+echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n";
+
+$fp = null;
+$extra_arg = 10;
+var_dump( stream_get_meta_data($fp, $extra_arg) );
+
+echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n";
+$fp = null;
+var_dump(stream_get_meta_data($fp));
+
+echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n";
+$fp = fopen(__FILE__, 'r');
+fclose($fp);
+var_dump(stream_get_meta_data($fp));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing stream_get_meta_data() : error conditions ***
+
+-- Testing stream_get_meta_data() function with Zero arguments --
+
+Warning: Wrong parameter count for stream_get_meta_data() in %s on line %i
+NULL
+
+-- Testing stream_get_meta_data() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for stream_get_meta_data() in %s on line %i
+NULL
+
+-- Testing stream_get_meta_data() function with invalid stream resource --
+
+Warning: stream_get_meta_data(): supplied argument is not a valid stream resource in %s on line %i
+bool(false)
+
+-- Testing stream_get_meta_data() function with closed stream resource --
+
+Warning: stream_get_meta_data(): %i is not a valid stream resource in %s on line %i
+bool(false)
+Done
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt
new file mode 100644
index 000000000..572653e3d
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt
@@ -0,0 +1,510 @@
+--TEST--
+stream_get_meta_data() with differing file access modes
+--FILE--
+<?php
+
+// array of all file access modes
+$filemodes = array('r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+',
+ 'rb', 'rb+', 'wb', 'wb+', 'ab', 'ab+', 'xb', 'xb+',
+ 'rt', 'rt+', 'wt', 'wt+', 'at', 'at+', 'xt', 'xt+');
+
+//create a file
+$filename = __FILE__ . '.tmp';
+$fp = fopen($filename, 'w+');
+fclose($fp);
+
+// open file in each access mode and get meta data
+foreach ($filemodes as $mode) {
+ if (strncmp($mode, 'x', 1) == 0) {
+ // x modes require that file does not exist
+ unlink($filename);
+ }
+ $fp = fopen($filename, $mode);
+ var_dump(stream_get_meta_data($fp));
+ fclose($fp);
+}
+
+unlink($filename);
+
+?>
+--EXPECTF--
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "w"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "a"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "a+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "x"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "x+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "rb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "rb+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "wb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "wb+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "ab"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "ab+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "xb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "xb+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "rt"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "rt+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "wt"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "wt+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "at"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "at+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "xt"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(3) "xt+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt
new file mode 100644
index 000000000..d186cb7e9
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Testing stream_get_meta_data() "unread_bytes" field
+--FILE--
+<?php
+
+$filename = __FILE__ . '.tmp';
+
+$fp = fopen($filename, "w+");
+
+echo "Write some data to the file:\n";
+$i = 0;
+while ($i++ < 20) {
+ fwrite($fp, "a line of data\n");
+}
+
+var_dump(stream_get_meta_data($fp));
+
+//seek to start of file
+rewind($fp);
+
+echo "\n\nRead a line of the file, causing data to be buffered:\n";
+var_dump(fgets($fp));
+
+var_dump(stream_get_meta_data($fp));
+
+echo "\n\nRead 20 bytes from the file:\n";
+fread($fp, 20);
+
+var_dump(stream_get_meta_data($fp));
+
+echo "\n\nRead entire file:\n";
+while(!feof($fp)) {
+ fread($fp, 1);
+}
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+unlink($filename);
+
+?>
+--EXPECTF--
+Write some data to the file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read a line of the file, causing data to be buffered:
+string(15) "a line of data
+"
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(285)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read 20 bytes from the file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(265)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read entire file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt
new file mode 100644
index 000000000..c51d9bd08
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt
@@ -0,0 +1,71 @@
+--TEST--
+stream_get_meta_data() with a relative file path
+--FILE--
+<?php
+
+echo "Create a file:\n";
+$filename = __FILE__ . '.tmp';
+$fp = fopen('File://' . $filename, 'w+');
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+echo "\nChange to file's directory and open with a relative path:\n";
+
+$dirname = dirname($filename);
+chdir($dirname);
+$relative_filename = basename($filename);
+
+$fp = fopen($relative_filename, 'r');
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+unlink($filename);
+
+?>
+--EXPECTF--
+Create a file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "File://%sstream_get_meta_data_file_variation4.php.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+Change to file's directory and open with a relative path:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "stream_get_meta_data_file_variation4.php.tmp"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt
new file mode 100644
index 000000000..386b92f42
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt
@@ -0,0 +1,77 @@
+--TEST--
+testing stream_get_meta_data() "eof" field for a file stream
+--FILE--
+<?php
+
+$filename = __FILE__ . '.tmp';
+
+$fp = fopen($filename, "w+");
+
+echo "Write some data to the file:\n";
+$i = 0;
+while ($i++ < 20) {
+ fwrite($fp, "a line of data\n");
+}
+
+var_dump(stream_get_meta_data($fp));
+
+//seek to start of file
+rewind($fp);
+
+echo "\n\nRead entire file:\n";
+while(!feof($fp)) {
+ fread($fp, 1);
+}
+
+var_dump(stream_get_meta_data($fp));
+
+fclose($fp);
+
+unlink($filename);
+
+?>
+--EXPECTF--
+Write some data to the file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read entire file:
+array(9) {
+ ["wrapper_type"]=>
+ string(9) "plainfile"
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "w+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%i) "%s"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_process_basic-win32.phpt b/ext/standard/tests/streams/stream_get_meta_data_process_basic-win32.phpt
new file mode 100644
index 000000000..97b7d780a
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_process_basic-win32.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Testing stream_get_meta_data() on a process stream.
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ // windows retains the 'b' in the mode string
+ die('skip.. only for Windows');
+}
+?>
+--FILE--
+<?php
+
+$output_file = __FILE__.'.tmp';
+$cmd = "echo here is some output";
+$mode = 'rb';
+$handle = popen($cmd, $mode);
+$data = fread($handle, 100);
+
+var_dump(stream_get_meta_data($handle));
+
+pclose($handle);
+
+echo "Done";
+
+?>
+--EXPECT--
+array(7) {
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(2) "rb"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+Done
diff --git a/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt
new file mode 100644
index 000000000..6b383e75d
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Testing stream_get_meta_data() on a process stream.
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ // non-windows platforms discard the 'b' from the mode string
+ die('skip Not valid for Windows');
+}
+?>
+--FILE--
+<?php
+
+$output_file = __FILE__.'.tmp';
+$cmd = "echo here is some output";
+$mode = 'rb';
+$handle = popen($cmd, $mode);
+$data = fread($handle, 100);
+
+var_dump(stream_get_meta_data($handle));
+
+pclose($handle);
+
+echo "Done";
+
+?>
+--EXPECT--
+array(7) {
+ ["stream_type"]=>
+ string(5) "STDIO"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+Done
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt
new file mode 100644
index 000000000..86056114b
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+stream_get_meta_data() on a udp socket
+--FILE--
+<?php
+
+$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
+var_dump(stream_get_meta_data($tcp_socket));
+fclose($tcp_socket);
+
+?>
+--EXPECTF--
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
new file mode 100644
index 000000000..649311039
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Testing stream_get_meta_data() "unread_bytes" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+echo "Write some data:\n";
+fwrite($socket, "abcdefg\n1234567\nxyzxyz\n");
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead a line from the client, causing data to be buffered:\n";
+fgets($client);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead 3 bytes of data from the client:\n";
+fread($client, 3);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nClose the server side socket and read the remaining data from the client:\n";
+fclose($socket);
+fclose($server);
+while(!feof($client)) {
+ fread($client, 1);
+}
+var_dump(stream_get_meta_data($client));
+
+?>
+--EXPECTF--
+Write some data:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read a line from the client, causing data to be buffered:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(15)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read 3 bytes of data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(12)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Close the server side socket and read the remaining data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
new file mode 100644
index 000000000..c04f3cb5d
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Testing stream_get_meta_data() "timed_out" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nSet a timeout on the client and attempt a read:\n";
+socket_set_timeout($client, 0, 1000);
+fread($client, 1);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nWrite some data from the server:\n";
+fwrite($socket, "12345");
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead some data from the client:\n";
+fread($client, 5);
+var_dump(stream_get_meta_data($client));
+
+fclose($client);
+fclose($socket);
+fclose($server);
+
+?>
+--EXPECTF--
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Set a timeout on the client and attempt a read:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(true)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Write some data from the server:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(true)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read some data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
new file mode 100644
index 000000000..4ec00b3fd
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Testing stream_get_meta_data() "blocked" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nSet blocking to false:\n";
+var_dump(socket_set_blocking($client, 0));
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nSet blocking to true:\n";
+var_dump(socket_set_blocking($client, 1));
+var_dump(stream_get_meta_data($client));
+
+fclose($client);
+fclose($socket);
+fclose($server);
+
+?>
+--EXPECTF--
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Set blocking to false:
+bool(true)
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(false)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Set blocking to true:
+bool(true)
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt
new file mode 100644
index 000000000..dae4f470f
--- /dev/null
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt
@@ -0,0 +1,89 @@
+--TEST--
+Testing stream_get_meta_data() "eof" field on a udp socket
+--FILE--
+<?php
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+/* Accept that connection */
+$socket = stream_socket_accept($server);
+
+echo "Write some data:\n";
+fwrite($socket, "abcdefg\n1234567\nxyzxyz\n");
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nRead a line from the client:\n";
+fgets($client);
+var_dump(stream_get_meta_data($client));
+
+echo "\n\nClose the server side socket and read the remaining data from the client:\n";
+fclose($socket);
+fclose($server);
+while(!feof($client)) {
+ fread($client, 1);
+}
+var_dump(stream_get_meta_data($client));
+
+fclose($client);
+
+?>
+--EXPECTF--
+Write some data:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(%i)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Read a line from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(%i)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+
+Close the server side socket and read the remaining data from the client:
+array(7) {
+ ["stream_type"]=>
+ string(%d) "tcp_socke%s"
+ ["mode"]=>
+ string(2) "r+"
+ ["unread_bytes"]=>
+ int(%i)
+ ["seekable"]=>
+ bool(false)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt
new file mode 100644
index 000000000..1e8e60bd2
--- /dev/null
+++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test stream_set_timeout() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto bool stream_set_timeout(resource stream, int seconds, int microseconds)
+ * Description: Set timeout on stream read to seconds + microseonds
+ * Source code: ext/standard/streamsfuncs.c
+ * Alias to functions: socket_set_timeout
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing stream_set_timeout() : error conditions ***\n";
+
+
+//Test stream_set_timeout with one more than the expected number of arguments
+echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n";
+
+/* Setup socket server */
+$server = stream_socket_server('tcp://127.0.0.1:31337');
+/* Connect to it */
+$client = fsockopen('tcp://127.0.0.1:31337');
+
+$seconds = 10;
+$microseconds = 10;
+$extra_arg = 10;
+var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) );
+
+// Testing stream_set_timeout with one less than the expected number of arguments
+echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n";
+
+$seconds = 10;
+var_dump( stream_set_timeout($client) );
+
+
+echo "\n-- Testing stream_set_timeout() function with a closed socket --\n";
+fclose($client);
+var_dump( stream_set_timeout($client, $seconds) );
+
+echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n";
+var_dump( stream_set_timeout($seconds, $seconds) );
+
+echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n";
+$filestream = fopen(__FILE__, "r");
+var_dump( stream_set_timeout($filestream, $seconds) );
+
+fclose($filestream);
+fclose($server);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing stream_set_timeout() : error conditions ***
+
+-- Testing stream_set_timeout() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for stream_set_timeout() in %s on line %i
+NULL
+
+-- Testing stream_set_timeout() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for stream_set_timeout() in %s on line %i
+NULL
+
+-- Testing stream_set_timeout() function with a closed socket --
+
+Warning: stream_set_timeout(): %i is not a valid stream resource in %s on line %i
+bool(false)
+
+-- Testing stream_set_timeout() function with an invalid stream --
+
+Warning: stream_set_timeout(): supplied argument is not a valid stream resource in %s on line %i
+bool(false)
+
+-- Testing stream_set_timeout() function with a stream that does not support timeouts --
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt
index 474251a81..6fe2d9f37 100644
--- a/ext/standard/tests/strings/bug37262.phpt
+++ b/ext/standard/tests/strings/bug37262.phpt
@@ -6,4 +6,4 @@ $func = create_function('$a', 'return $a;');
var_export($func);
?>
--EXPECT--
-'\000lambda_1'
+'' . "\0" . 'lambda_1'
diff --git a/ext/standard/tests/strings/bug43927.phpt b/ext/standard/tests/strings/bug43927.phpt
new file mode 100644
index 000000000..b780c4aac
--- /dev/null
+++ b/ext/standard/tests/strings/bug43927.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #43927 (koi8r is missing from html_entity_decode())
+--FILE--
+<?php
+var_dump(html_entity_decode("&amp;lt;", ENT_COMPAT, 'koi8-r'));
+var_dump(html_entity_decode("&amp;#38;", ENT_COMPAT, 'koi8-r'));
+var_dump(html_entity_decode("&amp;#38;lt;", ENT_COMPAT, 'koi8-r'));
+?>
+--EXPECT--
+string(4) "&lt;"
+string(5) "&#38;"
+string(8) "&#38;lt;"
diff --git a/ext/standard/tests/strings/bug44242.phpt b/ext/standard/tests/strings/bug44242.phpt
new file mode 100644
index 000000000..00adda2be
--- /dev/null
+++ b/ext/standard/tests/strings/bug44242.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #44242 (metaphone('CMXFXM') crashes PHP)
+--FILE--
+<?php
+
+echo metaphone('CMXFXZ'), "\n";
+echo metaphone('CMXFXV'), "\n";
+echo metaphone('CMXFXZXZ'), "\n";
+
+?>
+--EXPECT--
+KMKSFKSS
+KMKSFKSF
+KMKSFKSSKSS
diff --git a/ext/standard/tests/strings/bug44703.phpt b/ext/standard/tests/strings/bug44703.phpt
new file mode 100644
index 000000000..d2cdce9bf
--- /dev/null
+++ b/ext/standard/tests/strings/bug44703.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Bug #44703 (htmlspecialchars() does not detect bad character set argument)
+--FILE--
+<?php
+
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 1));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 12));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 125));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 1252));
+var_dump(htmlspecialchars("<a href='test'>Test</a>", ENT_COMPAT, 12526));
+
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 866));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 8666));
+
+var_dump(htmlspecialchars("<>", ENT_COMPAT, NULL));
+
+
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 'SJIS'));
+var_dump(htmlspecialchars("<>", ENT_COMPAT, 'SjiS'));
+
+var_dump(htmlspecialchars("<>", ENT_COMPAT, str_repeat('a', 100)));
+
+?>
+--EXPECTF--
+Warning: htmlspecialchars(): charset `1' not supported, assuming iso-8859-1 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+
+Warning: htmlspecialchars(): charset `12' not supported, assuming iso-8859-1 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+
+Warning: htmlspecialchars(): charset `125' not supported, assuming iso-8859-1 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+
+Warning: htmlspecialchars(): charset `12526' not supported, assuming iso-8859-1 in %s on line %d
+string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
+string(8) "&lt;&gt;"
+
+Warning: htmlspecialchars(): charset `8666' not supported, assuming iso-8859-1 in %s on line %d
+string(8) "&lt;&gt;"
+string(8) "&lt;&gt;"
+string(8) "&lt;&gt;"
+string(8) "&lt;&gt;"
+
+Warning: htmlspecialchars(): charset `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' not supported, assuming iso-8859-1 in %s on line %d
+string(8) "&lt;&gt;"
+
+
diff --git a/ext/standard/tests/strings/chunk_split_variation1.phpt b/ext/standard/tests/strings/chunk_split_variation1.phpt
index 58cb0515c..e34ce3a51 100644
--- a/ext/standard/tests/strings/chunk_split_variation1.phpt
+++ b/ext/standard/tests/strings/chunk_split_variation1.phpt
@@ -1,167 +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
+--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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // 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 12 34 56 70 00 "
+-- Iteration 8 --
+string(20) "1. 07 65 43 21 E- 9 "
+-- Iteration 9 --
+string(5) "0. 5 "
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line 87
+string(8) "Ar ra y "
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line 87
+string(8) "Ar ra y "
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line 87
+string(8) "Ar ra y "
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line 87
+string(8) "Ar ra y "
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line 87
+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 #%s "
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/chunk_split_variation2.phpt b/ext/standard/tests/strings/chunk_split_variation2.phpt
index 3498f5fce..a6d876df0 100644
--- a/ext/standard/tests/strings/chunk_split_variation2.phpt
+++ b/ext/standard/tests/strings/chunk_split_variation2.phpt
@@ -1,172 +1,174 @@
---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
+--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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // 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 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- 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(%d) "%s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt
index 00dbbdeee..947cdefde 100644
--- a/ext/standard/tests/strings/chunk_split_variation3.phpt
+++ b/ext/standard/tests/strings/chunk_split_variation3.phpt
@@ -1,158 +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
+--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.123456e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new 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) "This101234560000 is 101234560000simp101234560000le s101234560000trin101234560000g.101234560000"
+-- Iteration 8 --
+string(100) "This1.07654321E-9 is 1.07654321E-9simp1.07654321E-9le s1.07654321E-9trin1.07654321E-9g.1.07654321E-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 \ No newline at end of file
diff --git a/ext/standard/tests/strings/crc32_variation1.phpt b/ext/standard/tests/strings/crc32_variation1.phpt
index de7ca5d25..ef0729c21 100644
--- a/ext/standard/tests/strings/crc32_variation1.phpt
+++ b/ext/standard/tests/strings/crc32_variation1.phpt
@@ -1,196 +1,197 @@
---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
+--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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new 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) );
+ $count++;
+};
+
+// 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 2 --
+int(-2082672713)
+
+-- Iteration 3 --
+int(-873121252)
+
+-- Iteration 4 --
+int(1860518047)
+
+-- Iteration 5 --
+int(269248583)
+
+-- Iteration 6 --
+int(-834950157)
+
+-- Iteration 7 --
+int(-965354630)
+
+-- Iteration 8 --
+int(1376932222)
+
+-- Iteration 9 --
+int(-2036403827)
+
+-- Iteration 10 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(-2082672713)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(-2082672713)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(-1465013268)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+
+Warning: crc32() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt
index defb79c22..6d54b6609 100644
--- a/ext/standard/tests/strings/explode.phpt
+++ b/ext/standard/tests/strings/explode.phpt
@@ -5,6 +5,7 @@ error_reporting=2047
--FILE--
<?php
/* From http://bugs.php.net/19865 */
+echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE);
echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE));
echo "\n";
var_dump(@explode("", ""));
@@ -29,7 +30,13 @@ var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-1));
var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-2));
?>
--EXPECTF--
-6e5d59d5afd6693547a733219d079658
+array (
+ 0 => 'a',
+ 1 => 'b' . "\0" . 'd',
+ 2 => 'f',
+ 3 => '1',
+ 4 => 'd',
+)d6bee42a771449205344c0938ad4f035
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt
index a42c543b5..4cebcf2fe 100644
--- a/ext/standard/tests/strings/join_variation1.phpt
+++ b/ext/standard/tests/strings/join_variation1.phpt
@@ -1,167 +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
+--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.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 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) "element1101234567000element2"
+-- Iteration 8 --
+string(29) "element11.07654321E-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 \ No newline at end of file
diff --git a/ext/standard/tests/strings/setlocale_basic1.phpt b/ext/standard/tests/strings/setlocale_basic1.phpt
index 28bea0bf8..f75311175 100644
--- a/ext/standard/tests/strings/setlocale_basic1.phpt
+++ b/ext/standard/tests/strings/setlocale_basic1.phpt
@@ -47,8 +47,8 @@ echo "*** Testing setlocale() : basic functionality - set to a specific locale *
//set of locales to be used
$common_locales = array(
- "english_US"=> "en_US.utf8gfd",
- "english_AU" => "en_AU.utf8hgg",
+ "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",
diff --git a/ext/standard/tests/strings/setlocale_variation4.phpt b/ext/standard/tests/strings/setlocale_variation4.phpt
index 3968be102..4ab1db7ad 100644
--- a/ext/standard/tests/strings/setlocale_variation4.phpt
+++ b/ext/standard/tests/strings/setlocale_variation4.phpt
@@ -5,6 +5,9 @@ Test setlocale() function : usage variations - setting system locale as null
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip Not valid for windows');
}
+if (setlocale(LC_ALL,'en_US.utf8') === false || setlocale(LC_ALL,'en_AU.utf8') === false) {
+ die('skip en_US.utf8/en_AU.utf8 locales not available');
+}
?>
--ENV--
LC_ALL=en_US.utf8;
diff --git a/ext/standard/tests/strings/setlocale_variation5.phpt b/ext/standard/tests/strings/setlocale_variation5.phpt
index d2c3cf08a..c8e947b09 100644
--- a/ext/standard/tests/strings/setlocale_variation5.phpt
+++ b/ext/standard/tests/strings/setlocale_variation5.phpt
@@ -5,6 +5,9 @@ Test setlocale() function : usage variations - Setting system locale as empty st
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip Not valid for windows');
}
+if (setlocale(LC_ALL,'en_AU.utf8') === false || setlocale(LC_ALL,'en_US.utf8') === false) {
+ die('skip en_AU.utf8/en_US.utf8 locales not available');
+}
?>
--ENV--
LC_ALL=en_US.utf8;
diff --git a/ext/standard/tests/strings/sprintf_variation1.phpt b/ext/standard/tests/strings/sprintf_variation1.phpt
index a226bba7e..2a5bdfdec 100644
--- a/ext/standard/tests/strings/sprintf_variation1.phpt
+++ b/ext/standard/tests/strings/sprintf_variation1.phpt
@@ -44,8 +44,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array data
@@ -139,14 +139,14 @@ string(5) "-10.5"
string(5) "-10.5"
-- Iteration 7 --
-string(12) "105000000000"
-string(12) "105000000000"
-string(12) "105000000000"
+string(12) "101234567000"
+string(12) "101234567000"
+string(12) "101234567000"
-- Iteration 8 --
-string(7) "1.06E-9"
-string(7) "1.06E-9"
-string(7) "1.06E-9"
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
-- Iteration 9 --
string(3) "0.5"
@@ -267,4 +267,4 @@ string(0) ""
string(%d) "Resource id #%d"
string(%d) "Resource id #%d"
string(%d) "Resource id #%d"
-Done
+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
index d15928dd9..31097d8dd 100644
--- a/ext/standard/tests/strings/sprintf_variation11.phpt
+++ b/ext/standard/tests/strings/sprintf_variation11.phpt
@@ -40,7 +40,7 @@ foreach($resource_values as $resource_value) {
// closing the resources
fclose($fp);
-fclose($dfp);
+closedir($dfp);
echo "Done";
?>
@@ -58,8 +58,8 @@ string(%d) " %d.000000"
string(%d) "
%d.000000"
string(%d) "%d.000000"
-string(%d) " %d.000000"
-string(4) "0-9]"
+string(%d) "%s%d.000000"
+string(%d) "0-9]"
string(1) "f"
-- Iteration 2 --
@@ -73,7 +73,7 @@ string(%d) " %d.000000"
string(%d) "
%d.000000"
string(%d) "%d.000000"
-string(%d) " %d.000000"
-string(4) "0-9]"
+string(%d) "%s%d.000000"
+string(%d) "0-9]"
string(1) "f"
Done
diff --git a/ext/standard/tests/strings/sprintf_variation16.phpt b/ext/standard/tests/strings/sprintf_variation16.phpt
index 523eb5fb9..57965315e 100644
--- a/ext/standard/tests/strings/sprintf_variation16.phpt
+++ b/ext/standard/tests/strings/sprintf_variation16.phpt
@@ -20,12 +20,12 @@ $float_values = array(
0.0,
-0.1,
1.0,
- 1e5,
- -1e6,
- 1E8,
- -1E9,
+ 1e3,
+ -1e2,
+ 1.23456E8,
+ -1.234567E9,
10.0000000000000000005,
- 10.5e+5
+ 10.123e+5
);
// array of string formats
@@ -187,62 +187,62 @@ string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 10 --
-string(6) "100000"
+string(4) "1000"
string(1) "s"
-string(6) "100000"
+string(4) "1000"
string(1) "s"
-string(7) " 100000"
-string(7) "100000 "
-string(7) " 100000"
-string(7) "
-100000"
-string(6) "100000"
-string(30) " 100000"
+string(5) " 1000"
+string(5) "1000 "
+string(5) " 1000"
+string(5) "
+1000"
+string(4) "1000"
+string(30) " 1000"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 11 --
-string(8) "-1000000"
+string(4) "-100"
string(1) "s"
-string(8) "-1000000"
+string(4) "-100"
string(1) "s"
-string(9) " -1000000"
-string(9) "-1000000 "
-string(9) " -1000000"
-string(9) "
--1000000"
-string(8) "-1000000"
-string(30) " -1000000"
+string(5) " -100"
+string(5) "-100 "
+string(5) " -100"
+string(5) "
+-100"
+string(4) "-100"
+string(30) " -100"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 12 --
-string(9) "100000000"
+string(9) "123456000"
string(1) "s"
-string(9) "100000000"
+string(9) "123456000"
string(1) "s"
-string(10) " 100000000"
-string(10) "100000000 "
-string(10) " 100000000"
+string(10) " 123456000"
+string(10) "123456000 "
+string(10) " 123456000"
string(10) "
-100000000"
-string(9) "100000000"
-string(30) " 100000000"
+123456000"
+string(9) "123456000"
+string(30) " 123456000"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 13 --
-string(11) "-1000000000"
+string(11) "-1234567000"
string(1) "s"
-string(11) "-1000000000"
+string(11) "-1234567000"
string(1) "s"
-string(12) " -1000000000"
-string(12) "-1000000000 "
-string(12) " -1000000000"
+string(12) " -1234567000"
+string(12) "-1234567000 "
+string(12) " -1234567000"
string(12) "
--1000000000"
-string(11) "-1000000000"
-string(30) " -1000000000"
+-1234567000"
+string(11) "-1234567000"
+string(30) " -1234567000"
string(10) "a-zA-Z0-9]"
string(1) "s"
@@ -262,17 +262,17 @@ string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 15 --
-string(7) "1050000"
+string(7) "1012300"
string(1) "s"
-string(7) "1050000"
+string(7) "1012300"
string(1) "s"
-string(8) " 1050000"
-string(8) "1050000 "
-string(8) " 1050000"
+string(8) " 1012300"
+string(8) "1012300 "
+string(8) " 1012300"
string(8) "
-1050000"
-string(7) "1050000"
-string(30) " 1050000"
+1012300"
+string(7) "1012300"
+string(30) " 1012300"
string(10) "a-zA-Z0-9]"
string(1) "s"
-Done \ No newline at end of file
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation17.phpt b/ext/standard/tests/strings/sprintf_variation17.phpt
index 08028f8fe..4d9cc6de9 100644
--- a/ext/standard/tests/strings/sprintf_variation17.phpt
+++ b/ext/standard/tests/strings/sprintf_variation17.phpt
@@ -39,7 +39,7 @@ foreach($resource_values as $resource_value) {
// closing the resources
fclose($fp);
-fclose($dfp);
+closedir($dfp);
echo "Done";
?>
@@ -57,8 +57,8 @@ 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(%d) "%sResource id #%d"
+string(%d) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 2 --
@@ -72,7 +72,7 @@ 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(%d) "%sResource id #%d"
+string(%d) "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
index b0013a4e9..960bcd0e7 100644
--- a/ext/standard/tests/strings/sprintf_variation18.phpt
+++ b/ext/standard/tests/strings/sprintf_variation18.phpt
@@ -7,6 +7,8 @@ Test sprintf() function : usage variations - string formats with array values
* Source code: ext/standard/formatted_print.c
*/
+error_reporting(E_ALL & ~E_NOTICE);
+
echo "*** Testing sprintf() : string formats with array values ***\n";
// different arrays used to test he function
diff --git a/ext/standard/tests/strings/sprintf_variation2.phpt b/ext/standard/tests/strings/sprintf_variation2.phpt
index fcd3f2123..a663df444 100644
--- a/ext/standard/tests/strings/sprintf_variation2.phpt
+++ b/ext/standard/tests/strings/sprintf_variation2.phpt
@@ -7,6 +7,8 @@ Test sprintf() function : usage variations - with all types of values for arg1 a
* Source code: ext/standard/formatted_print.c
*/
+error_reporting(E_ALL & ~E_NOTICE);
+
echo "*** Testing sprintf() : with different types of values passed for arg1 argument ***\n";
// initialing required variables
@@ -40,8 +42,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array data
@@ -130,12 +132,12 @@ string(5) "-10.5"
string(5) "-10.5"
-- Iteration 7 --
-string(12) "105000000000"
-string(12) "105000000000"
+string(12) "101234567000"
+string(12) "101234567000"
-- Iteration 8 --
-string(7) "1.06E-9"
-string(7) "1.06E-9"
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
-- Iteration 9 --
string(3) "0.5"
@@ -216,4 +218,4 @@ string(0) ""
-- Iteration 28 --
string(%d) "Resource id #%d"
string(%d) "Resource id #%d"
-Done
+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
index 57c5abbd8..cc80d7bb4 100644
--- a/ext/standard/tests/strings/sprintf_variation30.phpt
+++ b/ext/standard/tests/strings/sprintf_variation30.phpt
@@ -39,7 +39,7 @@ foreach($resource_values as $resource_value) {
// closing the resources
fclose($fp);
-fclose($dfp);
+closedir($dfp);
echo "Done";
?>
@@ -56,9 +56,9 @@ string(%d) "%d "
string(%d) " %d"
string(%d) "
%d"
-string(%d) " %d"
-string(%d) " %d"
-string(4) "0-7]"
+string(%d) "%s%d"
+string(%d) "%s%d"
+string(%d) "0-7]"
string(1) "o"
-- Iteration 2 --
@@ -71,8 +71,8 @@ string(%d) "%d "
string(%d) " %d"
string(%d) "
%d"
-string(%d) " %d"
-string(%d) " %d"
-string(4) "0-7]"
+string(%d) "%s%d"
+string(%d) "%s%d"
+string(%d) "0-7]"
string(1) "o"
Done
diff --git a/ext/standard/tests/strings/sprintf_variation42.phpt b/ext/standard/tests/strings/sprintf_variation42.phpt
index a1c01ff6b..3c5bd1f1b 100644
--- a/ext/standard/tests/strings/sprintf_variation42.phpt
+++ b/ext/standard/tests/strings/sprintf_variation42.phpt
@@ -40,7 +40,7 @@ foreach($resource_values as $resource_value) {
// closing the resources
fclose($fp);
-fclose($dfp);
+closedir($dfp);
echo "Done";
?>
@@ -57,9 +57,9 @@ string(%d) "%d "
string(%d) " %d"
string(%d) "
%d"
-string(%d) " %d"
-string(%d) " %d"
-string(4) "0-9]"
+string(%d) "%s%d"
+string(%d) "%s%d"
+string(%d) "0-9]"
string(1) "u"
-- Iteration 2 --
@@ -72,8 +72,8 @@ string(%d) "%d "
string(%d) " %d"
string(%d) "
%d"
-string(%d) " %d"
-string(%d) " %d"
-string(4) "0-9]"
+string(%d) "%s%d"
+string(%d) "%s%d"
+string(%d) "0-9]"
string(1) "u"
Done
diff --git a/ext/standard/tests/strings/sprintf_variation48.phpt b/ext/standard/tests/strings/sprintf_variation48.phpt
index df28784eb..ce7bdf8ae 100644
--- a/ext/standard/tests/strings/sprintf_variation48.phpt
+++ b/ext/standard/tests/strings/sprintf_variation48.phpt
@@ -39,7 +39,7 @@ foreach($resource_values as $resource_value) {
// closing the resources
fclose($fp);
-fclose($dfp);
+closedir($dfp);
echo "Done";
@@ -48,32 +48,32 @@ echo "Done";
*** Testing sprintf() : scientific formats with resource values ***
-- Iteration 1 --
-string(%d) "%d.000000e+0"
+string(%d) "%f"
string(1) "e"
-string(%d) "%d.000000e+0"
+string(%d) "%f"
string(1) "e"
-string(%d) " %d.000000e+0"
-string(%d) "%d.000000e+0 "
-string(%d) " %d.000000e+0"
+string(%d) " %f"
+string(%d) "%f "
+string(%d) " %f"
string(%d) "
-%d.000000e+0"
-string(%d) "%d.000000e+0"
-string(%d) " %d.000000e+0"
-string(4) "0-1]"
+%f"
+string(%d) "%f"
+string(%d) "%s%f"
+string(%d) "0-1]"
string(1) "e"
-- Iteration 2 --
-string(%d) "%d.000000e+0"
+string(%d) "%f"
string(1) "e"
-string(%d) "%d.000000e+0"
+string(%d) "%f"
string(1) "e"
-string(%d) " %d.000000e+0"
-string(%d) "%d.000000e+0 "
-string(%d) " %d.000000e+0"
+string(%d) " %f"
+string(%d) "%f "
+string(%d) " %f"
string(%d) "
-%d.000000e+0"
-string(%d) "%d.000000e+0"
-string(%d) " %d.000000e+0"
-string(4) "0-1]"
+%f"
+string(%d) "%f"
+string(%d) "%s%f"
+string(%d) "0-1]"
string(1) "e"
Done
diff --git a/ext/standard/tests/strings/sprintf_variation5.phpt b/ext/standard/tests/strings/sprintf_variation5.phpt
index b703d749f..ee13d3d64 100644
--- a/ext/standard/tests/strings/sprintf_variation5.phpt
+++ b/ext/standard/tests/strings/sprintf_variation5.phpt
@@ -12,11 +12,14 @@ echo "*** Testing sprintf() : integer formats with resource values ***\n";
// resource type variable
$fp = fopen (__FILE__, "r");
$dfp = opendir ( dirname(__FILE__) );
+
+$fp_copy = $fp;
+$dfp_copy = $dfp;
// array of resource types
$resource_types = array (
- $fp,
- $dfp
+ $fp_copy,
+ $dfp_copy
);
// various integer formats
@@ -38,7 +41,7 @@ foreach($resource_types as $res) {
// closing the resources
fclose($fp);
-fclose($dfp);
+closedir($dfp);
echo "Done";
@@ -53,8 +56,8 @@ string(%d) " %d"
string(%d) " %d"
string(%d) "
%d"
-string(%d) " %d"
-string(4) "0-9]"
+string(%d) "%s%d"
+string(%d) "0-9]"
string(1) "d"
-- Iteration 2 --
@@ -64,7 +67,7 @@ string(%d) " %d"
string(%d) " %d"
string(%d) "
%d"
-string(%d) " %d"
-string(4) "0-9]"
+string(%d) "%s%d"
+string(%d) "0-9]"
string(1) "d"
Done
diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt
index ae71aaaf5..2408c82f0 100644
--- a/ext/standard/tests/strings/str_replace.phpt
+++ b/ext/standard/tests/strings/str_replace.phpt
@@ -27,8 +27,10 @@ var_dump( str_replace("long string here", "", "", $count) );
var_dump( $count );
$fp = fopen( __FILE__, "r" );
-var_dump( str_replace($fp, $fp, $fp, $fp) );
-var_dump( $fp );
+$fp_copy = $fp;
+var_dump( str_replace($fp_copy, $fp_copy, $fp_copy, $fp_copy) );
+var_dump( $fp_copy );
+fclose($fp);
echo "\n*** Testing str_replace() with various search values ***";
$search_arr = array( TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL,
@@ -230,12 +232,9 @@ var_dump( str_replace(NULL) );
var_dump( str_replace(1, 2) );
var_dump( str_replace(1,2,3,$var,5) );
-echo "Done\n";
-
---CLEAN--
-fclose($fp);
fclose($resource1);
closedir($resource2);
+echo "Done\n";
?>
--EXPECTF--
@@ -248,7 +247,7 @@ string(1) "q"
int(1)
string(0) ""
int(0)
-string(14) "Resource id #5"
+string(%d) "Resource id #%d"
int(1)
*** Testing str_replace() with various search values ***
@@ -910,9 +909,9 @@ array(2) {
int(1)
-- Testing Resources --
-string(14) "Resource id #6"
+string(%d) "Resource id #%d"
int(0)
-string(14) "Resource id #7"
+string(%d) "Resource id #%d"
int(0)
-- Testing a longer and heredoc string --
diff --git a/ext/standard/tests/strings/strcspn_variation1.phpt b/ext/standard/tests/strings/strcspn_variation1.phpt
index f80e4615e..6a1c6d669 100644
--- a/ext/standard/tests/strings/strcspn_variation1.phpt
+++ b/ext/standard/tests/strings/strcspn_variation1.phpt
@@ -1,276 +1,273 @@
---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
+--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
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* 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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new 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 ***
+
+-- 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 "101234567000"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "1.07654321E-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 \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation2.phpt b/ext/standard/tests/strings/strcspn_variation2.phpt
index df79e9afd..0924e4598 100644
--- a/ext/standard/tests/strings/strcspn_variation2.phpt
+++ b/ext/standard/tests/strings/strcspn_variation2.phpt
@@ -1,274 +1,272 @@
---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
+--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
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* 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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new 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 ***
+
+-- 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 "101234567000" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1.07654321E-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 \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation3.phpt b/ext/standard/tests/strings/strcspn_variation3.phpt
index 869f46537..8b1923efd 100644
--- a/ext/standard/tests/strings/strcspn_variation3.phpt
+++ b/ext/standard/tests/strings/strcspn_variation3.phpt
@@ -9,6 +9,8 @@ Test strcspn() function : usage variations - unexpected values of start argument
* Alias to functions: none
*/
+error_reporting(E_ALL & ~E_NOTICE);
+
/*
* Testing strcspn() : with unexpected values of start argument
*/
@@ -41,8 +43,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e8,
+ 10.7654321E-8,
.5,
// array data
@@ -99,10 +101,6 @@ 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)
@@ -111,11 +109,11 @@ int(0)
int(0)
int(0)
--- Iteration with start value as "105000000000" --
+-- Iteration with start value as "1012345670" --
bool(false)
bool(false)
--- Iteration with start value as "1.06E-9" --
+-- Iteration with start value as "1.07654321E-7" --
int(0)
int(0)
@@ -242,4 +240,4 @@ NULL
Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation4.phpt b/ext/standard/tests/strings/strcspn_variation4.phpt
index 6ea48219c..eabc0696e 100644
--- a/ext/standard/tests/strings/strcspn_variation4.phpt
+++ b/ext/standard/tests/strings/strcspn_variation4.phpt
@@ -1,198 +1,196 @@
---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
+--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
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* 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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // 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 ***
+
+-- Iteration with len value as "10.5" --
+int(0)
+
+-- Iteration with len value as "-10.5" --
+int(0)
+
+-- Iteration with len value as "101234567000" --
+int(0)
+
+-- Iteration with len value as "1.07654321E-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 \ No newline at end of file
diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt
index efdbb5238..963545cf2 100644
--- a/ext/standard/tests/strings/stripos_variation10.phpt
+++ b/ext/standard/tests/strings/stripos_variation10.phpt
@@ -41,8 +41,8 @@ $needles = array (
// float values
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array values
@@ -182,7 +182,7 @@ bool(false)
-- Iteration 24 --
Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+%s
-- Iteration 25 --
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
index e64468135..566ef6c75 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/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt
new file mode 100644
index 000000000..73da09500
--- /dev/null
+++ b/ext/standard/tests/strings/strpos_number.phpt
@@ -0,0 +1,15 @@
+--TEST--
+strpos() matching numbers
+--FILE--
+<?php
+// Integer is handles as an octal representation, so nothing to match
+var_dump(strpos("foo 11", 11));
+// int(111) is string("o") in octal. Match expected
+var_dump(strpos("foo bar", 111));
+// string("11") is contained
+var_dump(strpos("foo 11", "11"));
+?>
+--EXPECT--
+bool(false)
+int(1)
+int(4)
diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt
index 5de3b22ff..c807dd449 100644
--- a/ext/standard/tests/strings/strrchr_variation10.phpt
+++ b/ext/standard/tests/strings/strrchr_variation10.phpt
@@ -79,8 +79,8 @@ $needles = array (
// float values
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array values
@@ -180,7 +180,7 @@ bool(false)
-- Iteration 23 --
bool(false)
-- Iteration 24 --
-bool(false)
+%s
-- Iteration 25 --
bool(false)
-- Iteration 26 --
diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt
index d04710d7d..a179c4089 100644
--- a/ext/standard/tests/strings/strrchr_variation11.phpt
+++ b/ext/standard/tests/strings/strrchr_variation11.phpt
@@ -37,8 +37,8 @@ $values = array (
// float values
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array values
@@ -80,8 +80,6 @@ $values = array (
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
- $haystack = $values[$index];
-
var_dump( strrchr($values[$index], $values[$index]) );
$counter ++;
}
@@ -151,7 +149,7 @@ bool(false)
-- Iteration 23 --
bool(false)
-- Iteration 24 --
-bool(false)
+%s
-- Iteration 25 --
bool(false)
-- Iteration 26 --
diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt
index abdc5e2f4..f3adb3ee9 100644
--- a/ext/standard/tests/strings/strrpos_variation10.phpt
+++ b/ext/standard/tests/strings/strrpos_variation10.phpt
@@ -41,8 +41,8 @@ $needles = array (
// float values
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array values
@@ -142,7 +142,7 @@ bool(false)
-- Iteration 23 --
bool(false)
-- Iteration 24 --
-bool(false)
+%s
-- Iteration 25 --
bool(false)
-- Iteration 26 --
diff --git a/ext/standard/tests/strings/strspn_variation1.phpt b/ext/standard/tests/strings/strspn_variation1.phpt
index 513046b62..e8fd9d3ac 100644
--- a/ext/standard/tests/strings/strspn_variation1.phpt
+++ b/ext/standard/tests/strings/strspn_variation1.phpt
@@ -1,275 +1,273 @@
---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
+--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
+*/
+
+error_reporting(E_ALL & ~E_NOTICE);
+
+/*
+* 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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new 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 ***
+
+-- 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 "101234567000"
+int(12)
+int(11)
+int(10)
+
+-- Iteration with str value as "1.07654321E-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 \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation2.phpt b/ext/standard/tests/strings/strspn_variation2.phpt
index b8891a590..7af61e559 100644
--- a/ext/standard/tests/strings/strspn_variation2.phpt
+++ b/ext/standard/tests/strings/strspn_variation2.phpt
@@ -9,6 +9,8 @@ Test strspn() function : usage variations - unexpected values for mask argument
* Alias to functions: none
*/
+error_reporting(E_ALL & ~E_NOTICE);
+
/*
* Testing strspn() : with different unexpected values for mask argument
*/
@@ -47,8 +49,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array data
@@ -88,7 +90,7 @@ $values = array(
// loop through each element of the array for mask
foreach($values as $value) {
- echo "\n-- Iteration with mask value as \"$value\" -- \n";
+ 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
@@ -102,56 +104,52 @@ 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" --
+-- Iteration with mask value as "0" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "1" --
+-- Iteration with mask value as "1" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "12345" --
+-- Iteration with mask value as "12345" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "-2345" --
+-- Iteration with mask value as "-2345" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "10.5" --
+-- Iteration with mask value as "10.5" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "-10.5" --
+-- Iteration with mask value as "-10.5" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "105000000000" --
+-- Iteration with mask value as "101234567000" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "1.06E-9" --
+-- Iteration with mask value as "1.07654321E-9" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "0.5" --
+-- Iteration with mask value as "0.5" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "Array" --
+-- Iteration with mask value as "Array" --
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
@@ -162,7 +160,7 @@ NULL
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
--- Iteration with mask value as "Array" --
+-- Iteration with mask value as "Array" --
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
@@ -173,7 +171,7 @@ NULL
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
--- Iteration with mask value as "Array" --
+-- Iteration with mask value as "Array" --
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
@@ -184,7 +182,7 @@ NULL
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
--- Iteration with mask value as "Array" --
+-- Iteration with mask value as "Array" --
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
@@ -195,7 +193,7 @@ NULL
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
--- Iteration with mask value as "Array" --
+-- Iteration with mask value as "Array" --
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
@@ -206,62 +204,62 @@ NULL
Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
NULL
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "1" --
+-- Iteration with mask value as "1" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "1" --
+-- Iteration with mask value as "1" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "object" --
+-- Iteration with mask value as "object" --
int(0)
int(1)
int(1)
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "" --
+-- Iteration with mask value as "" --
int(0)
int(0)
int(0)
--- Iteration with mask value as "Resource id #%d" --
+-- Iteration with mask value as "Resource id #%d" --
Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d
NULL
@@ -271,4 +269,4 @@ NULL
Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation3.phpt b/ext/standard/tests/strings/strspn_variation3.phpt
index 0773bd3ad..3195220de 100644
--- a/ext/standard/tests/strings/strspn_variation3.phpt
+++ b/ext/standard/tests/strings/strspn_variation3.phpt
@@ -9,6 +9,8 @@ Test strspn() function : usage variations - unexpected values of start argument
* Alias to functions: none
*/
+error_reporting(E_ALL & ~E_NOTICE);
+
/*
* Testing strspn() : with unexpected values of start argument
*/
@@ -41,8 +43,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e8,
+ 10.7654321E-8,
.5,
// array data
@@ -99,10 +101,6 @@ 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)
@@ -111,11 +109,11 @@ int(0)
int(2)
int(2)
--- Iteration with start value as "105000000000" --
+-- Iteration with start value as "1012345670" --
bool(false)
bool(false)
--- Iteration with start value as "1.06E-9" --
+-- Iteration with start value as "1.07654321E-7" --
int(2)
int(2)
@@ -242,4 +240,4 @@ NULL
Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation4.phpt b/ext/standard/tests/strings/strspn_variation4.phpt
index dd21a1d0f..87dceac3b 100644
--- a/ext/standard/tests/strings/strspn_variation4.phpt
+++ b/ext/standard/tests/strings/strspn_variation4.phpt
@@ -9,6 +9,8 @@ Test strspn() function : usage variations - unexpected values of len argument
* Alias to functions: none
*/
+error_reporting(E_ALL & ~E_NOTICE);
+
/*
* Testing strspn() : with unexpected values of len argument
*/
@@ -41,8 +43,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e8,
+ 10.7654321E-8,
.5,
// array data
@@ -98,20 +100,16 @@ 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" --
+-- Iteration with len value as "1012345670" --
int(2)
--- Iteration with len value as "1.06E-9" --
+-- Iteration with len value as "1.07654321E-7" --
int(0)
-- Iteration with len value as "0.5" --
@@ -195,4 +193,4 @@ int(0)
Warning: strspn() expects parameter 4 to be long, resource given in %s on line %d
NULL
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
index ab10c9efb..8c76c65d7 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_variation1.phpt b/ext/standard/tests/strings/strtok_variation1.phpt
index 3c754c88a..426ab535b 100644
--- a/ext/standard/tests/strings/strtok_variation1.phpt
+++ b/ext/standard/tests/strings/strtok_variation1.phpt
@@ -1,172 +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
+--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.1234567e10,
+ 10.7654321E-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) "101234567000"
+-- Iteration 8 --
+string(11) "1.07654321E"
+-- 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 \ No newline at end of file
diff --git a/ext/standard/tests/strings/ucwords_variation1.phpt b/ext/standard/tests/strings/ucwords_variation1.phpt
index 2a3ceeeb8..b7d61ab5d 100644
--- a/ext/standard/tests/strings/ucwords_variation1.phpt
+++ b/ext/standard/tests/strings/ucwords_variation1.phpt
@@ -49,8 +49,8 @@ $values = array (
// float values
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array values
@@ -139,9 +139,9 @@ string(4) "10.5"
-- Iteration 12 --
string(5) "-10.5"
-- Iteration 13 --
-string(12) "105000000000"
+string(12) "101234567000"
-- Iteration 14 --
-string(7) "1.06E-9"
+string(13) "1.07654321E-9"
-- Iteration 15 --
string(3) "0.5"
-- Iteration 16 --
@@ -162,7 +162,7 @@ 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
+Notice: Array to string conversion in %s on line 101
string(5) "Array"
-- Iteration 21 --
string(1) "1"
@@ -196,4 +196,4 @@ string(0) ""
string(0) ""
-- Iteration 36 --
string(%d) "Resource Id #%d"
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/vsprintf_variation1.phpt b/ext/standard/tests/strings/vsprintf_variation1.phpt
index eb0284540..391158762 100644
--- a/ext/standard/tests/strings/vsprintf_variation1.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation1.phpt
@@ -45,8 +45,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array data
@@ -120,10 +120,10 @@ string(4) "10.5"
string(5) "-10.5"
-- Iteration 7 --
-string(12) "105000000000"
+string(12) "101234567000"
-- Iteration 8 --
-string(7) "1.06E-9"
+string(13) "1.07654321E-9"
-- Iteration 9 --
string(3) "0.5"
diff --git a/ext/standard/tests/strings/vsprintf_variation2.phpt b/ext/standard/tests/strings/vsprintf_variation2.phpt
index fbc1e8634..acf4bea9e 100644
--- a/ext/standard/tests/strings/vsprintf_variation2.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation2.phpt
@@ -45,8 +45,8 @@ $values = array(
// float data
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// null data
@@ -115,10 +115,10 @@ string(4) "10.5"
string(5) "-10.5"
-- Iteration 7 --
-string(12) "105000000000"
+string(12) "101234567000"
-- Iteration 8 --
-string(7) "1.06E-9"
+string(13) "1.07654321E-9"
-- Iteration 9 --
string(3) "0.5"
@@ -174,4 +174,4 @@ bool(false)
-- Iteration 23 --
string(%d) "Resource id #%d"
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/wordwrap_variation1.phpt b/ext/standard/tests/strings/wordwrap_variation1.phpt
index f5a172e9a..d13e7dee2 100644
--- a/ext/standard/tests/strings/wordwrap_variation1.phpt
+++ b/ext/standard/tests/strings/wordwrap_variation1.phpt
@@ -36,8 +36,8 @@ $values = array (
// float values
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array values
@@ -143,17 +143,17 @@ 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"
+string(12) "101234567000"
+string(12) "101234567000"
+string(12) "101234567000"
+string(12) "101234567000"
+string(36) "101<br />\n234<br />\n567<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"
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
+string(13) "1.07654321E-9"
+string(45) "1.0<br />\n765<br />\n432<br />\n1E-<br />\n9"
-- Iteration 9 --
string(3) "0.5"
string(3) "0.5"
@@ -332,4 +332,4 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
-Done
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/wordwrap_variation3.phpt b/ext/standard/tests/strings/wordwrap_variation3.phpt
index 0a71944b4..2f83add7b 100644
--- a/ext/standard/tests/strings/wordwrap_variation3.phpt
+++ b/ext/standard/tests/strings/wordwrap_variation3.phpt
@@ -37,8 +37,8 @@ $values = array (
// float values
10.5,
-10.5,
- 10.5e10,
- 10.6E-10,
+ 10.1234567e10,
+ 10.7654321E-10,
.5,
// array values
@@ -130,13 +130,13 @@ 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"
+string(47) "testing101234567000wordwrap101234567000function"
+string(47) "testing101234567000wordwrap101234567000function"
+string(47) "testing101234567000wordwrap101234567000function"
-- Iteration 8 --
-string(37) "testing1.06E-9wordwrap1.06E-9function"
-string(37) "testing1.06E-9wordwrap1.06E-9function"
-string(37) "testing1.06E-9wordwrap1.06E-9function"
+string(49) "testing1.07654321E-9wordwrap1.07654321E-9function"
+string(49) "testing1.07654321E-9wordwrap1.07654321E-9function"
+string(49) "testing1.07654321E-9wordwrap1.07654321E-9function"
-- Iteration 9 --
string(29) "testing0.5wordwrap0.5function"
string(29) "testing0.5wordwrap0.5function"
diff --git a/ext/standard/tests/url/base64_decode_basic_001.phpt b/ext/standard/tests/url/base64_decode_basic_001.phpt
new file mode 100644
index 000000000..7aba807e1
--- /dev/null
+++ b/ext/standard/tests/url/base64_decode_basic_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test base64_decode() function : basic functionality - ensure all base64 alphabet is supported.
+--FILE--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "Decode an input string containing the whole base64 alphabet:\n";
+$allbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+var_dump(bin2hex(base64_decode($allbase64)));
+var_dump(bin2hex(base64_decode($allbase64, false)));
+var_dump(bin2hex(base64_decode($allbase64, true)));
+
+echo "Done";
+?>
+--EXPECTF--
+Decode an input string containing the whole base64 alphabet:
+string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf"
+string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf"
+string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/base64_decode_basic_002.phpt b/ext/standard/tests/url/base64_decode_basic_002.phpt
new file mode 100644
index 000000000..1289894f4
--- /dev/null
+++ b/ext/standard/tests/url/base64_decode_basic_002.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test base64_decode() function : basic functionality - strict vs non-strict with non-base64 chars.
+--FILE--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "Decode 'hello world!':\n";
+$noWhiteSpace = "aGVsbG8gd29ybGQh";
+var_dump(base64_decode($noWhiteSpace));
+var_dump(base64_decode($noWhiteSpace, false));
+var_dump(base64_decode($noWhiteSpace, true));
+
+echo "\nWhitespace does not affect base64_decode, even with \$strict===true:\n";
+$withWhiteSpace = "a GVs bG8gd2
+ 9ybGQh";
+var_dump(base64_decode($withWhiteSpace));
+var_dump(base64_decode($withWhiteSpace, false));
+var_dump(base64_decode($withWhiteSpace, true));
+
+echo "\nOther chars outside the base64 alphabet are ignored when \$strict===false, but cause failure with \$strict===true:\n";
+$badChars = $noWhiteSpace . '*';
+var_dump(base64_decode($badChars));
+var_dump(base64_decode($badChars, false));
+var_dump(base64_decode($badChars, true));
+
+echo "Done";
+?>
+--EXPECTF--
+Decode 'hello world!':
+string(12) "hello world!"
+string(12) "hello world!"
+string(12) "hello world!"
+
+Whitespace does not affect base64_decode, even with $strict===true:
+string(12) "hello world!"
+string(12) "hello world!"
+string(12) "hello world!"
+
+Other chars outside the base64 alphabet are ignored when $strict===false, but cause failure with $strict===true:
+string(12) "hello world!"
+string(12) "hello world!"
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/base64_decode_error_001.phpt b/ext/standard/tests/url/base64_decode_error_001.phpt
new file mode 100644
index 000000000..272516446
--- /dev/null
+++ b/ext/standard/tests/url/base64_decode_error_001.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test base64_decode() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "*** Testing base64_decode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing base64_decode() function with Zero arguments --\n";
+var_dump( base64_decode() );
+
+//Test base64_decode with one more than the expected number of arguments
+echo "\n-- Testing base64_decode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$strict = true;
+$extra_arg = 10;
+var_dump( base64_decode($str, $strict, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_decode() : error conditions ***
+
+-- Testing base64_decode() function with Zero arguments --
+
+Warning: base64_decode() expects at least 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing base64_decode() function with more than expected no. of arguments --
+
+Warning: base64_decode() expects at most 2 parameters, 3 given in %s on line 19
+NULL
+Done
diff --git a/ext/standard/tests/url/base64_decode_variation_001.phpt b/ext/standard/tests/url/base64_decode_variation_001.phpt
new file mode 100644
index 000000000..b01cd23e5
--- /dev/null
+++ b/ext/standard/tests/url/base64_decode_variation_001.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test base64_decode() function : usage variations - unexpected types for arg 1
+--FILE--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing base64_decode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$strict = true;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( base64_decode($value, $strict) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_decode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(63)
+Error: 8 - Undefined variable: unset_var, %s(66)
+
+Arg value 0
+string(0) ""
+
+Arg value 1
+string(0) ""
+
+Arg value 12345
+string(3) "×mø"
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+string(9) "×MvߎzïM4"
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
+
+Arg value
+Error: 2 - base64_decode() expects parameter 1 to be string, object given, %s(73)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done
diff --git a/ext/standard/tests/url/base64_decode_variation_002.phpt b/ext/standard/tests/url/base64_decode_variation_002.phpt
new file mode 100644
index 000000000..145784a4e
--- /dev/null
+++ b/ext/standard/tests/url/base64_decode_variation_002.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test base64_decode() function : usage variations - unexpected types for arg 2
+--FILE--
+<?php
+/* Prototype : proto string base64_decode(string str[, bool strict])
+ * Description: Decodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing base64_decode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$str = 'aGVsbG8gd29ybGQh!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for strict
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( base64_decode($str, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_decode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(67)
+Error: 8 - Undefined variable: unset_var, %s(70)
+
+Arg value 0
+string(12) "hello world!"
+
+Arg value 1
+bool(false)
+
+Arg value 12345
+bool(false)
+
+Arg value -2345
+bool(false)
+
+Arg value 10.5
+bool(false)
+
+Arg value -10.5
+bool(false)
+
+Arg value 101234567000
+bool(false)
+
+Arg value 1.07654321E-9
+bool(false)
+
+Arg value 0.5
+bool(false)
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77)
+NULL
+
+Arg value Array
+Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77)
+NULL
+
+Arg value
+string(12) "hello world!"
+
+Arg value
+string(12) "hello world!"
+
+Arg value 1
+bool(false)
+
+Arg value
+string(12) "hello world!"
+
+Arg value 1
+bool(false)
+
+Arg value
+string(12) "hello world!"
+
+Arg value
+string(12) "hello world!"
+
+Arg value
+string(12) "hello world!"
+
+Arg value string
+bool(false)
+
+Arg value string
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(76)
+
+Arg value
+Error: 2 - base64_decode() expects parameter 2 to be boolean, object given, %s(77)
+NULL
+
+Arg value
+string(12) "hello world!"
+
+Arg value
+string(12) "hello world!"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/base64_encode_basic_001.phpt b/ext/standard/tests/url/base64_encode_basic_001.phpt
new file mode 100644
index 000000000..6ab57f4c5
--- /dev/null
+++ b/ext/standard/tests/url/base64_encode_basic_001.phpt
@@ -0,0 +1,283 @@
+--TEST--
+Test base64_encode() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto string base64_encode(string str)
+ * Description: Encodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+/*
+ * Test base64_encode with single byte values.
+ */
+
+echo "*** Testing base64_encode() : basic functionality ***\n";
+
+for ($i=0; $i<256; $i++) {
+ $str = pack("c", $i);
+ $enc = base64_encode($str);
+ printf("0x%X: %s\n", $i, $enc);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_encode() : basic functionality ***
+0x0: AA==
+0x1: AQ==
+0x2: Ag==
+0x3: Aw==
+0x4: BA==
+0x5: BQ==
+0x6: Bg==
+0x7: Bw==
+0x8: CA==
+0x9: CQ==
+0xA: Cg==
+0xB: Cw==
+0xC: DA==
+0xD: DQ==
+0xE: Dg==
+0xF: Dw==
+0x10: EA==
+0x11: EQ==
+0x12: Eg==
+0x13: Ew==
+0x14: FA==
+0x15: FQ==
+0x16: Fg==
+0x17: Fw==
+0x18: GA==
+0x19: GQ==
+0x1A: Gg==
+0x1B: Gw==
+0x1C: HA==
+0x1D: HQ==
+0x1E: Hg==
+0x1F: Hw==
+0x20: IA==
+0x21: IQ==
+0x22: Ig==
+0x23: Iw==
+0x24: JA==
+0x25: JQ==
+0x26: Jg==
+0x27: Jw==
+0x28: KA==
+0x29: KQ==
+0x2A: Kg==
+0x2B: Kw==
+0x2C: LA==
+0x2D: LQ==
+0x2E: Lg==
+0x2F: Lw==
+0x30: MA==
+0x31: MQ==
+0x32: Mg==
+0x33: Mw==
+0x34: NA==
+0x35: NQ==
+0x36: Ng==
+0x37: Nw==
+0x38: OA==
+0x39: OQ==
+0x3A: Og==
+0x3B: Ow==
+0x3C: PA==
+0x3D: PQ==
+0x3E: Pg==
+0x3F: Pw==
+0x40: QA==
+0x41: QQ==
+0x42: Qg==
+0x43: Qw==
+0x44: RA==
+0x45: RQ==
+0x46: Rg==
+0x47: Rw==
+0x48: SA==
+0x49: SQ==
+0x4A: Sg==
+0x4B: Sw==
+0x4C: TA==
+0x4D: TQ==
+0x4E: Tg==
+0x4F: Tw==
+0x50: UA==
+0x51: UQ==
+0x52: Ug==
+0x53: Uw==
+0x54: VA==
+0x55: VQ==
+0x56: Vg==
+0x57: Vw==
+0x58: WA==
+0x59: WQ==
+0x5A: Wg==
+0x5B: Ww==
+0x5C: XA==
+0x5D: XQ==
+0x5E: Xg==
+0x5F: Xw==
+0x60: YA==
+0x61: YQ==
+0x62: Yg==
+0x63: Yw==
+0x64: ZA==
+0x65: ZQ==
+0x66: Zg==
+0x67: Zw==
+0x68: aA==
+0x69: aQ==
+0x6A: ag==
+0x6B: aw==
+0x6C: bA==
+0x6D: bQ==
+0x6E: bg==
+0x6F: bw==
+0x70: cA==
+0x71: cQ==
+0x72: cg==
+0x73: cw==
+0x74: dA==
+0x75: dQ==
+0x76: dg==
+0x77: dw==
+0x78: eA==
+0x79: eQ==
+0x7A: eg==
+0x7B: ew==
+0x7C: fA==
+0x7D: fQ==
+0x7E: fg==
+0x7F: fw==
+0x80: gA==
+0x81: gQ==
+0x82: gg==
+0x83: gw==
+0x84: hA==
+0x85: hQ==
+0x86: hg==
+0x87: hw==
+0x88: iA==
+0x89: iQ==
+0x8A: ig==
+0x8B: iw==
+0x8C: jA==
+0x8D: jQ==
+0x8E: jg==
+0x8F: jw==
+0x90: kA==
+0x91: kQ==
+0x92: kg==
+0x93: kw==
+0x94: lA==
+0x95: lQ==
+0x96: lg==
+0x97: lw==
+0x98: mA==
+0x99: mQ==
+0x9A: mg==
+0x9B: mw==
+0x9C: nA==
+0x9D: nQ==
+0x9E: ng==
+0x9F: nw==
+0xA0: oA==
+0xA1: oQ==
+0xA2: og==
+0xA3: ow==
+0xA4: pA==
+0xA5: pQ==
+0xA6: pg==
+0xA7: pw==
+0xA8: qA==
+0xA9: qQ==
+0xAA: qg==
+0xAB: qw==
+0xAC: rA==
+0xAD: rQ==
+0xAE: rg==
+0xAF: rw==
+0xB0: sA==
+0xB1: sQ==
+0xB2: sg==
+0xB3: sw==
+0xB4: tA==
+0xB5: tQ==
+0xB6: tg==
+0xB7: tw==
+0xB8: uA==
+0xB9: uQ==
+0xBA: ug==
+0xBB: uw==
+0xBC: vA==
+0xBD: vQ==
+0xBE: vg==
+0xBF: vw==
+0xC0: wA==
+0xC1: wQ==
+0xC2: wg==
+0xC3: ww==
+0xC4: xA==
+0xC5: xQ==
+0xC6: xg==
+0xC7: xw==
+0xC8: yA==
+0xC9: yQ==
+0xCA: yg==
+0xCB: yw==
+0xCC: zA==
+0xCD: zQ==
+0xCE: zg==
+0xCF: zw==
+0xD0: 0A==
+0xD1: 0Q==
+0xD2: 0g==
+0xD3: 0w==
+0xD4: 1A==
+0xD5: 1Q==
+0xD6: 1g==
+0xD7: 1w==
+0xD8: 2A==
+0xD9: 2Q==
+0xDA: 2g==
+0xDB: 2w==
+0xDC: 3A==
+0xDD: 3Q==
+0xDE: 3g==
+0xDF: 3w==
+0xE0: 4A==
+0xE1: 4Q==
+0xE2: 4g==
+0xE3: 4w==
+0xE4: 5A==
+0xE5: 5Q==
+0xE6: 5g==
+0xE7: 5w==
+0xE8: 6A==
+0xE9: 6Q==
+0xEA: 6g==
+0xEB: 6w==
+0xEC: 7A==
+0xED: 7Q==
+0xEE: 7g==
+0xEF: 7w==
+0xF0: 8A==
+0xF1: 8Q==
+0xF2: 8g==
+0xF3: 8w==
+0xF4: 9A==
+0xF5: 9Q==
+0xF6: 9g==
+0xF7: 9w==
+0xF8: +A==
+0xF9: +Q==
+0xFA: +g==
+0xFB: +w==
+0xFC: /A==
+0xFD: /Q==
+0xFE: /g==
+0xFF: /w==
+Done
diff --git a/ext/standard/tests/url/base64_encode_error_001.phpt b/ext/standard/tests/url/base64_encode_error_001.phpt
new file mode 100644
index 000000000..a8883ac8f
--- /dev/null
+++ b/ext/standard/tests/url/base64_encode_error_001.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test base64_encode() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto string base64_encode(string str)
+ * Description: Encodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "*** Testing base64_encode() : error conditions - wrong number of args ***\n";
+
+// Zero arguments
+echo "\n-- Testing base64_encode() function with Zero arguments --\n";
+var_dump( base64_encode() );
+
+//Test base64_encode with one more than the expected number of arguments
+echo "\n-- Testing base64_encode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( base64_encode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_encode() : error conditions - wrong number of args ***
+
+-- Testing base64_encode() function with Zero arguments --
+
+Warning: base64_encode() expects exactly 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing base64_encode() function with more than expected no. of arguments --
+
+Warning: base64_encode() expects exactly 1 parameter, 2 given in %s on line 18
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/base64_encode_variation_001.phpt b/ext/standard/tests/url/base64_encode_variation_001.phpt
new file mode 100644
index 000000000..30da145a8
--- /dev/null
+++ b/ext/standard/tests/url/base64_encode_variation_001.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test base64_encode() function : usage variations - unexpected types for argument 1
+--FILE--
+<?php
+/* Prototype : proto string base64_encode(string str)
+ * Description: Encodes string using MIME base64 algorithm
+ * Source code: ext/standard/base64.c
+ * Alias to functions:
+ */
+
+echo "*** Testing base64_encode() : usage variations ***\n";
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( base64_encode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing base64_encode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(63)
+Error: 8 - Undefined variable: unset_var, %s(66)
+
+Arg value 0
+string(4) "MA=="
+
+Arg value 1
+string(4) "MQ=="
+
+Arg value 12345
+string(8) "MTIzNDU="
+
+Arg value -2345
+string(8) "LTIzNDU="
+
+Arg value 10.5
+string(8) "MTAuNQ=="
+
+Arg value -10.5
+string(8) "LTEwLjU="
+
+Arg value 101234567000
+string(16) "MTAxMjM0NTY3MDAw"
+
+Arg value 1.07654321E-9
+string(20) "MS4wNzY1NDMyMUUtOQ=="
+
+Arg value 0.5
+string(4) "MC41"
+
+Arg value Array
+Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value Array
+Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(4) "MQ=="
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(4) "MQ=="
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
+
+Arg value
+Error: 2 - base64_encode() expects parameter 1 to be string, object given, %s(73)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done
diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt
new file mode 100644
index 000000000..3d50689a4
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_001.phpt
@@ -0,0 +1,899 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying the component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying the component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "\n--> $url: ";
+ var_dump(parse_url($url));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+
+--> 64.246.30.37: array(1) {
+ ["path"]=>
+ string(12) "64.246.30.37"
+}
+
+--> http://64.246.30.37: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(12) "64.246.30.37"
+}
+
+--> http://64.246.30.37/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(12) "64.246.30.37"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> 64.246.30.37/: array(1) {
+ ["path"]=>
+ string(13) "64.246.30.37/"
+}
+
+--> 64.246.30.37:80/: array(3) {
+ ["host"]=>
+ string(12) "64.246.30.37"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> php.net: array(1) {
+ ["path"]=>
+ string(7) "php.net"
+}
+
+--> php.net/: array(1) {
+ ["path"]=>
+ string(8) "php.net/"
+}
+
+--> http://php.net: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "php.net"
+}
+
+--> http://php.net/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> www.php.net: array(1) {
+ ["path"]=>
+ string(11) "www.php.net"
+}
+
+--> www.php.net/: array(1) {
+ ["path"]=>
+ string(12) "www.php.net/"
+}
+
+--> http://www.php.net: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+}
+
+--> http://www.php.net/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> www.php.net:80: array(2) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+}
+
+--> http://www.php.net:80: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+}
+
+--> http://www.php.net:80/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net/index.php: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> www.php.net/?: array(1) {
+ ["path"]=>
+ string(12) "www.php.net/"
+}
+
+--> www.php.net:80/?: array(3) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net/?: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/?: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/foo/bar/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(18) "/foo/bar/index.php"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+ ["query"]=>
+ string(37) "lots=1&of=2&parameters=3&too=4&here=5"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(45) "/this/is/a/very/deep/directory/structure/and/"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+}
+
+--> http://www.php.net:80/this/../a/../deep/directory: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(28) "/this/../a/../deep/directory"
+}
+
+--> http://www.php.net:80/this/../a/../deep/directory/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(29) "/this/../a/../deep/directory/"
+}
+
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(42) "/this/is/a/very/deep/directory/../file.php"
+}
+
+--> http://www.php.net:80/index.php: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/index.php?: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+}
+
+--> http://www.php.net:80/#foo: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["fragment"]=>
+ string(3) "foo"
+}
+
+--> http://www.php.net:80/?#: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://www.php.net:80/?test=1: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(6) "test=1"
+}
+
+--> http://www.php.net/?test=1&: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(7) "test=1&"
+}
+
+--> http://www.php.net:80/?&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(1) "/"
+ ["query"]=>
+ string(1) "&"
+}
+
+--> http://www.php.net:80/index.php?test=1&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(7) "test=1&"
+}
+
+--> http://www.php.net/index.php?&: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(1) "&"
+}
+
+--> http://www.php.net:80/index.php?foo&: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(4) "foo&"
+}
+
+--> http://www.php.net/index.php?&foo: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(4) "&foo"
+}
+
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+}
+
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) {
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["user"]=>
+ string(6) "secret"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(14) "secret@hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hid:out"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+--> nntp://news.php.net: array(2) {
+ ["scheme"]=>
+ string(4) "nntp"
+ ["host"]=>
+ string(12) "news.php.net"
+}
+
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) {
+ ["scheme"]=>
+ string(3) "ftp"
+ ["host"]=>
+ string(11) "ftp.gnu.org"
+ ["path"]=>
+ string(22) "/gnu/glic/glibc.tar.gz"
+}
+
+--> zlib:http://foo@bar: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(14) "http://foo@bar"
+}
+
+--> zlib:filename.txt: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(12) "filename.txt"
+}
+
+--> zlib:/path/to/my/file/file.txt: array(2) {
+ ["scheme"]=>
+ string(4) "zlib"
+ ["path"]=>
+ string(25) "/path/to/my/file/file.txt"
+}
+
+--> foo://foo@bar: array(3) {
+ ["scheme"]=>
+ string(3) "foo"
+ ["host"]=>
+ string(3) "bar"
+ ["user"]=>
+ string(3) "foo"
+}
+
+--> mailto:me@mydomain.com: array(2) {
+ ["scheme"]=>
+ string(6) "mailto"
+ ["path"]=>
+ string(15) "me@mydomain.com"
+}
+
+--> /foo.php?a=b&c=d: array(2) {
+ ["path"]=>
+ string(8) "/foo.php"
+ ["query"]=>
+ string(7) "a=b&c=d"
+}
+
+--> foo.php?a=b&c=d: array(2) {
+ ["path"]=>
+ string(7) "foo.php"
+ ["query"]=>
+ string(7) "a=b&c=d"
+}
+
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(15) "www.example.com"
+ ["port"]=>
+ int(8080)
+ ["user"]=>
+ string(4) "user"
+ ["pass"]=>
+ string(6) "passwd"
+ ["query"]=>
+ string(12) "bar=1&boom=0"
+}
+
+--> file:///path/to/file: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(13) "/path/to/file"
+}
+
+--> file://path/to/file: array(3) {
+ ["scheme"]=>
+ string(4) "file"
+ ["host"]=>
+ string(4) "path"
+ ["path"]=>
+ string(8) "/to/file"
+}
+
+--> file:/path/to/file: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(13) "/path/to/file"
+}
+
+--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "1.2.3.4"
+ ["path"]=>
+ string(8) "/abc.asp"
+ ["query"]=>
+ string(7) "a=1&b=2"
+}
+
+--> http://foo.com#bar: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(7) "foo.com"
+ ["fragment"]=>
+ string(3) "bar"
+}
+
+--> scheme:: array(1) {
+ ["scheme"]=>
+ string(6) "scheme"
+}
+
+--> foo+bar://baz@bang/bla: array(4) {
+ ["scheme"]=>
+ string(7) "foo+bar"
+ ["host"]=>
+ string(4) "bang"
+ ["user"]=>
+ string(3) "baz"
+ ["path"]=>
+ string(4) "/bla"
+}
+
+--> gg:9130731: array(2) {
+ ["scheme"]=>
+ string(2) "gg"
+ ["path"]=>
+ string(7) "9130731"
+}
+
+--> http://user:@pass@host/path?argument?value#etc: array(7) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(4) "host"
+ ["user"]=>
+ string(4) "user"
+ ["pass"]=>
+ string(5) "@pass"
+ ["path"]=>
+ string(5) "/path"
+ ["query"]=>
+ string(14) "argument?value"
+ ["fragment"]=>
+ string(3) "etc"
+}
+
+--> http://10.10.10.10/:80: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "10.10.10.10"
+ ["path"]=>
+ string(4) "/:80"
+}
+
+--> http://x:?: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) "x"
+}
+
+--> x:blah.com: array(2) {
+ ["scheme"]=>
+ string(1) "x"
+ ["path"]=>
+ string(8) "blah.com"
+}
+
+--> x:/blah.com: array(2) {
+ ["scheme"]=>
+ string(1) "x"
+ ["path"]=>
+ string(9) "/blah.com"
+}
+
+--> x://::abc/?: array(3) {
+ ["scheme"]=>
+ string(1) "x"
+ ["host"]=>
+ string(1) ":"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://::?: array(2) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) ":"
+}
+
+--> x://::6.5: array(3) {
+ ["scheme"]=>
+ string(1) "x"
+ ["host"]=>
+ string(1) ":"
+ ["port"]=>
+ int(6)
+}
+
+--> http://?:/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) "?"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http://@?:/: array(4) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(1) "?"
+ ["user"]=>
+ string(0) ""
+ ["path"]=>
+ string(1) "/"
+}
+
+--> file:///:: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(2) "/:"
+}
+
+--> file:///a:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(3) "a:/"
+}
+
+--> file:///ab:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(5) "/ab:/"
+}
+
+--> file:///a:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(3) "a:/"
+}
+
+--> file:///@:/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(3) "@:/"
+}
+
+--> file:///:80/: array(2) {
+ ["scheme"]=>
+ string(4) "file"
+ ["path"]=>
+ string(5) "/:80/"
+}
+
+--> []: array(1) {
+ ["path"]=>
+ string(2) "[]"
+}
+
+--> http://[x:80]/: array(3) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(6) "[x:80]"
+ ["path"]=>
+ string(1) "/"
+}
+
+--> : array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+--> /: array(1) {
+ ["path"]=>
+ string(1) "/"
+}
+
+--> http:///blah.com:
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://:80:
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://user@:80:
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://user:pass@:80:
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://::
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://@/:
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://@:/:
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://:/:
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://?:
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://?::
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://:?:
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://blah.com:123456:
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+
+--> http://blah.com:abcdef:
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt
new file mode 100644
index 000000000..e25ab8dcd
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_002.phpt
@@ -0,0 +1,151 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_SCHEME as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_SCHEME as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_SCHEME));
+
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : string(4) "http"
+--> http://64.246.30.37/ : string(4) "http"
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : string(4) "http"
+--> http://php.net/ : string(4) "http"
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : string(4) "http"
+--> http://www.php.net/ : string(4) "http"
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : string(4) "http"
+--> http://www.php.net:80/ : string(4) "http"
+--> http://www.php.net/index.php : string(4) "http"
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : string(4) "http"
+--> http://www.php.net:80/? : string(4) "http"
+--> http://www.php.net:80/index.php : string(4) "http"
+--> http://www.php.net:80/foo/bar/index.php : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http"
+--> http://www.php.net:80/this/../a/../deep/directory : string(4) "http"
+--> http://www.php.net:80/this/../a/../deep/directory/ : string(4) "http"
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(4) "http"
+--> http://www.php.net:80/index.php : string(4) "http"
+--> http://www.php.net:80/index.php? : string(4) "http"
+--> http://www.php.net:80/#foo : string(4) "http"
+--> http://www.php.net:80/?# : string(4) "http"
+--> http://www.php.net:80/?test=1 : string(4) "http"
+--> http://www.php.net/?test=1& : string(4) "http"
+--> http://www.php.net:80/?& : string(4) "http"
+--> http://www.php.net:80/index.php?test=1& : string(4) "http"
+--> http://www.php.net/index.php?& : string(4) "http"
+--> http://www.php.net:80/index.php?foo& : string(4) "http"
+--> http://www.php.net/index.php?&foo : string(4) "http"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(4) "http"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
+--> nntp://news.php.net : string(4) "nntp"
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(3) "ftp"
+--> zlib:http://foo@bar : string(4) "zlib"
+--> zlib:filename.txt : string(4) "zlib"
+--> zlib:/path/to/my/file/file.txt : string(4) "zlib"
+--> foo://foo@bar : string(3) "foo"
+--> mailto:me@mydomain.com : string(6) "mailto"
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "http"
+--> file:///path/to/file : string(4) "file"
+--> file://path/to/file : string(4) "file"
+--> file:/path/to/file : string(4) "file"
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(4) "http"
+--> http://foo.com#bar : string(4) "http"
+--> scheme: : string(6) "scheme"
+--> foo+bar://baz@bang/bla : string(7) "foo+bar"
+--> gg:9130731 : string(2) "gg"
+--> http://user:@pass@host/path?argument?value#etc : string(4) "http"
+--> http://10.10.10.10/:80 : string(4) "http"
+--> http://x:? : string(4) "http"
+--> x:blah.com : string(1) "x"
+--> x:/blah.com : string(1) "x"
+--> x://::abc/? : string(1) "x"
+--> http://::? : string(4) "http"
+--> x://::6.5 : string(1) "x"
+--> http://?:/ : string(4) "http"
+--> http://@?:/ : string(4) "http"
+--> file:///: : string(4) "file"
+--> file:///a:/ : string(4) "file"
+--> file:///ab:/ : string(4) "file"
+--> file:///a:/ : string(4) "file"
+--> file:///@:/ : string(4) "file"
+--> file:///:80/ : string(4) "file"
+--> [] : NULL
+--> http://[x:80]/ : string(4) "http"
+--> : NULL
+--> / : NULL
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt
new file mode 100644
index 000000000..e34dc2d19
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_003.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_HOST as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_HOST as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_HOST));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : string(12) "64.246.30.37"
+--> http://64.246.30.37/ : string(12) "64.246.30.37"
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : string(12) "64.246.30.37"
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : string(7) "php.net"
+--> http://php.net/ : string(7) "php.net"
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : string(11) "www.php.net"
+--> http://www.php.net/ : string(11) "www.php.net"
+--> www.php.net:80 : string(11) "www.php.net"
+--> http://www.php.net:80 : string(11) "www.php.net"
+--> http://www.php.net:80/ : string(11) "www.php.net"
+--> http://www.php.net/index.php : string(11) "www.php.net"
+--> www.php.net/? : NULL
+--> www.php.net:80/? : string(11) "www.php.net"
+--> http://www.php.net/? : string(11) "www.php.net"
+--> http://www.php.net:80/? : string(11) "www.php.net"
+--> http://www.php.net:80/index.php : string(11) "www.php.net"
+--> http://www.php.net:80/foo/bar/index.php : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net"
+--> http://www.php.net:80/this/../a/../deep/directory : string(11) "www.php.net"
+--> http://www.php.net:80/this/../a/../deep/directory/ : string(11) "www.php.net"
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(11) "www.php.net"
+--> http://www.php.net:80/index.php : string(11) "www.php.net"
+--> http://www.php.net:80/index.php? : string(11) "www.php.net"
+--> http://www.php.net:80/#foo : string(11) "www.php.net"
+--> http://www.php.net:80/?# : string(11) "www.php.net"
+--> http://www.php.net:80/?test=1 : string(11) "www.php.net"
+--> http://www.php.net/?test=1& : string(11) "www.php.net"
+--> http://www.php.net:80/?& : string(11) "www.php.net"
+--> http://www.php.net:80/index.php?test=1& : string(11) "www.php.net"
+--> http://www.php.net/index.php?& : string(11) "www.php.net"
+--> http://www.php.net:80/index.php?foo& : string(11) "www.php.net"
+--> http://www.php.net/index.php?&foo : string(11) "www.php.net"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(11) "www.php.net"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
+--> nntp://news.php.net : string(12) "news.php.net"
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(11) "ftp.gnu.org"
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : string(3) "bar"
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(15) "www.example.com"
+--> file:///path/to/file : NULL
+--> file://path/to/file : string(4) "path"
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "1.2.3.4"
+--> http://foo.com#bar : string(7) "foo.com"
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : string(4) "bang"
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(4) "host"
+--> http://10.10.10.10/:80 : string(11) "10.10.10.10"
+--> http://x:? : string(1) "x"
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : string(1) ":"
+--> http://::? : string(1) ":"
+--> x://::6.5 : string(1) ":"
+--> http://?:/ : string(1) "?"
+--> http://@?:/ : string(1) "?"
+--> file:///: : NULL
+--> file:///a:/ : NULL
+--> file:///ab:/ : NULL
+--> file:///a:/ : NULL
+--> file:///@:/ : NULL
+--> file:///:80/ : NULL
+--> [] : NULL
+--> http://[x:80]/ : string(6) "[x:80]"
+--> : NULL
+--> / : NULL
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt
new file mode 100644
index 000000000..af3279547
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_004.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PORT as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_PORT as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PORT));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : int(80)
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : int(80)
+--> http://www.php.net:80 : int(80)
+--> http://www.php.net:80/ : int(80)
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : int(80)
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : int(80)
+--> http://www.php.net:80/index.php : int(80)
+--> http://www.php.net:80/foo/bar/index.php : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80)
+--> http://www.php.net:80/this/../a/../deep/directory : int(80)
+--> http://www.php.net:80/this/../a/../deep/directory/ : int(80)
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : int(80)
+--> http://www.php.net:80/index.php : int(80)
+--> http://www.php.net:80/index.php? : int(80)
+--> http://www.php.net:80/#foo : int(80)
+--> http://www.php.net:80/?# : int(80)
+--> http://www.php.net:80/?test=1 : int(80)
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : int(80)
+--> http://www.php.net:80/index.php?test=1& : int(80)
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : int(80)
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : int(80)
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : int(8080)
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : NULL
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : NULL
+--> http://::? : NULL
+--> x://::6.5 : int(6)
+--> http://?:/ : NULL
+--> http://@?:/ : NULL
+--> file:///: : NULL
+--> file:///a:/ : NULL
+--> file:///ab:/ : NULL
+--> file:///a:/ : NULL
+--> file:///@:/ : NULL
+--> file:///:80/ : NULL
+--> [] : NULL
+--> http://[x:80]/ : NULL
+--> : NULL
+--> / : NULL
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt
new file mode 100644
index 000000000..5eb2541c1
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_005.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_USER as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_USER));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : NULL
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : NULL
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : NULL
+--> http://www.php.net:80/index.php?test=1& : NULL
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : NULL
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : string(3) "foo"
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "user"
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : string(3) "baz"
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(4) "user"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : NULL
+--> http://::? : NULL
+--> x://::6.5 : NULL
+--> http://?:/ : NULL
+--> http://@?:/ : string(0) ""
+--> file:///: : NULL
+--> file:///a:/ : NULL
+--> file:///ab:/ : NULL
+--> file:///a:/ : NULL
+--> file:///@:/ : NULL
+--> file:///:80/ : NULL
+--> [] : NULL
+--> http://[x:80]/ : NULL
+--> : NULL
+--> / : NULL
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt
new file mode 100644
index 000000000..926200a1a
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_006.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PASS as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_PASS as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PASS));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : NULL
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : NULL
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : NULL
+--> http://www.php.net:80/index.php?test=1& : NULL
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : NULL
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hid:out"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(6) "passwd"
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(5) "@pass"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : NULL
+--> http://::? : NULL
+--> x://::6.5 : NULL
+--> http://?:/ : NULL
+--> http://@?:/ : NULL
+--> file:///: : NULL
+--> file:///a:/ : NULL
+--> file:///ab:/ : NULL
+--> file:///a:/ : NULL
+--> file:///@:/ : NULL
+--> file:///:80/ : NULL
+--> [] : NULL
+--> http://[x:80]/ : NULL
+--> : NULL
+--> / : NULL
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt
new file mode 100644
index 000000000..d99ccb667
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_007.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PATH as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_PATH as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PATH));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : string(12) "64.246.30.37"
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : string(1) "/"
+--> 64.246.30.37/ : string(13) "64.246.30.37/"
+--> 64.246.30.37:80/ : string(1) "/"
+--> php.net : string(7) "php.net"
+--> php.net/ : string(8) "php.net/"
+--> http://php.net : NULL
+--> http://php.net/ : string(1) "/"
+--> www.php.net : string(11) "www.php.net"
+--> www.php.net/ : string(12) "www.php.net/"
+--> http://www.php.net : NULL
+--> http://www.php.net/ : string(1) "/"
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : string(1) "/"
+--> http://www.php.net/index.php : string(10) "/index.php"
+--> www.php.net/? : string(12) "www.php.net/"
+--> www.php.net:80/? : string(1) "/"
+--> http://www.php.net/? : string(1) "/"
+--> http://www.php.net:80/? : string(1) "/"
+--> http://www.php.net:80/index.php : string(10) "/index.php"
+--> http://www.php.net:80/foo/bar/index.php : string(18) "/foo/bar/index.php"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(45) "/this/is/a/very/deep/directory/structure/and/"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php"
+--> http://www.php.net:80/this/../a/../deep/directory : string(28) "/this/../a/../deep/directory"
+--> http://www.php.net:80/this/../a/../deep/directory/ : string(29) "/this/../a/../deep/directory/"
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(42) "/this/is/a/very/deep/directory/../file.php"
+--> http://www.php.net:80/index.php : string(10) "/index.php"
+--> http://www.php.net:80/index.php? : string(10) "/index.php"
+--> http://www.php.net:80/#foo : string(1) "/"
+--> http://www.php.net:80/?# : string(1) "/"
+--> http://www.php.net:80/?test=1 : string(1) "/"
+--> http://www.php.net/?test=1& : string(1) "/"
+--> http://www.php.net:80/?& : string(1) "/"
+--> http://www.php.net:80/index.php?test=1& : string(10) "/index.php"
+--> http://www.php.net/index.php?& : string(10) "/index.php"
+--> http://www.php.net:80/index.php?foo& : string(10) "/index.php"
+--> http://www.php.net/index.php?&foo : string(10) "/index.php"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(10) "/index.php"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(22) "/gnu/glic/glibc.tar.gz"
+--> zlib:http://foo@bar : string(14) "http://foo@bar"
+--> zlib:filename.txt : string(12) "filename.txt"
+--> zlib:/path/to/my/file/file.txt : string(25) "/path/to/my/file/file.txt"
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : string(15) "me@mydomain.com"
+--> /foo.php?a=b&c=d : string(8) "/foo.php"
+--> foo.php?a=b&c=d : string(7) "foo.php"
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL
+--> file:///path/to/file : string(13) "/path/to/file"
+--> file://path/to/file : string(8) "/to/file"
+--> file:/path/to/file : string(13) "/path/to/file"
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(8) "/abc.asp"
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : string(4) "/bla"
+--> gg:9130731 : string(7) "9130731"
+--> http://user:@pass@host/path?argument?value#etc : string(5) "/path"
+--> http://10.10.10.10/:80 : string(4) "/:80"
+--> http://x:? : NULL
+--> x:blah.com : string(8) "blah.com"
+--> x:/blah.com : string(9) "/blah.com"
+--> x://::abc/? : string(1) "/"
+--> http://::? : NULL
+--> x://::6.5 : NULL
+--> http://?:/ : string(1) "/"
+--> http://@?:/ : string(1) "/"
+--> file:///: : string(2) "/:"
+--> file:///a:/ : string(3) "a:/"
+--> file:///ab:/ : string(5) "/ab:/"
+--> file:///a:/ : string(3) "a:/"
+--> file:///@:/ : string(3) "@:/"
+--> file:///:80/ : string(5) "/:80/"
+--> [] : string(2) "[]"
+--> http://[x:80]/ : string(1) "/"
+--> : string(0) ""
+--> / : string(1) "/"
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt
new file mode 100644
index 000000000..d2d2ebb59
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_008.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_QUERY as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_QUERY as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_QUERY));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : string(37) "lots=1&of=2&parameters=3&too=4&here=5"
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : NULL
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : string(6) "test=1"
+--> http://www.php.net/?test=1& : string(7) "test=1&"
+--> http://www.php.net:80/?& : string(1) "&"
+--> http://www.php.net:80/index.php?test=1& : string(7) "test=1&"
+--> http://www.php.net/index.php?& : string(1) "&"
+--> http://www.php.net:80/index.php?foo& : string(4) "foo&"
+--> http://www.php.net/index.php?&foo : string(4) "&foo"
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(31) "test=1&test2=char&test3=mixesCI"
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : string(7) "a=b&c=d"
+--> foo.php?a=b&c=d : string(7) "a=b&c=d"
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(12) "bar=1&boom=0"
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "a=1&b=2"
+--> http://foo.com#bar : NULL
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(14) "argument?value"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : NULL
+--> http://::? : NULL
+--> x://::6.5 : NULL
+--> http://?:/ : NULL
+--> http://@?:/ : NULL
+--> file:///: : NULL
+--> file:///a:/ : NULL
+--> file:///ab:/ : NULL
+--> file:///a:/ : NULL
+--> file:///@:/ : NULL
+--> file:///:80/ : NULL
+--> [] : NULL
+--> http://[x:80]/ : NULL
+--> : NULL
+--> / : NULL
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt
new file mode 100644
index 000000000..b23a30edf
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_009.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test parse_url() function: Parse a load of URLs without specifying PHP_URL_FRAGMENT as the URL component
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * Parse a load of URLs without specifying PHP_URL_FRAGMENT as the URL component
+ */
+include_once(dirname(__FILE__) . '/urls.inc');
+
+foreach ($urls as $url) {
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_FRAGMENT));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+--> 64.246.30.37 : NULL
+--> http://64.246.30.37 : NULL
+--> http://64.246.30.37/ : NULL
+--> 64.246.30.37/ : NULL
+--> 64.246.30.37:80/ : NULL
+--> php.net : NULL
+--> php.net/ : NULL
+--> http://php.net : NULL
+--> http://php.net/ : NULL
+--> www.php.net : NULL
+--> www.php.net/ : NULL
+--> http://www.php.net : NULL
+--> http://www.php.net/ : NULL
+--> www.php.net:80 : NULL
+--> http://www.php.net:80 : NULL
+--> http://www.php.net:80/ : NULL
+--> http://www.php.net/index.php : NULL
+--> www.php.net/? : NULL
+--> www.php.net:80/? : NULL
+--> http://www.php.net/? : NULL
+--> http://www.php.net:80/? : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/foo/bar/index.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5 : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
+--> http://www.php.net:80/this/../a/../deep/directory : NULL
+--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
+--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
+--> http://www.php.net:80/index.php : NULL
+--> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/#foo : string(3) "foo"
+--> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?test=1 : NULL
+--> http://www.php.net/?test=1& : NULL
+--> http://www.php.net:80/?& : NULL
+--> http://www.php.net:80/index.php?test=1& : NULL
+--> http://www.php.net/index.php?& : NULL
+--> http://www.php.net:80/index.php?foo& : NULL
+--> http://www.php.net/index.php?&foo : NULL
+--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL
+--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123"
+--> nntp://news.php.net : NULL
+--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
+--> zlib:http://foo@bar : NULL
+--> zlib:filename.txt : NULL
+--> zlib:/path/to/my/file/file.txt : NULL
+--> foo://foo@bar : NULL
+--> mailto:me@mydomain.com : NULL
+--> /foo.php?a=b&c=d : NULL
+--> foo.php?a=b&c=d : NULL
+--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL
+--> file:///path/to/file : NULL
+--> file://path/to/file : NULL
+--> file:/path/to/file : NULL
+--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL
+--> http://foo.com#bar : string(3) "bar"
+--> scheme: : NULL
+--> foo+bar://baz@bang/bla : NULL
+--> gg:9130731 : NULL
+--> http://user:@pass@host/path?argument?value#etc : string(3) "etc"
+--> http://10.10.10.10/:80 : NULL
+--> http://x:? : NULL
+--> x:blah.com : NULL
+--> x:/blah.com : NULL
+--> x://::abc/? : NULL
+--> http://::? : NULL
+--> x://::6.5 : NULL
+--> http://?:/ : NULL
+--> http://@?:/ : NULL
+--> file:///: : NULL
+--> file:///a:/ : NULL
+--> file:///ab:/ : NULL
+--> file:///a:/ : NULL
+--> file:///@:/ : NULL
+--> file:///:80/ : NULL
+--> [] : NULL
+--> http://[x:80]/ : NULL
+--> : NULL
+--> / : NULL
+--> http:///blah.com :
+Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:80 :
+Warning: parse_url(http://:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user@:80 :
+Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://user:pass@:80 :
+Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15
+bool(false)
+--> http://: :
+Warning: parse_url(http://:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@/ :
+Warning: parse_url(http://@/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://@:/ :
+Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:/ :
+Warning: parse_url(http://:/): Unable to parse URL in %s on line 15
+bool(false)
+--> http://? :
+Warning: parse_url(http://?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://?: :
+Warning: parse_url(http://?:): Unable to parse URL in %s on line 15
+bool(false)
+--> http://:? :
+Warning: parse_url(http://:?): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:123456 :
+Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15
+bool(false)
+--> http://blah.com:abcdef :
+Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_basic_010.phpt b/ext/standard/tests/url/parse_url_basic_010.phpt
new file mode 100644
index 000000000..3bb2dba14
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_basic_010.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test parse_url() function : check values of URL related constants
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+/*
+ * check values of URL related constants
+ */
+foreach(get_defined_constants() as $constantName => $constantValue) {
+ if (strpos($constantName, 'PHP_URL')===0) {
+ echo "$constantName: $constantValue \n";
+ }
+}
+
+echo "Done";
+?>
+--EXPECTF--
+PHP_URL_SCHEME: 0
+PHP_URL_HOST: 1
+PHP_URL_PORT: 2
+PHP_URL_USER: 3
+PHP_URL_PASS: 4
+PHP_URL_PATH: 5
+PHP_URL_QUERY: 6
+PHP_URL_FRAGMENT: 7
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_error_001.phpt b/ext/standard/tests/url/parse_url_error_001.phpt
new file mode 100644
index 000000000..0280a87cb
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_error_001.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test parse_url() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_url() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing parse_url() function with Zero arguments --\n";
+var_dump( parse_url() );
+
+//Test parse_url with one more than the expected number of arguments
+echo "\n-- Testing parse_url() function with more than expected no. of arguments --\n";
+$url = 'string_val';
+$url_component = 10;
+$extra_arg = 10;
+var_dump( parse_url($url, $url_component, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : error conditions ***
+
+-- Testing parse_url() function with Zero arguments --
+
+Warning: parse_url() expects at least 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing parse_url() function with more than expected no. of arguments --
+
+Warning: parse_url() expects at most 2 parameters, 3 given in %s on line 19
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_error_002.phpt b/ext/standard/tests/url/parse_url_error_002.phpt
new file mode 100644
index 000000000..45c20f410
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_error_002.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test parse_url() function: url component specifier out of range
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+echo "*** Testing parse_url() : error conditions: url component specifier out of range ***\n";
+$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
+
+echo "--> Below range:";
+var_dump(parse_url($url, -1));
+
+echo "\n\n--> Above range:";
+var_dump(parse_url($url, 99));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing parse_url() : error conditions: url component specifier out of range ***
+--> Below range:array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+
+--> Above range:
+Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_variation_001.phpt b/ext/standard/tests/url/parse_url_variation_001.phpt
new file mode 100644
index 000000000..18ef0a547
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_variation_001.phpt
@@ -0,0 +1,221 @@
+--TEST--
+Test parse_url() function : usage variations - unexpected type for arg 1.
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing parse_url() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for url
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( parse_url($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(60)
+Error: 8 - Undefined variable: unset_var, %s(63)
+
+Arg value 0
+array(1) {
+ ["path"]=>
+ string(1) "0"
+}
+
+Arg value 1
+array(1) {
+ ["path"]=>
+ string(1) "1"
+}
+
+Arg value 12345
+array(1) {
+ ["path"]=>
+ string(5) "12345"
+}
+
+Arg value -2345
+array(1) {
+ ["path"]=>
+ string(5) "-2345"
+}
+
+Arg value 10.5
+array(1) {
+ ["path"]=>
+ string(4) "10.5"
+}
+
+Arg value -10.5
+array(1) {
+ ["path"]=>
+ string(5) "-10.5"
+}
+
+Arg value 101234567000
+array(1) {
+ ["path"]=>
+ string(12) "101234567000"
+}
+
+Arg value 1.07654321E-9
+array(1) {
+ ["path"]=>
+ string(13) "1.07654321E-9"
+}
+
+Arg value 0.5
+array(1) {
+ ["path"]=>
+ string(3) "0.5"
+}
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 1 to be string, array given, %s(70)
+NULL
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+Arg value 1
+array(1) {
+ ["path"]=>
+ string(1) "1"
+}
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+Arg value 1
+array(1) {
+ ["path"]=>
+ string(1) "1"
+}
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(69)
+
+Arg value
+Error: 2 - parse_url() expects parameter 1 to be string, object given, %s(70)
+NULL
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+
+Arg value
+array(1) {
+ ["path"]=>
+ string(0) ""
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_variation_002_32bit.phpt b/ext/standard/tests/url/parse_url_variation_002_32bit.phpt
new file mode 100644
index 000000000..88971e964
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_variation_002_32bit.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Test parse_url() function : usage variations - unexpected type for arg 2.
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); ?>
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing parse_url() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
+
+//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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for url_component
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( parse_url($url, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 10.5
+Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71)
+bool(false)
+
+Arg value -10.5
+array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+Arg value 101234567000
+array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+Arg value 1.07654321E-9
+string(4) "http"
+
+Arg value 0.5
+string(4) "http"
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value
+string(4) "http"
+
+Arg value
+string(4) "http"
+
+Arg value 1
+string(11) "www.php.net"
+
+Arg value
+string(4) "http"
+
+Arg value 1
+string(11) "www.php.net"
+
+Arg value
+string(4) "http"
+
+Arg value
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+
+Arg value
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+
+Arg value string
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+
+Arg value string
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
+
+Arg value
+Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71)
+NULL
+
+Arg value
+string(4) "http"
+
+Arg value
+string(4) "http"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/parse_url_variation_002_64bit.phpt b/ext/standard/tests/url/parse_url_variation_002_64bit.phpt
new file mode 100644
index 000000000..561a43353
--- /dev/null
+++ b/ext/standard/tests/url/parse_url_variation_002_64bit.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test parse_url() function : usage variations - unexpected type for arg 2.
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
+--FILE--
+<?php
+/* Prototype : proto mixed parse_url(string url, [int url_component])
+ * Description: Parse a URL and return its components
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing parse_url() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
+
+//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.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for url_component
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( parse_url($url, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing parse_url() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 10.5
+Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71)
+bool(false)
+
+Arg value -10.5
+array(8) {
+ ["scheme"]=>
+ string(4) "http"
+ ["host"]=>
+ string(11) "www.php.net"
+ ["port"]=>
+ int(80)
+ ["user"]=>
+ string(6) "secret"
+ ["pass"]=>
+ string(7) "hideout"
+ ["path"]=>
+ string(10) "/index.php"
+ ["query"]=>
+ string(31) "test=1&test2=char&test3=mixesCI"
+ ["fragment"]=>
+ string(16) "some_page_ref123"
+}
+
+Arg value 101234567000
+Error: 2 - parse_url(): Invalid URL component identifier 101234567000, %s(71)
+bool(false)
+
+Arg value 1.07654321E-9
+string(4) "http"
+
+Arg value 0.5
+string(4) "http"
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value Array
+Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
+NULL
+
+Arg value
+string(4) "http"
+
+Arg value
+string(4) "http"
+
+Arg value 1
+string(11) "www.php.net"
+
+Arg value
+string(4) "http"
+
+Arg value 1
+string(11) "www.php.net"
+
+Arg value
+string(4) "http"
+
+Arg value
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+
+Arg value
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+
+Arg value string
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+
+Arg value string
+Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
+NULL
+Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
+
+Arg value
+Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71)
+NULL
+
+Arg value
+string(4) "http"
+
+Arg value
+string(4) "http"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/rawurldecode_error_001.phpt b/ext/standard/tests/url/rawurldecode_error_001.phpt
new file mode 100644
index 000000000..1dcaf40fd
--- /dev/null
+++ b/ext/standard/tests/url/rawurldecode_error_001.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test rawurldecode() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto string rawurldecode(string str)
+ * Description: Decodes URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing rawurldecode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing rawurldecode() function with Zero arguments --\n";
+var_dump( rawurldecode() );
+
+//Test rawurldecode with one more than the expected number of arguments
+echo "\n-- Testing rawurldecode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( rawurldecode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurldecode() : error conditions ***
+
+-- Testing rawurldecode() function with Zero arguments --
+
+Warning: rawurldecode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing rawurldecode() function with more than expected no. of arguments --
+
+Warning: rawurldecode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done
diff --git a/ext/standard/tests/url/rawurldecode_variation_001.phpt b/ext/standard/tests/url/rawurldecode_variation_001.phpt
new file mode 100644
index 000000000..4942e8b35
--- /dev/null
+++ b/ext/standard/tests/url/rawurldecode_variation_001.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test rawurldecode() function : usage variations - unexpected type for arg 1.
+--FILE--
+<?php
+/* Prototype : proto string rawurldecode(string str)
+ * Description: Decodes URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing rawurldecode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( rawurldecode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurldecode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 2 - rawurldecode() expects parameter 1 to be string, object given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/rawurlencode_error_001.phpt b/ext/standard/tests/url/rawurlencode_error_001.phpt
new file mode 100644
index 000000000..7acce9e0c
--- /dev/null
+++ b/ext/standard/tests/url/rawurlencode_error_001.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test rawurlencode() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string rawurlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing rawurlencode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing rawurlencode() function with Zero arguments --\n";
+var_dump( rawurlencode() );
+
+//Test rawurlencode with one more than the expected number of arguments
+echo "\n-- Testing rawurlencode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( rawurlencode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurlencode() : error conditions ***
+
+-- Testing rawurlencode() function with Zero arguments --
+
+Warning: rawurlencode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing rawurlencode() function with more than expected no. of arguments --
+
+Warning: rawurlencode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/rawurlencode_variation_001.phpt b/ext/standard/tests/url/rawurlencode_variation_001.phpt
new file mode 100644
index 000000000..d90825ba7
--- /dev/null
+++ b/ext/standard/tests/url/rawurlencode_variation_001.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test rawurlencode() function : usage variations - unexpected type for arg 1.
+--FILE--
+<?php
+/* Prototype : proto string rawurlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing rawurlencode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( rawurlencode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing rawurlencode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 2 - rawurlencode() expects parameter 1 to be string, object given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/urldecode_error_001.phpt b/ext/standard/tests/url/urldecode_error_001.phpt
new file mode 100644
index 000000000..f0e5ae083
--- /dev/null
+++ b/ext/standard/tests/url/urldecode_error_001.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test urldecode() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string urldecode(string str)
+ * Description: Decodes URL-encoded string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing urldecode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing urldecode() function with Zero arguments --\n";
+var_dump( urldecode() );
+
+//Test urldecode with one more than the expected number of arguments
+echo "\n-- Testing urldecode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( urldecode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urldecode() : error conditions ***
+
+-- Testing urldecode() function with Zero arguments --
+
+Warning: urldecode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing urldecode() function with more than expected no. of arguments --
+
+Warning: urldecode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/urldecode_variation_001.phpt b/ext/standard/tests/url/urldecode_variation_001.phpt
new file mode 100644
index 000000000..7ebc7bdbe
--- /dev/null
+++ b/ext/standard/tests/url/urldecode_variation_001.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test urldecode() function : usage variations - <type here specifics of this variation>
+--FILE--
+<?php
+/* Prototype : proto string urldecode(string str)
+ * Description: Decodes URL-encoded string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing urldecode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( urldecode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urldecode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 2 - urldecode() expects parameter 1 to be string, object given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/urlencode_error_001.phpt b/ext/standard/tests/url/urlencode_error_001.phpt
new file mode 100644
index 000000000..fc00b057d
--- /dev/null
+++ b/ext/standard/tests/url/urlencode_error_001.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test urlencode() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string urlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+echo "*** Testing urlencode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing urlencode() function with Zero arguments --\n";
+var_dump( urlencode() );
+
+//Test urlencode with one more than the expected number of arguments
+echo "\n-- Testing urlencode() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( urlencode($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urlencode() : error conditions ***
+
+-- Testing urlencode() function with Zero arguments --
+
+Warning: urlencode() expects exactly 1 parameter, 0 given in %s on line 14
+NULL
+
+-- Testing urlencode() function with more than expected no. of arguments --
+
+Warning: urlencode() expects exactly 1 parameter, 2 given in %s on line 20
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/urlencode_variation_001.phpt b/ext/standard/tests/url/urlencode_variation_001.phpt
new file mode 100644
index 000000000..1f82b65f3
--- /dev/null
+++ b/ext/standard/tests/url/urlencode_variation_001.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test urlencode() function : usage variations - <type here specifics of this variation>
+--FILE--
+<?php
+/* Prototype : proto string urlencode(string str)
+ * Description: URL-encodes string
+ * Source code: ext/standard/url.c
+ * Alias to functions:
+ */
+
+// NB: basic functionality tested in tests/strings/001.phpt
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing urlencode() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( urlencode($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing urlencode() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+string(1) "0"
+
+Arg value 1
+string(1) "1"
+
+Arg value 12345
+string(5) "12345"
+
+Arg value -2345
+string(5) "-2345"
+
+Arg value 10.5
+string(4) "10.5"
+
+Arg value -10.5
+string(5) "-10.5"
+
+Arg value 101234567000
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+string(13) "1.07654321E-9"
+
+Arg value 0.5
+string(3) "0.5"
+
+Arg value Array
+Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value Array
+Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value 1
+string(1) "1"
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 2 - urlencode() expects parameter 1 to be string, object given, %s(74)
+NULL
+
+Arg value
+string(0) ""
+
+Arg value
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/url/urls.inc b/ext/standard/tests/url/urls.inc
new file mode 100644
index 000000000..27521c852
--- /dev/null
+++ b/ext/standard/tests/url/urls.inc
@@ -0,0 +1,109 @@
+<?php
+$urls = array(
+// Parsable URLs:
+'64.246.30.37',
+'http://64.246.30.37',
+'http://64.246.30.37/',
+'64.246.30.37/',
+'64.246.30.37:80/',
+'php.net',
+'php.net/',
+'http://php.net',
+'http://php.net/',
+'www.php.net',
+'www.php.net/',
+'http://www.php.net',
+'http://www.php.net/',
+'www.php.net:80',
+'http://www.php.net:80',
+'http://www.php.net:80/',
+'http://www.php.net/index.php',
+'www.php.net/?',
+'www.php.net:80/?',
+'http://www.php.net/?',
+'http://www.php.net:80/?',
+'http://www.php.net:80/index.php',
+'http://www.php.net:80/foo/bar/index.php',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2&parameters=3&too=4&here=5',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/',
+'http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php',
+'http://www.php.net:80/this/../a/../deep/directory',
+'http://www.php.net:80/this/../a/../deep/directory/',
+'http://www.php.net:80/this/is/a/very/deep/directory/../file.php',
+'http://www.php.net:80/index.php',
+'http://www.php.net:80/index.php?',
+'http://www.php.net:80/#foo',
+'http://www.php.net:80/?#',
+'http://www.php.net:80/?test=1',
+'http://www.php.net/?test=1&',
+'http://www.php.net:80/?&',
+'http://www.php.net:80/index.php?test=1&',
+'http://www.php.net/index.php?&',
+'http://www.php.net:80/index.php?foo&',
+'http://www.php.net/index.php?&foo',
+'http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI',
+'www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123',
+'nntp://news.php.net',
+'ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz',
+'zlib:http://foo@bar',
+'zlib:filename.txt',
+'zlib:/path/to/my/file/file.txt',
+'foo://foo@bar',
+'mailto:me@mydomain.com',
+'/foo.php?a=b&c=d',
+'foo.php?a=b&c=d',
+'http://user:passwd@www.example.com:8080?bar=1&boom=0',
+'file:///path/to/file',
+'file://path/to/file',
+'file:/path/to/file',
+'http://1.2.3.4:/abc.asp?a=1&b=2',
+'http://foo.com#bar',
+'scheme:',
+'foo+bar://baz@bang/bla',
+'gg:9130731',
+'http://user:@pass@host/path?argument?value#etc',
+'http://10.10.10.10/:80',
+'http://x:?',
+'x:blah.com',
+'x:/blah.com',
+'x://::abc/?',
+'http://::?',
+'x://::6.5',
+'http://?:/',
+'http://@?:/',
+'file:///:',
+'file:///a:/',
+'file:///ab:/',
+'file:///a:/',
+'file:///@:/',
+'file:///:80/',
+'[]',
+'http://[x:80]/',
+'',
+'/',
+
+// Severely malformed URLs that do not parse:
+'http:///blah.com',
+'http://:80',
+'http://user@:80',
+'http://user:pass@:80',
+'http://:',
+'http://@/',
+'http://@:/',
+'http://:/',
+'http://?',
+'http://?:',
+'http://:?',
+'http://blah.com:123456',
+'http://blah.com:abcdef',
+);
+
+
+?> \ No newline at end of file
diff --git a/ext/standard/type.c b/ext/standard/type.c
index 536f0a673..9ee4fd18b 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: type.c,v 1.30.2.2.2.3 2007/02/24 02:17:27 helly Exp $ */
+/* $Id: type.c,v 1.30.2.2.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
#include "php_incomplete_class.h"
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
index ff5b9b2c9..2e72ba3d5 100644
--- a/ext/standard/uniqid.c
+++ b/ext/standard/uniqid.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: uniqid.c,v 1.41.2.2.2.3 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: uniqid.c,v 1.41.2.2.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h
index c2ed14fcf..bbba9a1b0 100644
--- a/ext/standard/uniqid.h
+++ b/ext/standard/uniqid.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: uniqid.h,v 1.13.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: uniqid.h,v 1.13.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef UNIQID_H
#define UNIQID_H
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 13a6aa592..ae95a785f 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: url.c,v 1.86.2.5.2.8 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: url.c,v 1.86.2.5.2.9 2007/12/31 07:20:13 sebastian Exp $ */
#include <stdlib.h>
#include <string.h>
diff --git a/ext/standard/url.h b/ext/standard/url.h
index 7e52d68d8..4bb00f7c7 100644
--- a/ext/standard/url.h
+++ b/ext/standard/url.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: url.h,v 1.20.2.2.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: url.h,v 1.20.2.2.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef URL_H
#define URL_H
diff --git a/ext/standard/url_scanner.c b/ext/standard/url_scanner.c
index 0b402c45d..da712b5ae 100644
--- a/ext/standard/url_scanner.c
+++ b/ext/standard/url_scanner.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner.c,v 1.44.2.1.2.3 2007/02/22 00:44:08 iliaa Exp $ */
+/* $Id: url_scanner.c,v 1.44.2.1.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
diff --git a/ext/standard/url_scanner.h b/ext/standard/url_scanner.h
index 86cca80e6..fc7baa01a 100644
--- a/ext/standard/url_scanner.h
+++ b/ext/standard/url_scanner.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -15,7 +15,7 @@
| Author: Sascha Schumann <sascha@schumann.cx> |
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner.h,v 1.16.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: url_scanner.h,v 1.16.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef URI_SCANNER_H
#define URI_SCANNER_H
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index a32429531..9edf4c2f9 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.c,v 1.95.2.4.2.5 2007/10/10 09:28:51 jani Exp $ */
+/* $Id: url_scanner_ex.c,v 1.95.2.4.2.6 2008/03/12 11:27:42 felipe Exp $ */
#include "php.h"
@@ -951,7 +951,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
size_t len;
if (BG(url_adapt_state_ex).url_app.len != 0) {
- *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0) TSRMLS_CC);
+ *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT) ? 1 : 0) TSRMLS_CC);
if (sizeof(uint) < sizeof(size_t)) {
if (len > UINT_MAX)
len = UINT_MAX;
diff --git a/ext/standard/url_scanner_ex.c.orig b/ext/standard/url_scanner_ex.c.orig
index f6e388fb2..4d337d74f 100644
--- a/ext/standard/url_scanner_ex.c.orig
+++ b/ext/standard/url_scanner_ex.c.orig
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.c,v 1.95.2.4.2.5 2007/10/10 09:28:51 jani Exp $ */
+/* $Id: url_scanner_ex.c,v 1.95.2.4.2.6 2008/03/12 11:27:42 felipe Exp $ */
#include "php.h"
@@ -1007,7 +1007,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
size_t len;
if (BG(url_adapt_state_ex).url_app.len != 0) {
- *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0) TSRMLS_CC);
+ *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT) ? 1 : 0) TSRMLS_CC);
if (sizeof(uint) < sizeof(size_t)) {
if (len > UINT_MAX)
len = UINT_MAX;
diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h
index 020c04078..9f17558e3 100644
--- a/ext/standard/url_scanner_ex.h
+++ b/ext/standard/url_scanner_ex.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.h,v 1.26.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: url_scanner_ex.h,v 1.26.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef URL_SCANNER_EX_H
#define URL_SCANNER_EX_H
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index a1bfdc027..3dc635501 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.2 2007/10/10 00:35:52 iliaa Exp $ */
+/* $Id: url_scanner_ex.re,v 1.76.2.2.2.3 2008/03/12 19:33:46 felipe Exp $ */
#include "php.h"
@@ -431,7 +431,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
size_t len;
if (BG(url_adapt_state_ex).url_app.len != 0) {
- *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0) TSRMLS_CC);
+ *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT) ? 1 : 0) TSRMLS_CC);
if (sizeof(uint) < sizeof(size_t)) {
if (len > UINT_MAX)
len = UINT_MAX;
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index 3397f2f23..70e479450 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: user_filters.c,v 1.31.2.4.2.9 2007/08/04 07:53:00 pollita Exp $ */
+/* $Id: user_filters.c,v 1.31.2.4.2.10 2007/12/31 07:20:13 sebastian Exp $ */
#include "php.h"
#include "php_globals.h"
diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c
index 0290c1329..c0df1e0d9 100644
--- a/ext/standard/uuencode.c
+++ b/ext/standard/uuencode.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: uuencode.c,v 1.5.2.1.2.5 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: uuencode.c,v 1.5.2.1.2.6 2007/12/31 07:20:13 sebastian Exp $ */
/*
* Portions of this code are based on Berkeley's uuencode/uudecode
diff --git a/ext/standard/var.c b/ext/standard/var.c
index d250957b9..efbc887f6 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.203.2.7.2.19 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: var.c,v 1.203.2.7.2.22 2007/12/31 07:20:13 sebastian Exp $ */
@@ -355,13 +355,15 @@ static int php_array_element_export(zval **zv, int num_args, va_list args, zend_
if (hash_key->nKeyLength==0) { /* numeric key */
php_printf("%*c%ld => ", level + 1, ' ', hash_key->h);
} else { /* string key */
- char *key;
- int key_len;
+ char *key, *tmp_str;
+ int key_len, tmp_len;
key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC);
+ tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL);
php_printf("%*c'", level + 1, ' ');
- PHPWRITE(key, key_len);
+ PHPWRITE(tmp_str, tmp_len);
php_printf("' => ");
efree(key);
+ efree(tmp_str);
}
php_var_export(zv, level + 2 TSRMLS_CC);
PUTS (",\n");
@@ -389,8 +391,8 @@ static int php_object_element_export(zval **zv, int num_args, va_list args, zend
PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC)
{
HashTable *myht;
- char* tmp_str;
- int tmp_len;
+ char *tmp_str, *tmp_str2;
+ int tmp_len, tmp_len2;
char *class_name;
zend_uint class_name_len;
@@ -408,11 +410,13 @@ PHPAPI void php_var_export(zval **struc, int level TSRMLS_DC)
php_printf("%.*H", (int) EG(precision), Z_DVAL_PP(struc));
break;
case IS_STRING:
- tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\\0", 3 TSRMLS_CC);
+ tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC);
+ tmp_str2 = php_str_to_str_ex(tmp_str, tmp_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len2, 0, NULL);
PUTS ("'");
- PHPWRITE(tmp_str, tmp_len);
+ PHPWRITE(tmp_str2, tmp_len2);
PUTS ("'");
- efree (tmp_str);
+ efree(tmp_str2);
+ efree(tmp_str);
break;
case IS_ARRAY:
myht = Z_ARRVAL_PP(struc);
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index f044da455..89181b8ce 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var_unserializer.c,v 1.70.2.4.2.7 2007/08/06 18:33:29 jani Exp $ */
+/* $Id: var_unserializer.c,v 1.70.2.4.2.8 2008/03/19 03:00:40 felipe Exp $ */
#include "php.h"
#include "ext/standard/php_var.h"
@@ -288,10 +288,10 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
break;
case IS_STRING:
- if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+ if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
var_push_dtor(var_hash, old_data);
}
- zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
+ zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
break;
}
diff --git a/ext/standard/var_unserializer.c.orig b/ext/standard/var_unserializer.c.orig
index e3e6c25af..3d4fcb77d 100644
--- a/ext/standard/var_unserializer.c.orig
+++ b/ext/standard/var_unserializer.c.orig
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var_unserializer.c,v 1.70.2.4.2.7 2007/08/06 18:33:29 jani Exp $ */
+/* $Id: var_unserializer.c,v 1.70.2.4.2.8 2008/03/19 03:00:40 felipe Exp $ */
#include "php.h"
#include "ext/standard/php_var.h"
@@ -290,10 +290,10 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
break;
case IS_STRING:
- if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+ if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
var_push_dtor(var_hash, old_data);
}
- zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
+ zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
break;
}
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 97fd3be89..ea8ce20d3 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var_unserializer.re,v 1.52.2.2.2.6 2007/08/06 18:23:16 jani Exp $ */
+/* $Id: var_unserializer.re,v 1.52.2.2.2.7 2008/03/19 03:00:40 felipe Exp $ */
#include "php.h"
#include "ext/standard/php_var.h"
@@ -294,10 +294,10 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long
zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);
break;
case IS_STRING:
- if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+ if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
var_push_dtor(var_hash, old_data);
}
- zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
+ zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
break;
}
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
index 7764b0230..7775e0249 100644
--- a/ext/standard/versioning.c
+++ b/ext/standard/versioning.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: versioning.c,v 1.19.2.1.2.3 2007/08/23 18:38:42 derick Exp $ */
+/* $Id: versioning.c,v 1.19.2.1.2.4 2007/12/31 07:20:13 sebastian Exp $ */
#include <stdio.h>
#include <sys/types.h>
diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c
index 56aa0499d..83711dd24 100644
--- a/ext/sybase/php_sybase_db.c
+++ b/ext/sybase/php_sybase_db.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_db.c,v 1.66.2.5.2.8 2007/08/31 07:42:00 jani Exp $ */
+/* $Id: php_sybase_db.c,v 1.66.2.5.2.9 2007/12/31 07:20:13 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
diff --git a/ext/sybase/php_sybase_db.h b/ext/sybase/php_sybase_db.h
index 37bf1ec0a..f7ba114ce 100644
--- a/ext/sybase/php_sybase_db.h
+++ b/ext/sybase/php_sybase_db.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_db.h,v 1.12.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_sybase_db.h,v 1.12.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_SYBASE_DB_H
#define PHP_SYBASE_DB_H
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
index 4479336a9..820170db7 100644
--- a/ext/sybase_ct/php_sybase_ct.c
+++ b/ext/sybase_ct/php_sybase_ct.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_ct.c,v 1.103.2.5.2.13 2007/04/10 15:56:31 helly Exp $ */
+/* $Id: php_sybase_ct.c,v 1.103.2.5.2.14 2007/12/31 07:20:13 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
diff --git a/ext/sybase_ct/php_sybase_ct.h b/ext/sybase_ct/php_sybase_ct.h
index 9bebb2077..8260ce5fc 100644
--- a/ext/sybase_ct/php_sybase_ct.h
+++ b/ext/sybase_ct/php_sybase_ct.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_ct.h,v 1.19.2.2.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_sybase_ct.h,v 1.19.2.2.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_SYBASE_CT_H
#define PHP_SYBASE_CT_H
diff --git a/ext/sysvmsg/php_sysvmsg.h b/ext/sysvmsg/php_sysvmsg.h
index e20f08879..251a008d2 100644
--- a/ext/sysvmsg/php_sysvmsg.h
+++ b/ext/sysvmsg/php_sysvmsg.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sysvmsg.h,v 1.6.2.1.2.2 2007/01/08 22:34:07 nlopess Exp $ */
+/* $Id: php_sysvmsg.h,v 1.6.2.1.2.3 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_SYSVMSG_H
#define PHP_SYSVMSG_H
diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
index 356c11893..556d8d958 100644
--- a/ext/sysvmsg/sysvmsg.c
+++ b/ext/sysvmsg/sysvmsg.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sysvmsg.c,v 1.20.2.3.2.6 2007/01/17 08:25:32 tony2001 Exp $ */
+/* $Id: sysvmsg.c,v 1.20.2.3.2.7 2007/12/31 07:20:13 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -125,7 +125,7 @@ PHP_MINFO_FUNCTION(sysvmsg)
{
php_info_print_table_start();
php_info_print_table_row(2, "sysvmsg support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.20.2.3.2.6 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.20.2.3.2.7 $");
php_info_print_table_end();
}
/* }}} */
diff --git a/ext/sysvsem/php_sysvsem.h b/ext/sysvsem/php_sysvsem.h
index 2374d9cd6..c4dc752db 100644
--- a/ext/sysvsem/php_sysvsem.h
+++ b/ext/sysvsem/php_sysvsem.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sysvsem.h,v 1.16.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_sysvsem.h,v 1.16.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_SYSVSEM_H
#define PHP_SYSVSEM_H
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index d9a96529e..aa0c9d7a6 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sysvsem.c,v 1.51.2.3.2.2 2007/05/11 15:46:38 tony2001 Exp $ */
+/* $Id: sysvsem.c,v 1.51.2.3.2.3 2007/12/31 07:20:13 sebastian Exp $ */
/* Latest update build anc tested on Linux 2.2.14
*
diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h
index 9a3d39f1a..a15755da7 100644
--- a/ext/sysvshm/php_sysvshm.h
+++ b/ext/sysvshm/php_sysvshm.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sysvshm.h,v 1.17.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_sysvshm.h,v 1.17.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
#ifndef PHP_SYSVSHM_H
#define PHP_SYSVSHM_H
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index d6c0128c3..b38fd4e52 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sysvshm.c,v 1.70.2.2.2.5 2007/08/31 07:42:00 jani Exp $ */
+/* $Id: sysvshm.c,v 1.70.2.2.2.6 2007/12/31 07:20:14 sebastian Exp $ */
/* This has been built and tested on Linux 2.2.14
*
diff --git a/ext/tidy/php_tidy.h b/ext/tidy/php_tidy.h
index bfa1ef1db..7d2bcb19e 100644
--- a/ext/tidy/php_tidy.h
+++ b/ext/tidy/php_tidy.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_tidy.h,v 1.26.2.1.2.5 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_tidy.h,v 1.26.2.1.2.6 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_TIDY_H
#define PHP_TIDY_H
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 303457983..ede59f0c6 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tidy.c,v 1.66.2.8.2.24 2007/09/20 22:25:05 nlopess Exp $ */
+/* $Id: tidy.c,v 1.66.2.8.2.25 2007/12/31 07:20:14 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -998,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.24 2007/09/20 22:25:05 nlopess Exp $)");
+ php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.8.2.25 2007/12/31 07:20:14 sebastian Exp $)");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
diff --git a/ext/tokenizer/php_tokenizer.h b/ext/tokenizer/php_tokenizer.h
index 46cc52706..9e19a7a87 100644
--- a/ext/tokenizer/php_tokenizer.h
+++ b/ext/tokenizer/php_tokenizer.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_tokenizer.h,v 1.9.2.1.2.4 2007/07/31 23:24:11 johannes Exp $ */
+/* $Id: php_tokenizer.h,v 1.9.2.1.2.5 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_TOKENIZER_H
#define PHP_TOKENIZER_H
diff --git a/ext/tokenizer/tests/token_get_all_basic.phpt b/ext/tokenizer/tests/token_get_all_basic.phpt
new file mode 100644
index 000000000..0ae84a2a7
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_basic.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test token_get_all() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description : splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+echo "*** Testing token_get_all() : basic functionality ***\n";
+
+// with php open/close tags
+$source = '<?php echo "Hello World"; ?>';
+echo "-- source string with PHP open and close tags --\n";
+var_dump( token_get_all($source) );
+
+// without php open/close tags testing for T_INLINE_HTML
+$source = "echo 'Hello World';";
+echo "-- source string without PHP open and close tags --\n";
+var_dump( token_get_all($source) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : basic functionality ***
+-- source string with PHP open and close tags --
+array(7) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(13) ""Hello World""
+ [2]=>
+ int(1)
+ }
+ [4]=>
+ string(1) ";"
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- source string without PHP open and close tags --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(19) "echo 'Hello World';"
+ [2]=>
+ int(1)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_error.phpt b/ext/tokenizer/tests/token_get_all_error.phpt
new file mode 100644
index 000000000..52b1efc1d
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test token_get_all() function : error conditions
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+echo "*** Testing token_get_all() : error conditions ***\n";
+
+// with zero arguments
+echo "\n-- Testing token_get_all() function with zero arguments --\n";
+var_dump( token_get_all());
+
+// with one more than the expected number of arguments
+echo "-- Testing token_get_all() function with more than expected no. of arguments --\n";
+$source = '<?php ?>';
+$extra_arg = 10;
+var_dump( token_get_all($source, $extra_arg));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : error conditions ***
+
+-- Testing token_get_all() function with zero arguments --
+
+Warning: token_get_all() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+-- Testing token_get_all() function with more than expected no. of arguments --
+
+Warning: token_get_all() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation1.phpt b/ext/tokenizer/tests/token_get_all_variation1.phpt
new file mode 100644
index 000000000..f0e10d6d5
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation1.phpt
@@ -0,0 +1,285 @@
+--TEST--
+Test token_get_all() function : usage variations - unexpected values for 'source' argument
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing different scalar/non-scalar values in place of 'source' argument
+ * It returns either T_INLINE_HTML by converting values into string or gives warning
+*/
+
+echo "*** Testing token_get_all() : unexpected values for 'source' argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// class definition
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+// get resource
+$fp = fopen(__FILE__, 'r');
+
+// different scalar/nonscalar values for 'source'
+$source_values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.1234567e8,
+ 10.7654321E-8,
+ .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 string
+/*21*/ "",
+ '',
+
+ // object data
+/*23*/ new MyClass(),
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+);
+
+for($count = 0; $count < count($source_values); $count++) {
+ echo "--Iteration ".($count + 1)." --\n";
+ var_dump( token_get_all($source_values[$count]));
+};
+
+fclose($fp);
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : unexpected values for 'source' argument ***
+--Iteration 1 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(1) "0"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 2 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 3 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(5) "12345"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 4 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(5) "-2345"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 5 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(4) "10.5"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 6 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(5) "-10.5"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 7 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(10) "1012345670"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 8 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(13) "1.07654321E-7"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 9 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(3) "0.5"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 10 --
+
+Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
+NULL
+--Iteration 11 --
+
+Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
+NULL
+--Iteration 12 --
+
+Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
+NULL
+--Iteration 13 --
+
+Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
+NULL
+--Iteration 14 --
+
+Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
+NULL
+--Iteration 15 --
+array(0) {
+}
+--Iteration 16 --
+array(0) {
+}
+--Iteration 17 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 18 --
+array(0) {
+}
+--Iteration 19 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 20 --
+array(0) {
+}
+--Iteration 21 --
+array(0) {
+}
+--Iteration 22 --
+array(0) {
+}
+--Iteration 23 --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(6) "object"
+ [2]=>
+ int(1)
+ }
+}
+--Iteration 24 --
+
+Warning: token_get_all() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+--Iteration 25 --
+array(0) {
+}
+--Iteration 26 --
+array(0) {
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation10.phpt b/ext/tokenizer/tests/token_get_all_variation10.phpt
new file mode 100644
index 000000000..63b61e731
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation10.phpt
@@ -0,0 +1,781 @@
+--TEST--
+Test token_get_all() function : usage variations - with constant tokens
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Using different types of constants in 'source' string to check them for token
+ * integer const - T_LNUMBER(305)
+ * float/double/real const - T_DNUMBER(306)
+ * string cosnt - T_CONSTANT_ESCAPED_STRING(315)
+ * bool const (no tokens specified) - T_UNKNOWN(307)
+ * null const (no tokens specified) - T_UNKNOWN(307)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different constants ***\n";
+
+$a = 1;
+$b = 0;
+
+$source = array (
+ // int const
+ '<?php $a = 1 + 034; $b = $a + 0x3F; ?>',
+
+ // float const
+ '<?php $a = 0.23E-2 + 0.43e2 + 0.5; ?>',
+
+ // string const
+ '<?php $a = "hello ".\'world\'; ?>',
+
+ // bool const
+ "<?php \$a = (\$b)? true : false; ?>",
+ "<?php \$b = (\$a)? FALSE : TRUE; ?>",
+
+ // null const
+ '<?php $b = null | NULL; ?>'
+);
+for($count = 0; $count < count($source); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( token_get_all($source[$count]));
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different constants ***
+-- Iteration 1 --
+array(24) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) "+"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(3) "034"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [14]=>
+ string(1) "="
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [18]=>
+ string(1) "+"
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(4) "0x3F"
+ [2]=>
+ int(1)
+ }
+ [21]=>
+ string(1) ";"
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 2 --
+array(17) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(306)
+ [1]=>
+ string(7) "0.23E-2"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) "+"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(306)
+ [1]=>
+ string(6) "0.43e2"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [11]=>
+ string(1) "+"
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(306)
+ [1]=>
+ string(3) "0.5"
+ [2]=>
+ int(1)
+ }
+ [14]=>
+ string(1) ";"
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 3 --
+array(11) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(8) ""hello ""
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ string(1) "."
+ [7]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(7) "'world'"
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ string(1) ";"
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 4 --
+array(18) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ string(1) "("
+ [6]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) ")"
+ [8]=>
+ string(1) "?"
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(4) "true"
+ [2]=>
+ int(1)
+ }
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ string(1) ":"
+ [13]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "false"
+ [2]=>
+ int(1)
+ }
+ [15]=>
+ string(1) ";"
+ [16]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 5 --
+array(18) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ string(1) "("
+ [6]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) ")"
+ [8]=>
+ string(1) "?"
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "FALSE"
+ [2]=>
+ int(1)
+ }
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ string(1) ":"
+ [13]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(4) "TRUE"
+ [2]=>
+ int(1)
+ }
+ [15]=>
+ string(1) ";"
+ [16]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 6 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(4) "null"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) "|"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(4) "NULL"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation11.phpt b/ext/tokenizer/tests/token_get_all_variation11.phpt
new file mode 100644
index 000000000..c38b050cb
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation11.phpt
@@ -0,0 +1,1147 @@
+--TEST--
+Test token_get_all() function : usage variations - with control structure tokens
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Using different control structure keywords
+ * if..else, elseif - T_IF(301), T_ELSEIF(302), T_ELSE(303)
+ * while - T_WHILE(318)
+ * do...while - T_DO(317)
+ * for - T_ENDFOR(320)
+ * foreach - T_ENDFOREACH(322)
+ * switch...case - T_ENDSWITCH(327), T_CASE(329)
+ * break - T_BREAK(331)
+ * continue - T_CONTINUE(332)
+*/
+
+echo "*** Testing token_get_all() : for control structure tokens ***\n";
+
+// if..elseif....else
+echo "-- with if..elseif..else..tokens --\n";
+
+$source = '<?php
+if($a == true) {
+ echo "$a = true";
+}
+elseif($a == false) {
+ echo false;
+}
+else
+ echo 1;
+?>';
+
+var_dump( token_get_all($source));
+
+// while..., do..while, break, continue
+echo "-- with while..., do..while, switch & continue tokens --\n";
+
+$source = "<?php while(true) {
+echo 'True';
+break;
+}
+do {
+continue;
+}while(false); ?>";
+
+var_dump( token_get_all($source));
+
+// for..., foreach( as )
+echo "-- with for..foreach( as ) tokens --\n";
+
+$source = '<?php for($count=0; $count < 5; $count++) {
+echo $count;
+}
+foreach($values as $index) {
+continue;
+} ?>';
+
+var_dump( token_get_all($source));
+
+// switch..case, default
+echo "-- with switch...case tokens --\n";
+
+$source = '<?php switch($var)
+case 1: break;
+default: echo "default"; ?>';
+
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : for control structure tokens ***
+-- with if..elseif..else..tokens --
+array(49) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ string(1) "("
+ [4]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(283)
+ [1]=>
+ string(2) "=="
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(4) "true"
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ string(1) ")"
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ string(1) "{"
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(6) "
+ "
+ [2]=>
+ int(2)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(3)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [15]=>
+ string(1) """
+ [16]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(3)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(314)
+ [1]=>
+ string(7) " = true"
+ [2]=>
+ int(3)
+ }
+ [18]=>
+ string(1) """
+ [19]=>
+ string(1) ";"
+ [20]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [21]=>
+ string(1) "}"
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(302)
+ [1]=>
+ string(6) "elseif"
+ [2]=>
+ int(5)
+ }
+ [24]=>
+ string(1) "("
+ [25]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(5)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(283)
+ [1]=>
+ string(2) "=="
+ [2]=>
+ int(5)
+ }
+ [28]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [29]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "false"
+ [2]=>
+ int(5)
+ }
+ [30]=>
+ string(1) ")"
+ [31]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [32]=>
+ string(1) "{"
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(5)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(6)
+ }
+ [35]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [36]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "false"
+ [2]=>
+ int(6)
+ }
+ [37]=>
+ string(1) ";"
+ [38]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [39]=>
+ string(1) "}"
+ [40]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(7)
+ }
+ [41]=>
+ array(3) {
+ [0]=>
+ int(303)
+ [1]=>
+ string(4) "else"
+ [2]=>
+ int(8)
+ }
+ [42]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(8)
+ }
+ [43]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(9)
+ }
+ [44]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [45]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(9)
+ }
+ [46]=>
+ string(1) ";"
+ [47]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(9)
+ }
+ [48]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(10)
+ }
+}
+-- with while..., do..while, switch & continue tokens --
+array(33) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(318)
+ [1]=>
+ string(5) "while"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ string(1) "("
+ [3]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(4) "true"
+ [2]=>
+ int(1)
+ }
+ [4]=>
+ string(1) ")"
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ string(1) "{"
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(6) "'True'"
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ string(1) ";"
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(331)
+ [1]=>
+ string(5) "break"
+ [2]=>
+ int(3)
+ }
+ [14]=>
+ string(1) ";"
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [16]=>
+ string(1) "}"
+ [17]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [18]=>
+ array(3) {
+ [0]=>
+ int(317)
+ [1]=>
+ string(2) "do"
+ [2]=>
+ int(5)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [20]=>
+ string(1) "{"
+ [21]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(332)
+ [1]=>
+ string(8) "continue"
+ [2]=>
+ int(6)
+ }
+ [23]=>
+ string(1) ";"
+ [24]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [25]=>
+ string(1) "}"
+ [26]=>
+ array(3) {
+ [0]=>
+ int(318)
+ [1]=>
+ string(5) "while"
+ [2]=>
+ int(7)
+ }
+ [27]=>
+ string(1) "("
+ [28]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "false"
+ [2]=>
+ int(7)
+ }
+ [29]=>
+ string(1) ")"
+ [30]=>
+ string(1) ";"
+ [31]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [32]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(7)
+ }
+}
+-- with for..foreach( as ) tokens --
+array(45) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(320)
+ [1]=>
+ string(3) "for"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ string(1) "("
+ [3]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(6) "$count"
+ [2]=>
+ int(1)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "0"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ string(1) ";"
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(6) "$count"
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) "<"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "5"
+ [2]=>
+ int(1)
+ }
+ [13]=>
+ string(1) ";"
+ [14]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [15]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(6) "$count"
+ [2]=>
+ int(1)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(297)
+ [1]=>
+ string(2) "++"
+ [2]=>
+ int(1)
+ }
+ [17]=>
+ string(1) ")"
+ [18]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [19]=>
+ string(1) "{"
+ [20]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(2)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(6) "$count"
+ [2]=>
+ int(2)
+ }
+ [24]=>
+ string(1) ";"
+ [25]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [26]=>
+ string(1) "}"
+ [27]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [28]=>
+ array(3) {
+ [0]=>
+ int(322)
+ [1]=>
+ string(7) "foreach"
+ [2]=>
+ int(4)
+ }
+ [29]=>
+ string(1) "("
+ [30]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(7) "$values"
+ [2]=>
+ int(4)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [32]=>
+ array(3) {
+ [0]=>
+ int(326)
+ [1]=>
+ string(2) "as"
+ [2]=>
+ int(4)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(6) "$index"
+ [2]=>
+ int(4)
+ }
+ [35]=>
+ string(1) ")"
+ [36]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [37]=>
+ string(1) "{"
+ [38]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [39]=>
+ array(3) {
+ [0]=>
+ int(332)
+ [1]=>
+ string(8) "continue"
+ [2]=>
+ int(5)
+ }
+ [40]=>
+ string(1) ";"
+ [41]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [42]=>
+ string(1) "}"
+ [43]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [44]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(6)
+ }
+}
+-- with switch...case tokens --
+array(23) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(327)
+ [1]=>
+ string(6) "switch"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ string(1) "("
+ [3]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(4) "$var"
+ [2]=>
+ int(1)
+ }
+ [4]=>
+ string(1) ")"
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(329)
+ [1]=>
+ string(4) "case"
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ string(1) ":"
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ array(3) {
+ [0]=>
+ int(331)
+ [1]=>
+ string(5) "break"
+ [2]=>
+ int(2)
+ }
+ [12]=>
+ string(1) ";"
+ [13]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(330)
+ [1]=>
+ string(7) "default"
+ [2]=>
+ int(3)
+ }
+ [15]=>
+ string(1) ":"
+ [16]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(3)
+ }
+ [18]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(9) ""default""
+ [2]=>
+ int(3)
+ }
+ [20]=>
+ string(1) ";"
+ [21]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation12.phpt b/ext/tokenizer/tests/token_get_all_variation12.phpt
new file mode 100644
index 000000000..8394cb626
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation12.phpt
@@ -0,0 +1,532 @@
+--TEST--
+Test token_get_all() function : usage variations - with predefined language constants
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Testing token_get_all() with following predefined language constants:
+ * __FILE__ - T_FILE(364)
+ * __CLASS__ - T_CLASS_C(360)
+ * __FUNCTION__ - T_FUNC_C(362)
+ * __LINE__ - T_LINE(363)
+ * __METHOD__ - T_METHOD_C(361)
+*/
+
+echo "*** Testing token_get_all() : with language constants ***\n";
+
+// parsing __FILE__ token
+echo "-- with FILE --\n";
+$source = "<?php
+\$fp = fopen(__FILE__, 'r');
+?>";
+var_dump( token_get_all($source));
+
+// parsing __CLASS__ and __FUNCTION__ tokens
+echo "-- with CLASS and FUNCTION --\n";
+$source = '<?php
+class MyClass
+{
+ echo __CLASS__;
+ function myFunction()
+ { echo __FUNCTION__; }
+}
+?>';
+var_dump( token_get_all($source));
+
+// parsing __LINE__ and __METHOD__ tokens
+echo "-- with LINE and METHOD --\n";
+$source = '<?php
+ $a = __LINE__;
+ $b = $b.__METHOD__;
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : with language constants ***
+-- with FILE --
+array(16) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(3) "$fp"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "fopen"
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ string(1) "("
+ [8]=>
+ array(3) {
+ [0]=>
+ int(364)
+ [1]=>
+ string(8) "__FILE__"
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ string(1) ","
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(3) "'r'"
+ [2]=>
+ int(2)
+ }
+ [12]=>
+ string(1) ")"
+ [13]=>
+ string(1) ";"
+ [14]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [15]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(3)
+ }
+}
+-- with CLASS and FUNCTION --
+array(30) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(352)
+ [1]=>
+ string(5) "class"
+ [2]=>
+ int(2)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "MyClass"
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [5]=>
+ string(1) "{"
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(3)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(4)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) " "
+ [2]=>
+ int(4)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(360)
+ [1]=>
+ string(9) "__CLASS__"
+ [2]=>
+ int(4)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(4)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(333)
+ [1]=>
+ string(8) "function"
+ [2]=>
+ int(5)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "myFunction"
+ [2]=>
+ int(5)
+ }
+ [15]=>
+ string(1) "("
+ [16]=>
+ string(1) ")"
+ [17]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(5)
+ }
+ [18]=>
+ string(1) "{"
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) " "
+ [2]=>
+ int(6)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(6)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) " "
+ [2]=>
+ int(6)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(362)
+ [1]=>
+ string(12) "__FUNCTION__"
+ [2]=>
+ int(6)
+ }
+ [23]=>
+ string(1) ";"
+ [24]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [25]=>
+ string(1) "}"
+ [26]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [27]=>
+ string(1) "}"
+ [28]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(7)
+ }
+ [29]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(8)
+ }
+}
+-- with LINE and METHOD --
+array(19) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) " "
+ [2]=>
+ int(2)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(363)
+ [1]=>
+ string(8) "__LINE__"
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ string(1) ";"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(3)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [11]=>
+ string(1) "="
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(3)
+ }
+ [14]=>
+ string(1) "."
+ [15]=>
+ array(3) {
+ [0]=>
+ int(361)
+ [1]=>
+ string(10) "__METHOD__"
+ [2]=>
+ int(3)
+ }
+ [16]=>
+ string(1) ";"
+ [17]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [18]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(4)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation13.phpt b/ext/tokenizer/tests/token_get_all_variation13.phpt
new file mode 100644
index 000000000..e79545e7e
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation13.phpt
@@ -0,0 +1,1167 @@
+--TEST--
+Test token_get_all() function : usage variations - with class/object constructs
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Testing token_get_all() with different class/object keywords
+ * scope related :
+ * static - T_STATIC(346), global - T_GLOBAL(340),
+ * private - T_PRIVATE(343), public - T_PUBLIC(341),
+ * protected - T_PROTECTED(342)
+ * class/object related :
+ * var - T_VAR(347), abstract - T_ABSTRACT(345),
+ * interface - T_INTERFACE(353), class - T_CLASS(352),
+ * extends - T_EXTENDS(354), implements - T_IMPLEMENTS(355), new - T_NEW(299)
+*/
+
+echo "*** Testing token_get_all() : with class/object constructs ***\n";
+
+$source = '<?php
+interface MyInterface
+{
+ public const var $var = 10;
+}
+abstract class MyClass
+{
+ private var $a;
+ public var $b;
+ protected var $c;
+ static $d;
+ final $e = 10;
+
+ abstract public function myFunction($a);
+}
+class ChildClass extends MyClass implements MyInterface
+{
+ global $value;
+ function myFunction($a)
+ {
+ $a = new ChildClass();
+ if($a instanceof MyClass)
+ echo "object created";
+ }
+}
+ChildClass::myFunction(10);
+?>';
+$tokens = token_get_all($source);
+var_dump($tokens);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : with class/object constructs ***
+array(145) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(353)
+ [1]=>
+ string(9) "interface"
+ [2]=>
+ int(2)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(11) "MyInterface"
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [5]=>
+ string(1) "{"
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(3)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(341)
+ [1]=>
+ string(6) "public"
+ [2]=>
+ int(4)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(334)
+ [1]=>
+ string(5) "const"
+ [2]=>
+ int(4)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [11]=>
+ array(3) {
+ [0]=>
+ int(347)
+ [1]=>
+ string(3) "var"
+ [2]=>
+ int(4)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(4) "$var"
+ [2]=>
+ int(4)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [15]=>
+ string(1) "="
+ [16]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(4)
+ }
+ [18]=>
+ string(1) ";"
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [20]=>
+ string(1) "}"
+ [21]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(345)
+ [1]=>
+ string(8) "abstract"
+ [2]=>
+ int(6)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [24]=>
+ array(3) {
+ [0]=>
+ int(352)
+ [1]=>
+ string(5) "class"
+ [2]=>
+ int(6)
+ }
+ [25]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "MyClass"
+ [2]=>
+ int(6)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [28]=>
+ string(1) "{"
+ [29]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(7)
+ }
+ [30]=>
+ array(3) {
+ [0]=>
+ int(343)
+ [1]=>
+ string(7) "private"
+ [2]=>
+ int(8)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [32]=>
+ array(3) {
+ [0]=>
+ int(347)
+ [1]=>
+ string(3) "var"
+ [2]=>
+ int(8)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(8)
+ }
+ [35]=>
+ string(1) ";"
+ [36]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(8)
+ }
+ [37]=>
+ array(3) {
+ [0]=>
+ int(341)
+ [1]=>
+ string(6) "public"
+ [2]=>
+ int(9)
+ }
+ [38]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [39]=>
+ array(3) {
+ [0]=>
+ int(347)
+ [1]=>
+ string(3) "var"
+ [2]=>
+ int(9)
+ }
+ [40]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [41]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(9)
+ }
+ [42]=>
+ string(1) ";"
+ [43]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(9)
+ }
+ [44]=>
+ array(3) {
+ [0]=>
+ int(342)
+ [1]=>
+ string(9) "protected"
+ [2]=>
+ int(10)
+ }
+ [45]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [46]=>
+ array(3) {
+ [0]=>
+ int(347)
+ [1]=>
+ string(3) "var"
+ [2]=>
+ int(10)
+ }
+ [47]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [48]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(10)
+ }
+ [49]=>
+ string(1) ";"
+ [50]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(10)
+ }
+ [51]=>
+ array(3) {
+ [0]=>
+ int(346)
+ [1]=>
+ string(6) "static"
+ [2]=>
+ int(11)
+ }
+ [52]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(11)
+ }
+ [53]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$d"
+ [2]=>
+ int(11)
+ }
+ [54]=>
+ string(1) ";"
+ [55]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(11)
+ }
+ [56]=>
+ array(3) {
+ [0]=>
+ int(344)
+ [1]=>
+ string(5) "final"
+ [2]=>
+ int(12)
+ }
+ [57]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [58]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$e"
+ [2]=>
+ int(12)
+ }
+ [59]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [60]=>
+ string(1) "="
+ [61]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [62]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(12)
+ }
+ [63]=>
+ string(1) ";"
+ [64]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(6) "
+
+ "
+ [2]=>
+ int(12)
+ }
+ [65]=>
+ array(3) {
+ [0]=>
+ int(345)
+ [1]=>
+ string(8) "abstract"
+ [2]=>
+ int(14)
+ }
+ [66]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(14)
+ }
+ [67]=>
+ array(3) {
+ [0]=>
+ int(341)
+ [1]=>
+ string(6) "public"
+ [2]=>
+ int(14)
+ }
+ [68]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(14)
+ }
+ [69]=>
+ array(3) {
+ [0]=>
+ int(333)
+ [1]=>
+ string(8) "function"
+ [2]=>
+ int(14)
+ }
+ [70]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(14)
+ }
+ [71]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "myFunction"
+ [2]=>
+ int(14)
+ }
+ [72]=>
+ string(1) "("
+ [73]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(14)
+ }
+ [74]=>
+ string(1) ")"
+ [75]=>
+ string(1) ";"
+ [76]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(14)
+ }
+ [77]=>
+ string(1) "}"
+ [78]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(15)
+ }
+ [79]=>
+ array(3) {
+ [0]=>
+ int(352)
+ [1]=>
+ string(5) "class"
+ [2]=>
+ int(16)
+ }
+ [80]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [81]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "ChildClass"
+ [2]=>
+ int(16)
+ }
+ [82]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [83]=>
+ array(3) {
+ [0]=>
+ int(354)
+ [1]=>
+ string(7) "extends"
+ [2]=>
+ int(16)
+ }
+ [84]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [85]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "MyClass"
+ [2]=>
+ int(16)
+ }
+ [86]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [87]=>
+ array(3) {
+ [0]=>
+ int(355)
+ [1]=>
+ string(10) "implements"
+ [2]=>
+ int(16)
+ }
+ [88]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [89]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(11) "MyInterface"
+ [2]=>
+ int(16)
+ }
+ [90]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(16)
+ }
+ [91]=>
+ string(1) "{"
+ [92]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(17)
+ }
+ [93]=>
+ array(3) {
+ [0]=>
+ int(340)
+ [1]=>
+ string(6) "global"
+ [2]=>
+ int(18)
+ }
+ [94]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(18)
+ }
+ [95]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(6) "$value"
+ [2]=>
+ int(18)
+ }
+ [96]=>
+ string(1) ";"
+ [97]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(18)
+ }
+ [98]=>
+ array(3) {
+ [0]=>
+ int(333)
+ [1]=>
+ string(8) "function"
+ [2]=>
+ int(19)
+ }
+ [99]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(19)
+ }
+ [100]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "myFunction"
+ [2]=>
+ int(19)
+ }
+ [101]=>
+ string(1) "("
+ [102]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(19)
+ }
+ [103]=>
+ string(1) ")"
+ [104]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(19)
+ }
+ [105]=>
+ string(1) "{"
+ [106]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(20)
+ }
+ [107]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(21)
+ }
+ [108]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(21)
+ }
+ [109]=>
+ string(1) "="
+ [110]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(21)
+ }
+ [111]=>
+ array(3) {
+ [0]=>
+ int(299)
+ [1]=>
+ string(3) "new"
+ [2]=>
+ int(21)
+ }
+ [112]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(21)
+ }
+ [113]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "ChildClass"
+ [2]=>
+ int(21)
+ }
+ [114]=>
+ string(1) "("
+ [115]=>
+ string(1) ")"
+ [116]=>
+ string(1) ";"
+ [117]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(21)
+ }
+ [118]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(22)
+ }
+ [119]=>
+ string(1) "("
+ [120]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(22)
+ }
+ [121]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(22)
+ }
+ [122]=>
+ array(3) {
+ [0]=>
+ int(288)
+ [1]=>
+ string(10) "instanceof"
+ [2]=>
+ int(22)
+ }
+ [123]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(22)
+ }
+ [124]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "MyClass"
+ [2]=>
+ int(22)
+ }
+ [125]=>
+ string(1) ")"
+ [126]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(7) "
+ "
+ [2]=>
+ int(22)
+ }
+ [127]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(23)
+ }
+ [128]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(23)
+ }
+ [129]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(16) ""object created""
+ [2]=>
+ int(23)
+ }
+ [130]=>
+ string(1) ";"
+ [131]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(23)
+ }
+ [132]=>
+ string(1) "}"
+ [133]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(24)
+ }
+ [134]=>
+ string(1) "}"
+ [135]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(25)
+ }
+ [136]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "ChildClass"
+ [2]=>
+ int(26)
+ }
+ [137]=>
+ array(3) {
+ [0]=>
+ int(375)
+ [1]=>
+ string(2) "::"
+ [2]=>
+ int(26)
+ }
+ [138]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "myFunction"
+ [2]=>
+ int(26)
+ }
+ [139]=>
+ string(1) "("
+ [140]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(26)
+ }
+ [141]=>
+ string(1) ")"
+ [142]=>
+ string(1) ";"
+ [143]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(26)
+ }
+ [144]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(27)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation14.phpt b/ext/tokenizer/tests/token_get_all_variation14.phpt
new file mode 100644
index 000000000..d4e4ec643
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation14.phpt
@@ -0,0 +1,289 @@
+--TEST--
+Test token_get_all() function : usage variations - invalid token values
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Testing token_get_all() with 'source' string containing invalid/unknown token value
+ * unknown tokens - T_UNKNOWN(307)
+*/
+
+echo "*** Testing token_get_all() : with invalid/unknown tokens ***\n";
+
+// with valid php tags and invalid tokens
+echo "-- with valid PHP tags & invlid tokens --\n";
+$source = '<?php
+struct myStruct {
+ variable $a;
+ method() { display $a; }
+}
+?>';
+var_dump( token_get_all($source));
+
+// with invalid open tag for testing entire source to be unkown token
+echo "-- with invlalid PHP open tag & valid tokens --\n";
+$source = '<pli
+echo "hello world"; ?>';
+var_dump( token_get_all($source));
+
+// with invalid PHP tags and invalid tokens
+echo "-- with invalid PHP tags and tokens --\n";
+$source = '<PDP display $a; <';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : with invalid/unknown tokens ***
+-- with valid PHP tags & invlid tokens --
+array(29) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(6) "struct"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(8) "myStruct"
+ [2]=>
+ int(2)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ string(1) "{"
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(2)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(8) "variable"
+ [2]=>
+ int(3)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(3)
+ }
+ [11]=>
+ string(1) ";"
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(3)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(6) "method"
+ [2]=>
+ int(4)
+ }
+ [14]=>
+ string(1) "("
+ [15]=>
+ string(1) ")"
+ [16]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [17]=>
+ string(1) "{"
+ [18]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "display"
+ [2]=>
+ int(4)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(4)
+ }
+ [22]=>
+ string(1) ";"
+ [23]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [24]=>
+ string(1) "}"
+ [25]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [26]=>
+ string(1) "}"
+ [27]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [28]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(6)
+ }
+}
+-- with invlalid PHP open tag & valid tokens --
+array(1) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(28) "<pli
+echo "hello world"; ?>"
+ [2]=>
+ int(1)
+ }
+}
+-- with invalid PHP tags and tokens --
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(18) "<PDP display $a; "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(1) "<"
+ [2]=>
+ int(1)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation15.phpt b/ext/tokenizer/tests/token_get_all_variation15.phpt
new file mode 100644
index 000000000..03ccd4d9d
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation15.phpt
@@ -0,0 +1,778 @@
+--TEST--
+Test token_get_all() function : usage variations - heredoc string for 'source'
+--INI--
+short_open_tag=On
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Testing token_get_all() with heredoc 'source' string with all different types of token and heredoc string within
+ * <<<EOT - T_START_HEREDOC(371)
+ * EOT - T_END_HEREDOC(372)
+*/
+
+echo "*** Testing token_get_all() : with heredoc source string ***\n";
+
+$source = <<<EOT
+<?=
+ \$a = 2;
+ \$b = 1;
+ \$c = <<<EOS
+ This is to test
+ heredoc string
+EOS;
+ echo \$a + \$b;
+ function myFunction(\$a)
+ {
+ var_dump(\$a);
+ }
+ if(\$b < 10) {
+ \$b++;
+ }
+ else
+ \$b--;
+ while(\$a > 0) {
+ echo "*";
+ \$a--;
+ }
+ myFunction(10);
+?>
+EOT;
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : with heredoc source string ***
+array(103) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(368)
+ [1]=>
+ string(3) "<?="
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(4) "
+ "
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ string(1) ";"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(3)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [11]=>
+ string(1) "="
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(3)
+ }
+ [14]=>
+ string(1) ";"
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(3)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(4)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [18]=>
+ string(1) "="
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(371)
+ [1]=>
+ string(7) "<<<EOS
+"
+ [2]=>
+ int(4)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(314)
+ [1]=>
+ string(36) " This is to test
+ heredoc string
+"
+ [2]=>
+ int(5)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(372)
+ [1]=>
+ string(3) "EOS"
+ [2]=>
+ int(7)
+ }
+ [23]=>
+ string(1) ";"
+ [24]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(7)
+ }
+ [25]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(8)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(8)
+ }
+ [28]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [29]=>
+ string(1) "+"
+ [30]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(8)
+ }
+ [32]=>
+ string(1) ";"
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(8)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(333)
+ [1]=>
+ string(8) "function"
+ [2]=>
+ int(9)
+ }
+ [35]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [36]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "myFunction"
+ [2]=>
+ int(9)
+ }
+ [37]=>
+ string(1) "("
+ [38]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(9)
+ }
+ [39]=>
+ string(1) ")"
+ [40]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(9)
+ }
+ [41]=>
+ string(1) "{"
+ [42]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(10)
+ }
+ [43]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(8) "var_dump"
+ [2]=>
+ int(11)
+ }
+ [44]=>
+ string(1) "("
+ [45]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(11)
+ }
+ [46]=>
+ string(1) ")"
+ [47]=>
+ string(1) ";"
+ [48]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(11)
+ }
+ [49]=>
+ string(1) "}"
+ [50]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(12)
+ }
+ [51]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(13)
+ }
+ [52]=>
+ string(1) "("
+ [53]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(13)
+ }
+ [54]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(13)
+ }
+ [55]=>
+ string(1) "<"
+ [56]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(13)
+ }
+ [57]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(13)
+ }
+ [58]=>
+ string(1) ")"
+ [59]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(13)
+ }
+ [60]=>
+ string(1) "{"
+ [61]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(13)
+ }
+ [62]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(14)
+ }
+ [63]=>
+ array(3) {
+ [0]=>
+ int(297)
+ [1]=>
+ string(2) "++"
+ [2]=>
+ int(14)
+ }
+ [64]=>
+ string(1) ";"
+ [65]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(14)
+ }
+ [66]=>
+ string(1) "}"
+ [67]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(15)
+ }
+ [68]=>
+ array(3) {
+ [0]=>
+ int(303)
+ [1]=>
+ string(4) "else"
+ [2]=>
+ int(16)
+ }
+ [69]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(16)
+ }
+ [70]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(17)
+ }
+ [71]=>
+ array(3) {
+ [0]=>
+ int(296)
+ [1]=>
+ string(2) "--"
+ [2]=>
+ int(17)
+ }
+ [72]=>
+ string(1) ";"
+ [73]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(17)
+ }
+ [74]=>
+ array(3) {
+ [0]=>
+ int(318)
+ [1]=>
+ string(5) "while"
+ [2]=>
+ int(18)
+ }
+ [75]=>
+ string(1) "("
+ [76]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(18)
+ }
+ [77]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(18)
+ }
+ [78]=>
+ string(1) ">"
+ [79]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(18)
+ }
+ [80]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "0"
+ [2]=>
+ int(18)
+ }
+ [81]=>
+ string(1) ")"
+ [82]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(18)
+ }
+ [83]=>
+ string(1) "{"
+ [84]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(18)
+ }
+ [85]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(19)
+ }
+ [86]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(19)
+ }
+ [87]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(3) ""*""
+ [2]=>
+ int(19)
+ }
+ [88]=>
+ string(1) ";"
+ [89]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(19)
+ }
+ [90]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(20)
+ }
+ [91]=>
+ array(3) {
+ [0]=>
+ int(296)
+ [1]=>
+ string(2) "--"
+ [2]=>
+ int(20)
+ }
+ [92]=>
+ string(1) ";"
+ [93]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(20)
+ }
+ [94]=>
+ string(1) "}"
+ [95]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(21)
+ }
+ [96]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "myFunction"
+ [2]=>
+ int(22)
+ }
+ [97]=>
+ string(1) "("
+ [98]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(22)
+ }
+ [99]=>
+ string(1) ")"
+ [100]=>
+ string(1) ";"
+ [101]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(22)
+ }
+ [102]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(23)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation16.phpt b/ext/tokenizer/tests/token_get_all_variation16.phpt
new file mode 100644
index 000000000..87646e955
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation16.phpt
@@ -0,0 +1,1001 @@
+--TEST--
+Test token_get_all() function : usage variations - with function constructs
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Testing token_get_all() with different function keywords
+ * function - T_FUNCTION(333), return - T_RETURN(335)
+ * different functions:
+ * include() - T_INCLUDE(262), print() - T_PRINT(266),
+ * isset() - T_ISSET(349), list() - T_LIST(358),
+ * require() - T_REQUIRE(259), empty() - T_EMPTY(350),
+ * declare() - T_DECLARE(324), array() - T_ARRAY(359),
+ * __halt_compiler() - T_HALT_COMPILER(351)
+*/
+
+echo "*** Testing token_get_all() : with different function constructs ***\n";
+
+$source = '<?php
+declare(VALUE=100);
+include("addfile.php");
+require("sumfile.php");
+
+function myFunction($a)
+{
+ if($a % 2)
+ return 1;
+ else
+ exit;
+}
+
+$a = VALUE;
+$b = 20;
+$c = array(1,2);
+$b >>= 2;
+
+if($b <= 0)
+ die;
+else
+ print($b);
+
+list($value1,$value2) = $c;
+if(empty($value1) && !isset($value1)) {
+ __halt_compiler();
+}
+?>';
+$tokens = token_get_all($source);
+var_dump($tokens);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : with different function constructs ***
+array(142) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(324)
+ [1]=>
+ string(7) "declare"
+ [2]=>
+ int(2)
+ }
+ [2]=>
+ string(1) "("
+ [3]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "VALUE"
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(3) "100"
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ string(1) ")"
+ [7]=>
+ string(1) ";"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(262)
+ [1]=>
+ string(7) "include"
+ [2]=>
+ int(3)
+ }
+ [10]=>
+ string(1) "("
+ [11]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(13) ""addfile.php""
+ [2]=>
+ int(3)
+ }
+ [12]=>
+ string(1) ")"
+ [13]=>
+ string(1) ";"
+ [14]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [15]=>
+ array(3) {
+ [0]=>
+ int(259)
+ [1]=>
+ string(7) "require"
+ [2]=>
+ int(4)
+ }
+ [16]=>
+ string(1) "("
+ [17]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(13) ""sumfile.php""
+ [2]=>
+ int(4)
+ }
+ [18]=>
+ string(1) ")"
+ [19]=>
+ string(1) ";"
+ [20]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) "
+
+"
+ [2]=>
+ int(4)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(333)
+ [1]=>
+ string(8) "function"
+ [2]=>
+ int(6)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(10) "myFunction"
+ [2]=>
+ int(6)
+ }
+ [24]=>
+ string(1) "("
+ [25]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(6)
+ }
+ [26]=>
+ string(1) ")"
+ [27]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [28]=>
+ string(1) "{"
+ [29]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(7)
+ }
+ [30]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(8)
+ }
+ [31]=>
+ string(1) "("
+ [32]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(8)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [34]=>
+ string(1) "%"
+ [35]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [36]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(8)
+ }
+ [37]=>
+ string(1) ")"
+ [38]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(8)
+ }
+ [39]=>
+ array(3) {
+ [0]=>
+ int(335)
+ [1]=>
+ string(6) "return"
+ [2]=>
+ int(9)
+ }
+ [40]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [41]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(9)
+ }
+ [42]=>
+ string(1) ";"
+ [43]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(9)
+ }
+ [44]=>
+ array(3) {
+ [0]=>
+ int(303)
+ [1]=>
+ string(4) "else"
+ [2]=>
+ int(10)
+ }
+ [45]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(10)
+ }
+ [46]=>
+ array(3) {
+ [0]=>
+ int(300)
+ [1]=>
+ string(4) "exit"
+ [2]=>
+ int(11)
+ }
+ [47]=>
+ string(1) ";"
+ [48]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(11)
+ }
+ [49]=>
+ string(1) "}"
+ [50]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) "
+
+"
+ [2]=>
+ int(12)
+ }
+ [51]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(14)
+ }
+ [52]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(14)
+ }
+ [53]=>
+ string(1) "="
+ [54]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(14)
+ }
+ [55]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(5) "VALUE"
+ [2]=>
+ int(14)
+ }
+ [56]=>
+ string(1) ";"
+ [57]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(14)
+ }
+ [58]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(15)
+ }
+ [59]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(15)
+ }
+ [60]=>
+ string(1) "="
+ [61]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(15)
+ }
+ [62]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "20"
+ [2]=>
+ int(15)
+ }
+ [63]=>
+ string(1) ";"
+ [64]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(15)
+ }
+ [65]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(16)
+ }
+ [66]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [67]=>
+ string(1) "="
+ [68]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [69]=>
+ array(3) {
+ [0]=>
+ int(359)
+ [1]=>
+ string(5) "array"
+ [2]=>
+ int(16)
+ }
+ [70]=>
+ string(1) "("
+ [71]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(16)
+ }
+ [72]=>
+ string(1) ","
+ [73]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(16)
+ }
+ [74]=>
+ string(1) ")"
+ [75]=>
+ string(1) ";"
+ [76]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(16)
+ }
+ [77]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(17)
+ }
+ [78]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(17)
+ }
+ [79]=>
+ array(3) {
+ [0]=>
+ int(267)
+ [1]=>
+ string(3) ">>="
+ [2]=>
+ int(17)
+ }
+ [80]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(17)
+ }
+ [81]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(17)
+ }
+ [82]=>
+ string(1) ";"
+ [83]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) "
+
+"
+ [2]=>
+ int(17)
+ }
+ [84]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(19)
+ }
+ [85]=>
+ string(1) "("
+ [86]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(19)
+ }
+ [87]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(19)
+ }
+ [88]=>
+ array(3) {
+ [0]=>
+ int(285)
+ [1]=>
+ string(2) "<="
+ [2]=>
+ int(19)
+ }
+ [89]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(19)
+ }
+ [90]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "0"
+ [2]=>
+ int(19)
+ }
+ [91]=>
+ string(1) ")"
+ [92]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(19)
+ }
+ [93]=>
+ array(3) {
+ [0]=>
+ int(300)
+ [1]=>
+ string(3) "die"
+ [2]=>
+ int(20)
+ }
+ [94]=>
+ string(1) ";"
+ [95]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(20)
+ }
+ [96]=>
+ array(3) {
+ [0]=>
+ int(303)
+ [1]=>
+ string(4) "else"
+ [2]=>
+ int(21)
+ }
+ [97]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(21)
+ }
+ [98]=>
+ array(3) {
+ [0]=>
+ int(266)
+ [1]=>
+ string(5) "print"
+ [2]=>
+ int(22)
+ }
+ [99]=>
+ string(1) "("
+ [100]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(22)
+ }
+ [101]=>
+ string(1) ")"
+ [102]=>
+ string(1) ";"
+ [103]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) "
+
+"
+ [2]=>
+ int(22)
+ }
+ [104]=>
+ array(3) {
+ [0]=>
+ int(358)
+ [1]=>
+ string(4) "list"
+ [2]=>
+ int(24)
+ }
+ [105]=>
+ string(1) "("
+ [106]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(7) "$value1"
+ [2]=>
+ int(24)
+ }
+ [107]=>
+ string(1) ","
+ [108]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(7) "$value2"
+ [2]=>
+ int(24)
+ }
+ [109]=>
+ string(1) ")"
+ [110]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(24)
+ }
+ [111]=>
+ string(1) "="
+ [112]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(24)
+ }
+ [113]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(24)
+ }
+ [114]=>
+ string(1) ";"
+ [115]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(24)
+ }
+ [116]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(25)
+ }
+ [117]=>
+ string(1) "("
+ [118]=>
+ array(3) {
+ [0]=>
+ int(350)
+ [1]=>
+ string(5) "empty"
+ [2]=>
+ int(25)
+ }
+ [119]=>
+ string(1) "("
+ [120]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(7) "$value1"
+ [2]=>
+ int(25)
+ }
+ [121]=>
+ string(1) ")"
+ [122]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(25)
+ }
+ [123]=>
+ array(3) {
+ [0]=>
+ int(279)
+ [1]=>
+ string(2) "&&"
+ [2]=>
+ int(25)
+ }
+ [124]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(25)
+ }
+ [125]=>
+ string(1) "!"
+ [126]=>
+ array(3) {
+ [0]=>
+ int(349)
+ [1]=>
+ string(5) "isset"
+ [2]=>
+ int(25)
+ }
+ [127]=>
+ string(1) "("
+ [128]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(7) "$value1"
+ [2]=>
+ int(25)
+ }
+ [129]=>
+ string(1) ")"
+ [130]=>
+ string(1) ")"
+ [131]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(25)
+ }
+ [132]=>
+ string(1) "{"
+ [133]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(25)
+ }
+ [134]=>
+ array(3) {
+ [0]=>
+ int(351)
+ [1]=>
+ string(15) "__halt_compiler"
+ [2]=>
+ int(26)
+ }
+ [135]=>
+ string(1) "("
+ [136]=>
+ string(1) ")"
+ [137]=>
+ string(1) ";"
+ [138]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(26)
+ }
+ [139]=>
+ string(1) "}"
+ [140]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(27)
+ }
+ [141]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(28)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation17.phpt b/ext/tokenizer/tests/token_get_all_variation17.phpt
new file mode 100644
index 000000000..e10fb5851
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation17.phpt
@@ -0,0 +1,611 @@
+--TEST--
+Test token_get_all() function : usage variations - with exception keywords
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Testing token_get_all() with different exception keywords
+ * try - T_TRY(336),
+ * catch - T_CATCH(337),
+ * throw - T_THROW(338)
+*/
+
+echo "*** Testing token_get_all() : with exception keywords ***\n";
+
+$source = '<?php
+function inverse($x)
+{
+ if($x == 0) {
+ throw new Exception("Divison by zero");
+ else
+ return 1/$x;
+}
+try {
+ echo inverse(0);
+ echo inverse(5);
+} catch(Exception $e) {
+ echo "caught exception:";
+}
+?>';
+$tokens = token_get_all($source);
+var_dump($tokens);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : with exception keywords ***
+array(81) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(333)
+ [1]=>
+ string(8) "function"
+ [2]=>
+ int(2)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "inverse"
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "("
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$x"
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ string(1) ")"
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [8]=>
+ string(1) "{"
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(3)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(4)
+ }
+ [11]=>
+ string(1) "("
+ [12]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$x"
+ [2]=>
+ int(4)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(283)
+ [1]=>
+ string(2) "=="
+ [2]=>
+ int(4)
+ }
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "0"
+ [2]=>
+ int(4)
+ }
+ [17]=>
+ string(1) ")"
+ [18]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [19]=>
+ string(1) "{"
+ [20]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(4)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(338)
+ [1]=>
+ string(5) "throw"
+ [2]=>
+ int(5)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(299)
+ [1]=>
+ string(3) "new"
+ [2]=>
+ int(5)
+ }
+ [24]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [25]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(9) "Exception"
+ [2]=>
+ int(5)
+ }
+ [26]=>
+ string(1) "("
+ [27]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(17) ""Divison by zero""
+ [2]=>
+ int(5)
+ }
+ [28]=>
+ string(1) ")"
+ [29]=>
+ string(1) ";"
+ [30]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(5)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(303)
+ [1]=>
+ string(4) "else"
+ [2]=>
+ int(6)
+ }
+ [32]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(6)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(335)
+ [1]=>
+ string(6) "return"
+ [2]=>
+ int(7)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [35]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(7)
+ }
+ [36]=>
+ string(1) "/"
+ [37]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$x"
+ [2]=>
+ int(7)
+ }
+ [38]=>
+ string(1) ";"
+ [39]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(7)
+ }
+ [40]=>
+ string(1) "}"
+ [41]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(8)
+ }
+ [42]=>
+ array(3) {
+ [0]=>
+ int(336)
+ [1]=>
+ string(3) "try"
+ [2]=>
+ int(9)
+ }
+ [43]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [44]=>
+ string(1) "{"
+ [45]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(9)
+ }
+ [46]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(10)
+ }
+ [47]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [48]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "inverse"
+ [2]=>
+ int(10)
+ }
+ [49]=>
+ string(1) "("
+ [50]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "0"
+ [2]=>
+ int(10)
+ }
+ [51]=>
+ string(1) ")"
+ [52]=>
+ string(1) ";"
+ [53]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(10)
+ }
+ [54]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(11)
+ }
+ [55]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(11)
+ }
+ [56]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(7) "inverse"
+ [2]=>
+ int(11)
+ }
+ [57]=>
+ string(1) "("
+ [58]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "5"
+ [2]=>
+ int(11)
+ }
+ [59]=>
+ string(1) ")"
+ [60]=>
+ string(1) ";"
+ [61]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(11)
+ }
+ [62]=>
+ string(1) "}"
+ [63]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [64]=>
+ array(3) {
+ [0]=>
+ int(337)
+ [1]=>
+ string(5) "catch"
+ [2]=>
+ int(12)
+ }
+ [65]=>
+ string(1) "("
+ [66]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(9) "Exception"
+ [2]=>
+ int(12)
+ }
+ [67]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [68]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$e"
+ [2]=>
+ int(12)
+ }
+ [69]=>
+ string(1) ")"
+ [70]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [71]=>
+ string(1) "{"
+ [72]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(5) "
+ "
+ [2]=>
+ int(12)
+ }
+ [73]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(13)
+ }
+ [74]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(13)
+ }
+ [75]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(19) ""caught exception:""
+ [2]=>
+ int(13)
+ }
+ [76]=>
+ string(1) ";"
+ [77]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(13)
+ }
+ [78]=>
+ string(1) "}"
+ [79]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(14)
+ }
+ [80]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(15)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation18.phpt b/ext/tokenizer/tests/token_get_all_variation18.phpt
new file mode 100644
index 000000000..309b7e626
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation18.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test token_get_all() function : usage variations - with HTML code
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Testing token_get_all() with source string containing HTML code with PHP
+ * HTML tags are considered to be T_INLINE_HTML(311)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with HTML tags ***\n";
+
+$source = '
+<html>
+<body>
+ Testing HTML
+</body>
+</html>"
+
+<?php
+ echo "php code with HTML";
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with HTML tags ***
+array(9) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(311)
+ [1]=>
+ string(48) "
+<html>
+<body>
+ Testing HTML
+</body>
+</html>"
+
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(8)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(8)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(9)
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(20) ""php code with HTML""
+ [2]=>
+ int(9)
+ }
+ [6]=>
+ string(1) ";"
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(9)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(10)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation19.phpt b/ext/tokenizer/tests/token_get_all_variation19.phpt
new file mode 100644
index 000000000..ae614054f
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation19.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Reconstructing a script using token_get_all()
+--FILE--
+<?php
+
+$phpstr = '
+<?php
+
+// A php script to test token_get_all()
+
+/* a different
+type of
+comment */
+
+// a class
+class TestClass {
+ public function foo() {
+ echo "Called foo()\n";
+ }
+}
+
+$a = new TestClass();
+$a->foo();
+
+for ($i = 0; $i < 10; $i++) {
+ echo "Loop iteration $i\n";
+}
+
+?>';
+
+$token_array = token_get_all($phpstr);
+
+$script = "";
+// reconstruct a script (without open/close tags) from the token array
+foreach ($token_array as $token) {
+ if (is_array($token)) {
+ if (strncmp($token[1], '<?php', 5) == 0) {
+ continue;
+ }
+ if (strncmp($token[1], '?>', 2) == 0) {
+ continue;
+ }
+ $script .= $token[1];
+ } else {
+ $script .= $token;
+ }
+}
+
+var_dump($script);
+
+eval($script);
+
+?>
+--EXPECT--
+string(259) "
+
+// A php script to test token_get_all()
+
+/* a different
+type of
+comment */
+
+// a class
+class TestClass {
+ public function foo() {
+ echo "Called foo()\n";
+ }
+}
+
+$a = new TestClass();
+$a->foo();
+
+for ($i = 0; $i < 10; $i++) {
+ echo "Loop iteration $i\n";
+}
+
+"
+Called foo()
+Loop iteration 0
+Loop iteration 1
+Loop iteration 2
+Loop iteration 3
+Loop iteration 4
+Loop iteration 5
+Loop iteration 6
+Loop iteration 7
+Loop iteration 8
+Loop iteration 9
diff --git a/ext/tokenizer/tests/token_get_all_variation2.phpt b/ext/tokenizer/tests/token_get_all_variation2.phpt
new file mode 100644
index 000000000..d4f62dcab
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation2.phpt
@@ -0,0 +1,429 @@
+--TEST--
+Test token_get_all() function : usage variations - with different arithmetic operators
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different arithmetic operators to test them for token
+ * Arithmetic operators: +, -, *, /, % are not listed as specific operator tokens,
+ * so they are expected to return string - T_STRING
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different arithmetic operators ***\n";
+
+// arithmetic operators - '+', '-', '*', '/', '%'
+$source = array (
+ '<?php $a = 1 + 2; ?>',
+ '<?php $b = $b - 2; ?>',
+ '<?php $c = $a * $b; ?>',
+ '<?php $a = $b % 2; ?>'
+);
+for($count = 0; $count < count($source); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( token_get_all($source[$count]));
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different arithmetic operators ***
+-- Iteration 1 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) "+"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 2 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) "-"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 3 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) "*"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 4 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ string(1) "%"
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation3.phpt b/ext/tokenizer/tests/token_get_all_variation3.phpt
new file mode 100644
index 000000000..267e8c5b4
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation3.phpt
@@ -0,0 +1,568 @@
+--TEST--
+Test token_get_all() function : usage variations - with logical operators
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different logical operators to test them for tokens
+ * and - T_AND_LOGICAL_AND(265),
+ * or - T_LOGICAL_OR(263),
+ * xor - T_LOGICAL_XOR(264),
+ * && - T_BOOLEAN_AND(279),
+ * || - T_BOOLEAN_OR(278)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different logical operators ***\n";
+
+// logical operators : 'and', 'or', 'xor', '&&', '||'
+$source = array (
+ '<?php $a = 1 and 024; ?>',
+ '<?php $b = $b or 0X1E; ?>',
+ '<?php $c = $a xor $b; ?>',
+ '<?php $a = $b && 2; ?>',
+ '<?php $b = $b || 1; ?>'
+);
+for($count = 0; $count < count($source); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( token_get_all($source[$count]));
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different logical operators ***
+-- Iteration 1 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(265)
+ [1]=>
+ string(3) "and"
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(3) "024"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 2 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(263)
+ [1]=>
+ string(2) "or"
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(4) "0X1E"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 3 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(264)
+ [1]=>
+ string(3) "xor"
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 4 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(279)
+ [1]=>
+ string(2) "&&"
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+-- Iteration 5 --
+array(13) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(1)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(278)
+ [1]=>
+ string(2) "||"
+ [2]=>
+ int(1)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(1)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(1)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(1)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation4.phpt b/ext/tokenizer/tests/token_get_all_variation4.phpt
new file mode 100644
index 000000000..e63a917ea
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation4.phpt
@@ -0,0 +1,747 @@
+--TEST--
+Test token_get_all() function : usage variations - with comparison operators
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different comparison operators to test them for tokens
+ * == - T_IS_EQUAL(283), === - T_IS_IDENTICAL(281),
+ * >= - T_IS_GREATER_OR_EQUAL(284), <= - T_IS_LESS_OR_EQUAL(285)
+ * != - T_IS_NOT_EQUAL, <> - T_IS_NOT_EQUAL(282), !== - T_IS_NOT_IDENTICAL(280)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different comparison operators ***\n";
+
+// comparison operators : '==', '===', '>=', '<=', '!=', '!==', '<>'
+$source = '<?php
+if($a == 0)
+ echo "== 0";
+elseif($a === 2)
+ echo "=== 2";
+elseif($a >= 10 && $a <= 20)
+ echo ">= 10 & <=20";
+elseif($a != 1 || $a <> 1)
+ echo "!= 1";
+elseif($a !== 1)
+ echo "!==1";
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different comparison operators ***
+array(89) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ string(1) "("
+ [4]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(283)
+ [1]=>
+ string(2) "=="
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "0"
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ string(1) ")"
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(4) "
+ "
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(3)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(6) ""== 0""
+ [2]=>
+ int(3)
+ }
+ [14]=>
+ string(1) ";"
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(302)
+ [1]=>
+ string(6) "elseif"
+ [2]=>
+ int(4)
+ }
+ [17]=>
+ string(1) "("
+ [18]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(4)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(281)
+ [1]=>
+ string(3) "==="
+ [2]=>
+ int(4)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(4)
+ }
+ [23]=>
+ string(1) ")"
+ [24]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(4)
+ }
+ [25]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(5)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(7) ""=== 2""
+ [2]=>
+ int(5)
+ }
+ [28]=>
+ string(1) ";"
+ [29]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [30]=>
+ array(3) {
+ [0]=>
+ int(302)
+ [1]=>
+ string(6) "elseif"
+ [2]=>
+ int(6)
+ }
+ [31]=>
+ string(1) "("
+ [32]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(6)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(284)
+ [1]=>
+ string(2) ">="
+ [2]=>
+ int(6)
+ }
+ [35]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [36]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(6)
+ }
+ [37]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [38]=>
+ array(3) {
+ [0]=>
+ int(279)
+ [1]=>
+ string(2) "&&"
+ [2]=>
+ int(6)
+ }
+ [39]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [40]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(6)
+ }
+ [41]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [42]=>
+ array(3) {
+ [0]=>
+ int(285)
+ [1]=>
+ string(2) "<="
+ [2]=>
+ int(6)
+ }
+ [43]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [44]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "20"
+ [2]=>
+ int(6)
+ }
+ [45]=>
+ string(1) ")"
+ [46]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(6)
+ }
+ [47]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(7)
+ }
+ [48]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [49]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(14) "">= 10 & <=20""
+ [2]=>
+ int(7)
+ }
+ [50]=>
+ string(1) ";"
+ [51]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(7)
+ }
+ [52]=>
+ array(3) {
+ [0]=>
+ int(302)
+ [1]=>
+ string(6) "elseif"
+ [2]=>
+ int(8)
+ }
+ [53]=>
+ string(1) "("
+ [54]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(8)
+ }
+ [55]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [56]=>
+ array(3) {
+ [0]=>
+ int(282)
+ [1]=>
+ string(2) "!="
+ [2]=>
+ int(8)
+ }
+ [57]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [58]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(8)
+ }
+ [59]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [60]=>
+ array(3) {
+ [0]=>
+ int(278)
+ [1]=>
+ string(2) "||"
+ [2]=>
+ int(8)
+ }
+ [61]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [62]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(8)
+ }
+ [63]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [64]=>
+ array(3) {
+ [0]=>
+ int(282)
+ [1]=>
+ string(2) "<>"
+ [2]=>
+ int(8)
+ }
+ [65]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [66]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(8)
+ }
+ [67]=>
+ string(1) ")"
+ [68]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(8)
+ }
+ [69]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(9)
+ }
+ [70]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [71]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(6) ""!= 1""
+ [2]=>
+ int(9)
+ }
+ [72]=>
+ string(1) ";"
+ [73]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(9)
+ }
+ [74]=>
+ array(3) {
+ [0]=>
+ int(302)
+ [1]=>
+ string(6) "elseif"
+ [2]=>
+ int(10)
+ }
+ [75]=>
+ string(1) "("
+ [76]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(10)
+ }
+ [77]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [78]=>
+ array(3) {
+ [0]=>
+ int(280)
+ [1]=>
+ string(3) "!=="
+ [2]=>
+ int(10)
+ }
+ [79]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [80]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(10)
+ }
+ [81]=>
+ string(1) ")"
+ [82]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(3) "
+ "
+ [2]=>
+ int(10)
+ }
+ [83]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(11)
+ }
+ [84]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(11)
+ }
+ [85]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(6) ""!==1""
+ [2]=>
+ int(11)
+ }
+ [86]=>
+ string(1) ";"
+ [87]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(11)
+ }
+ [88]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(12)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation5.phpt b/ext/tokenizer/tests/token_get_all_variation5.phpt
new file mode 100644
index 000000000..5a7d16a36
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation5.phpt
@@ -0,0 +1,798 @@
+--TEST--
+Test token_get_all() function : usage variations - with assignment operators
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different assignment operators to test them for tokens
+ * += - T_PLUS_EQUAL(277), -= - T_MINUS-EQUAL(276),
+ * *= - T_MUL_EQUAL(275), /= - T_DIVIDE_EQUAL(274),
+ * %= - T_MOD_EQUAL(272), &= - T_AND_EQUAL(271),
+ * |= - T_OR_EQUAL(271), ^= - T_EXOR_EQUAL(269),
+ * >>= - T_SR_EQUAL(267), <<= - T_SL_EQUAL(268), .= - T_CONCAT_EQUAL(273)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different assignment operators ***\n";
+
+// assignment operators : '+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '>>=', '<<=', '.='
+$source = '<?php
+$a = 1, $b = 2;
+$c += $b;
+$b -= $a;
+$a *= 2;
+$d /= 10.50;
+$a %= 10.50;
+$b &= $c;
+$c |= 1;
+$d ^= 5;
+$a >>= 1;
+$b <<= 2;
+$d .= "hello world";
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different assignment operators ***
+array(94) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ string(1) ","
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(2)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ string(1) "="
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(2)
+ }
+ [14]=>
+ string(1) ";"
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(3)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [18]=>
+ array(3) {
+ [0]=>
+ int(277)
+ [1]=>
+ string(2) "+="
+ [2]=>
+ int(3)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(3)
+ }
+ [21]=>
+ string(1) ";"
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(4)
+ }
+ [24]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [25]=>
+ array(3) {
+ [0]=>
+ int(276)
+ [1]=>
+ string(2) "-="
+ [2]=>
+ int(4)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(4)
+ }
+ [28]=>
+ string(1) ";"
+ [29]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [30]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(5)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [32]=>
+ array(3) {
+ [0]=>
+ int(275)
+ [1]=>
+ string(2) "*="
+ [2]=>
+ int(5)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(5)
+ }
+ [35]=>
+ string(1) ";"
+ [36]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [37]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$d"
+ [2]=>
+ int(6)
+ }
+ [38]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [39]=>
+ array(3) {
+ [0]=>
+ int(274)
+ [1]=>
+ string(2) "/="
+ [2]=>
+ int(6)
+ }
+ [40]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [41]=>
+ array(3) {
+ [0]=>
+ int(306)
+ [1]=>
+ string(5) "10.50"
+ [2]=>
+ int(6)
+ }
+ [42]=>
+ string(1) ";"
+ [43]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [44]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(7)
+ }
+ [45]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [46]=>
+ array(3) {
+ [0]=>
+ int(272)
+ [1]=>
+ string(2) "%="
+ [2]=>
+ int(7)
+ }
+ [47]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [48]=>
+ array(3) {
+ [0]=>
+ int(306)
+ [1]=>
+ string(5) "10.50"
+ [2]=>
+ int(7)
+ }
+ [49]=>
+ string(1) ";"
+ [50]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(7)
+ }
+ [51]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(8)
+ }
+ [52]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [53]=>
+ array(3) {
+ [0]=>
+ int(271)
+ [1]=>
+ string(2) "&="
+ [2]=>
+ int(8)
+ }
+ [54]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [55]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(8)
+ }
+ [56]=>
+ string(1) ";"
+ [57]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(8)
+ }
+ [58]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(9)
+ }
+ [59]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [60]=>
+ array(3) {
+ [0]=>
+ int(270)
+ [1]=>
+ string(2) "|="
+ [2]=>
+ int(9)
+ }
+ [61]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [62]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(9)
+ }
+ [63]=>
+ string(1) ";"
+ [64]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(9)
+ }
+ [65]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$d"
+ [2]=>
+ int(10)
+ }
+ [66]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [67]=>
+ array(3) {
+ [0]=>
+ int(269)
+ [1]=>
+ string(2) "^="
+ [2]=>
+ int(10)
+ }
+ [68]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [69]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "5"
+ [2]=>
+ int(10)
+ }
+ [70]=>
+ string(1) ";"
+ [71]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(10)
+ }
+ [72]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(11)
+ }
+ [73]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(11)
+ }
+ [74]=>
+ array(3) {
+ [0]=>
+ int(267)
+ [1]=>
+ string(3) ">>="
+ [2]=>
+ int(11)
+ }
+ [75]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(11)
+ }
+ [76]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(11)
+ }
+ [77]=>
+ string(1) ";"
+ [78]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(11)
+ }
+ [79]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(12)
+ }
+ [80]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [81]=>
+ array(3) {
+ [0]=>
+ int(268)
+ [1]=>
+ string(3) "<<="
+ [2]=>
+ int(12)
+ }
+ [82]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(12)
+ }
+ [83]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(12)
+ }
+ [84]=>
+ string(1) ";"
+ [85]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(12)
+ }
+ [86]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$d"
+ [2]=>
+ int(13)
+ }
+ [87]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(13)
+ }
+ [88]=>
+ array(3) {
+ [0]=>
+ int(273)
+ [1]=>
+ string(2) ".="
+ [2]=>
+ int(13)
+ }
+ [89]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(13)
+ }
+ [90]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(13) ""hello world""
+ [2]=>
+ int(13)
+ }
+ [91]=>
+ string(1) ";"
+ [92]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(13)
+ }
+ [93]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(14)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation6.phpt b/ext/tokenizer/tests/token_get_all_variation6.phpt
new file mode 100644
index 000000000..5d81104a2
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation6.phpt
@@ -0,0 +1,392 @@
+--TEST--
+Test token_get_all() function : usage variations - with bitwise operators
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different bitwise operators to test them for token
+ * << - T_SL(287)
+ * >> - T_SR(286)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different bitwise operators ***\n";
+
+// bitwise operators : '<<' , '>>'
+$source = '<?php
+$a = 2, $b = 4;
+$a = $a << 2;
+$b = $b >> 2;
+var_dump($a);
+var_dump($b);
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different bitwise operators ***
+array(50) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php
+"
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ string(1) "="
+ [4]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ string(1) ","
+ [7]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [8]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [10]=>
+ string(1) "="
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "4"
+ [2]=>
+ int(2)
+ }
+ [13]=>
+ string(1) ";"
+ [14]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [15]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(3)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [17]=>
+ string(1) "="
+ [18]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(3)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(287)
+ [1]=>
+ string(2) "<<"
+ [2]=>
+ int(3)
+ }
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(3)
+ }
+ [24]=>
+ string(1) ";"
+ [25]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(4)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [28]=>
+ string(1) "="
+ [29]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [30]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(4)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [32]=>
+ array(3) {
+ [0]=>
+ int(286)
+ [1]=>
+ string(2) ">>"
+ [2]=>
+ int(4)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "2"
+ [2]=>
+ int(4)
+ }
+ [35]=>
+ string(1) ";"
+ [36]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [37]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(8) "var_dump"
+ [2]=>
+ int(5)
+ }
+ [38]=>
+ string(1) "("
+ [39]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(5)
+ }
+ [40]=>
+ string(1) ")"
+ [41]=>
+ string(1) ";"
+ [42]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [43]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(8) "var_dump"
+ [2]=>
+ int(6)
+ }
+ [44]=>
+ string(1) "("
+ [45]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(6)
+ }
+ [46]=>
+ string(1) ")"
+ [47]=>
+ string(1) ";"
+ [48]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [49]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(7)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation7.phpt b/ext/tokenizer/tests/token_get_all_variation7.phpt
new file mode 100644
index 000000000..5ba856384
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation7.phpt
@@ -0,0 +1,259 @@
+--TEST--
+Test token_get_all() function : usage variations - with increment/decrement operators
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different increment/decrement operators to test them for token
+ * ++ - T_INC(297)
+ * -- - T_DEC(296)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different increment/decrement operators ***\n";
+
+// increment/decrement operators : '++' , '--'
+$source = '<?php
+$a = 10, $b = 5;
+$a++;
+$b--;
+echo $a;
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different increment/decrement operators ***
+array(30) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ string(1) ","
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(2)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ string(1) "="
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "5"
+ [2]=>
+ int(2)
+ }
+ [14]=>
+ string(1) ";"
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(3)
+ }
+ [17]=>
+ array(3) {
+ [0]=>
+ int(297)
+ [1]=>
+ string(2) "++"
+ [2]=>
+ int(3)
+ }
+ [18]=>
+ string(1) ";"
+ [19]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(4)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(296)
+ [1]=>
+ string(2) "--"
+ [2]=>
+ int(4)
+ }
+ [22]=>
+ string(1) ";"
+ [23]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [24]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(5)
+ }
+ [25]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(5)
+ }
+ [27]=>
+ string(1) ";"
+ [28]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [29]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(6)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation8.phpt b/ext/tokenizer/tests/token_get_all_variation8.phpt
new file mode 100644
index 000000000..5c761f6cb
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation8.phpt
@@ -0,0 +1,832 @@
+--TEST--
+Test token_get_all() function : usage variations - with type casting operators
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different type casting operators to test them for token
+ * (int)/(integer) - T_INT_CAST(295), (float)/(real)/(double) - T_DOUBLE_CAST(294),
+ * (string) - T_STRING_CAST(293), (bool)/(boolean) - T_BOOL_CAST(290),
+ * (unset) - T_UNSET_CAST(289)
+*/
+
+echo "*** Testing token_get_all() : 'source' string with different type casting operators ***\n";
+
+// type casting operators : (int), (integer), (float), (real), (double), (string), (array), (object), (bool), (boolean),(unset)
+$source = '<?php
+$a = 1, $b = 10.5
+$c = (int)$b + $a;
+$d = (float)$a + $b;
+$e = (string)$a.(string)$b;
+if((bool)$a) echo "true";
+if(!(boolean)$b) echo "false";
+$c = $c + (integer) 123.4e2;
+$d = $c - (real) 12;
+$b = (unset)$a;
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different type casting operators ***
+array(108) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [4]=>
+ string(1) "="
+ [5]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ int(2)
+ }
+ [7]=>
+ string(1) ","
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(2)
+ }
+ [10]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [11]=>
+ string(1) "="
+ [12]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(2)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(306)
+ [1]=>
+ string(4) "10.5"
+ [2]=>
+ int(2)
+ }
+ [14]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(2)
+ }
+ [15]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(3)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [17]=>
+ string(1) "="
+ [18]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(295)
+ [1]=>
+ string(5) "(int)"
+ [2]=>
+ int(3)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(3)
+ }
+ [21]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [22]=>
+ string(1) "+"
+ [23]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(3)
+ }
+ [24]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(3)
+ }
+ [25]=>
+ string(1) ";"
+ [26]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(3)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$d"
+ [2]=>
+ int(4)
+ }
+ [28]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [29]=>
+ string(1) "="
+ [30]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(294)
+ [1]=>
+ string(7) "(float)"
+ [2]=>
+ int(4)
+ }
+ [32]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(4)
+ }
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [34]=>
+ string(1) "+"
+ [35]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(4)
+ }
+ [36]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(4)
+ }
+ [37]=>
+ string(1) ";"
+ [38]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(4)
+ }
+ [39]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$e"
+ [2]=>
+ int(5)
+ }
+ [40]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [41]=>
+ string(1) "="
+ [42]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(5)
+ }
+ [43]=>
+ array(3) {
+ [0]=>
+ int(293)
+ [1]=>
+ string(8) "(string)"
+ [2]=>
+ int(5)
+ }
+ [44]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(5)
+ }
+ [45]=>
+ string(1) "."
+ [46]=>
+ array(3) {
+ [0]=>
+ int(293)
+ [1]=>
+ string(8) "(string)"
+ [2]=>
+ int(5)
+ }
+ [47]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(5)
+ }
+ [48]=>
+ string(1) ";"
+ [49]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(5)
+ }
+ [50]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(6)
+ }
+ [51]=>
+ string(1) "("
+ [52]=>
+ array(3) {
+ [0]=>
+ int(290)
+ [1]=>
+ string(6) "(bool)"
+ [2]=>
+ int(6)
+ }
+ [53]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(6)
+ }
+ [54]=>
+ string(1) ")"
+ [55]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [56]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(6)
+ }
+ [57]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(6)
+ }
+ [58]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(6) ""true""
+ [2]=>
+ int(6)
+ }
+ [59]=>
+ string(1) ";"
+ [60]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(6)
+ }
+ [61]=>
+ array(3) {
+ [0]=>
+ int(301)
+ [1]=>
+ string(2) "if"
+ [2]=>
+ int(7)
+ }
+ [62]=>
+ string(1) "("
+ [63]=>
+ string(1) "!"
+ [64]=>
+ array(3) {
+ [0]=>
+ int(290)
+ [1]=>
+ string(9) "(boolean)"
+ [2]=>
+ int(7)
+ }
+ [65]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(7)
+ }
+ [66]=>
+ string(1) ")"
+ [67]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [68]=>
+ array(3) {
+ [0]=>
+ int(316)
+ [1]=>
+ string(4) "echo"
+ [2]=>
+ int(7)
+ }
+ [69]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [70]=>
+ array(3) {
+ [0]=>
+ int(315)
+ [1]=>
+ string(7) ""false""
+ [2]=>
+ int(7)
+ }
+ [71]=>
+ string(1) ";"
+ [72]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(7)
+ }
+ [73]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(8)
+ }
+ [74]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [75]=>
+ string(1) "="
+ [76]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [77]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(8)
+ }
+ [78]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [79]=>
+ string(1) "+"
+ [80]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [81]=>
+ array(3) {
+ [0]=>
+ int(295)
+ [1]=>
+ string(9) "(integer)"
+ [2]=>
+ int(8)
+ }
+ [82]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [83]=>
+ array(3) {
+ [0]=>
+ int(306)
+ [1]=>
+ string(7) "123.4e2"
+ [2]=>
+ int(8)
+ }
+ [84]=>
+ string(1) ";"
+ [85]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(8)
+ }
+ [86]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$d"
+ [2]=>
+ int(9)
+ }
+ [87]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [88]=>
+ string(1) "="
+ [89]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [90]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(9)
+ }
+ [91]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [92]=>
+ string(1) "-"
+ [93]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [94]=>
+ array(3) {
+ [0]=>
+ int(294)
+ [1]=>
+ string(6) "(real)"
+ [2]=>
+ int(9)
+ }
+ [95]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [96]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "12"
+ [2]=>
+ int(9)
+ }
+ [97]=>
+ string(1) ";"
+ [98]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(9)
+ }
+ [99]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(10)
+ }
+ [100]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [101]=>
+ string(1) "="
+ [102]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(10)
+ }
+ [103]=>
+ array(3) {
+ [0]=>
+ int(289)
+ [1]=>
+ string(7) "(unset)"
+ [2]=>
+ int(10)
+ }
+ [104]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(10)
+ }
+ [105]=>
+ string(1) ";"
+ [106]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(10)
+ }
+ [107]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(11)
+ }
+}
+Done
diff --git a/ext/tokenizer/tests/token_get_all_variation9.phpt b/ext/tokenizer/tests/token_get_all_variation9.phpt
new file mode 100644
index 000000000..247b754f7
--- /dev/null
+++ b/ext/tokenizer/tests/token_get_all_variation9.phpt
@@ -0,0 +1,441 @@
+--TEST--
+Test token_get_all() function : usage variations - with different types of comments
+--FILE--
+<?php
+/* Prototype : array token_get_all(string $source)
+ * Description: splits the given source into an array of PHP languange tokens
+ * Source code: ext/tokenizer/tokenizer.c
+*/
+
+/*
+ * Passing 'source' argument with different style of comments
+ */
+// '//', '/* */', '#' - T_COMMENT(365)
+// '/** */' - T_DOC_COMMENT(366)
+
+
+echo "*** Testing token_get_all() : 'source' string with different comments ***\n";
+
+// types of comments: '//', '/* */', '#' & /** */
+
+$source = '<?php
+/** Performing addition operation on given values :
+ * a, b
+ */
+
+// int value
+$a = 10;
+$b = 20;
+$c = true; // bool value
+
+/*
+ * Performing operation on $a,$b
+ * display result
+ */
+$c = $a + $b;
+var_dump($c); # expected: int(30)
+
+# end of program
+?>';
+var_dump( token_get_all($source));
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing token_get_all() : 'source' string with different comments ***
+array(51) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(367)
+ [1]=>
+ string(6) "<?php "
+ [2]=>
+ int(1)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(1)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(366)
+ [1]=>
+ string(65) "/** Performing addition operation on given values :
+ * a, b
+ */"
+ [2]=>
+ int(2)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(2) "
+
+"
+ [2]=>
+ int(4)
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ int(365)
+ [1]=>
+ string(13) "// int value
+"
+ [2]=>
+ int(6)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(7)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [7]=>
+ string(1) "="
+ [8]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(7)
+ }
+ [9]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "10"
+ [2]=>
+ int(7)
+ }
+ [10]=>
+ string(1) ";"
+ [11]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(7)
+ }
+ [12]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(8)
+ }
+ [13]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [14]=>
+ string(1) "="
+ [15]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(8)
+ }
+ [16]=>
+ array(3) {
+ [0]=>
+ int(305)
+ [1]=>
+ string(2) "20"
+ [2]=>
+ int(8)
+ }
+ [17]=>
+ string(1) ";"
+ [18]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(8)
+ }
+ [19]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(9)
+ }
+ [20]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [21]=>
+ string(1) "="
+ [22]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [23]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(4) "true"
+ [2]=>
+ int(9)
+ }
+ [24]=>
+ string(1) ";"
+ [25]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(9)
+ }
+ [26]=>
+ array(3) {
+ [0]=>
+ int(365)
+ [1]=>
+ string(14) "// bool value
+"
+ [2]=>
+ int(9)
+ }
+ [27]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(10)
+ }
+ [28]=>
+ array(3) {
+ [0]=>
+ int(365)
+ [1]=>
+ string(59) "/*
+ * Performing operation on $a,$b
+ * display result
+ */"
+ [2]=>
+ int(11)
+ }
+ [29]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(14)
+ }
+ [30]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(15)
+ }
+ [31]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(15)
+ }
+ [32]=>
+ string(1) "="
+ [33]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(15)
+ }
+ [34]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$a"
+ [2]=>
+ int(15)
+ }
+ [35]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(15)
+ }
+ [36]=>
+ string(1) "+"
+ [37]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(15)
+ }
+ [38]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$b"
+ [2]=>
+ int(15)
+ }
+ [39]=>
+ string(1) ";"
+ [40]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(15)
+ }
+ [41]=>
+ array(3) {
+ [0]=>
+ int(307)
+ [1]=>
+ string(8) "var_dump"
+ [2]=>
+ int(16)
+ }
+ [42]=>
+ string(1) "("
+ [43]=>
+ array(3) {
+ [0]=>
+ int(309)
+ [1]=>
+ string(2) "$c"
+ [2]=>
+ int(16)
+ }
+ [44]=>
+ string(1) ")"
+ [45]=>
+ string(1) ";"
+ [46]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) " "
+ [2]=>
+ int(16)
+ }
+ [47]=>
+ array(3) {
+ [0]=>
+ int(365)
+ [1]=>
+ string(20) "# expected: int(30)
+"
+ [2]=>
+ int(16)
+ }
+ [48]=>
+ array(3) {
+ [0]=>
+ int(370)
+ [1]=>
+ string(1) "
+"
+ [2]=>
+ int(17)
+ }
+ [49]=>
+ array(3) {
+ [0]=>
+ int(365)
+ [1]=>
+ string(17) "# end of program
+"
+ [2]=>
+ int(18)
+ }
+ [50]=>
+ array(3) {
+ [0]=>
+ int(369)
+ [1]=>
+ string(2) "?>"
+ [2]=>
+ int(19)
+ }
+}
+Done
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index fdab581b4..7134027e1 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tokenizer.c,v 1.31.2.5.2.7 2007/07/31 23:24:11 johannes Exp $ */
+/* $Id: tokenizer.c,v 1.31.2.5.2.8 2007/12/31 07:20:14 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c
index 6cebfc732..2715f4f27 100644
--- a/ext/tokenizer/tokenizer_data.c
+++ b/ext/tokenizer/tokenizer_data.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tokenizer_data.c,v 1.1.2.2 2007/07/31 23:24:11 johannes Exp $ */
+/* $Id: tokenizer_data.c,v 1.1.2.3 2007/12/31 07:20:14 sebastian Exp $ */
/*
DO NOT EDIT THIS FILE!
diff --git a/ext/wddx/php_wddx.h b/ext/wddx/php_wddx.h
index edbd59c76..054a43e22 100644
--- a/ext/wddx/php_wddx.h
+++ b/ext/wddx/php_wddx.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_wddx.h,v 1.18.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_wddx.h,v 1.18.2.1.2.2 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_WDDX_H
#define PHP_WDDX_H
diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h
index 25690919a..7ef2a0d18 100644
--- a/ext/wddx/php_wddx_api.h
+++ b/ext/wddx/php_wddx_api.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_wddx_api.h,v 1.23.2.3.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_wddx_api.h,v 1.23.2.3.2.2 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_WDDX_API_H
#define PHP_WDDX_API_H
diff --git a/ext/wddx/tests/001-64bit.phpt b/ext/wddx/tests/001-64bit.phpt
new file mode 100644
index 000000000..78b1dc999
--- /dev/null
+++ b/ext/wddx/tests/001-64bit.phpt
@@ -0,0 +1,62 @@
+--TEST--
+wddx deserialization test (64-bit)
+--SKIPIF--
+<?php if (!extension_loaded("wddx")) print "skip"; ?>
+<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK" ?>
+--INI--
+precision=14
+--FILE--
+<?php
+ $path = dirname(__FILE__);
+ var_dump(wddx_deserialize(file_get_contents("{$path}/wddx.xml")));
+?>
+--EXPECT--
+array(11) {
+ ["aNull"]=>
+ NULL
+ ["aString"]=>
+ string(8) "a string"
+ ["aNumber"]=>
+ float(-12.456)
+ ["aDateTime"]=>
+ int(897625932)
+ ["aDateTime2"]=>
+ int(329632332)
+ ["aDateTime3"]=>
+ int(2223088332)
+ ["aBoolean"]=>
+ bool(true)
+ ["anArray"]=>
+ array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(14) "second element"
+ }
+ ["aBinary"]=>
+ string(11) "binary data"
+ ["anObject"]=>
+ array(2) {
+ ["s"]=>
+ string(8) "a string"
+ ["n"]=>
+ float(-12.456)
+ }
+ ["aRecordset"]=>
+ array(2) {
+ ["NAME"]=>
+ array(2) {
+ [0]=>
+ string(8) "John Doe"
+ [1]=>
+ string(8) "Jane Doe"
+ }
+ ["AGE"]=>
+ array(2) {
+ [0]=>
+ int(34)
+ [1]=>
+ int(31)
+ }
+ }
+}
diff --git a/ext/wddx/tests/001.phpt b/ext/wddx/tests/001.phpt
index 3efc0f4b0..e1aafd0ab 100644
--- a/ext/wddx/tests/001.phpt
+++ b/ext/wddx/tests/001.phpt
@@ -1,7 +1,8 @@
--TEST--
-wddx deserialization test
+wddx deserialization test (32-bit)
--SKIPIF--
<?php if (!extension_loaded("wddx")) print "skip"; ?>
+<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK" ?>
--INI--
precision=14
--FILE--
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 1476b1f00..fcd6c6072 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: wddx.c,v 1.119.2.10.2.17 2007/06/11 15:08:43 iliaa Exp $ */
+/* $Id: wddx.c,v 1.119.2.10.2.18 2007/12/31 07:20:14 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index 32f4cc806..7b4c90dbd 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
index 9200b1f0e..7eb3236b0 100644
--- a/ext/xml/expat_compat.h
+++ b/ext/xml/expat_compat.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: expat_compat.h,v 1.19.2.1.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: expat_compat.h,v 1.19.2.1.2.2 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_EXPAT_COMPAT_H
#define PHP_EXPAT_COMPAT_H
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
index f5c1b1e69..f975c21d5 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xml.h,v 1.28.2.2.2.3 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_xml.h,v 1.28.2.2.2.4 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_XML_H
#define PHP_XML_H
diff --git a/ext/xml/tests/bug43957.phpt b/ext/xml/tests/bug43957.phpt
new file mode 100644
index 000000000..34ddcd951
--- /dev/null
+++ b/ext/xml/tests/bug43957.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #43957 - utf8_decode() bogus conversion on multibyte indicator near end of string
+--SKIPIF--
+<?php
+require_once("skipif.inc");
+if (!extension_loaded('xml')) die ("skip xml extension not available");
+?>
+--FILE--
+<?php
+ echo utf8_decode('abc'.chr(0xe0));
+?>
+--EXPECTF--
+abc?
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 0c7ebf887..2fb994ddd 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml.c,v 1.157.2.4.2.5 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.8 2008/01/30 08:50:02 rasmus Exp $ */
#define IS_EXT_MODULE
@@ -579,15 +579,27 @@ PHPAPI char *xml_utf8_decode(const XML_Char *s, int len, int *newlen, const XML_
while (pos > 0) {
c = (unsigned char)(*s);
if (c >= 0xf0) { /* four bytes encoded, 21 bits */
- c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | (s[3]&63);
+ if(pos-4 >= 0) {
+ c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | (s[3]&63);
+ } else {
+ c = '?';
+ }
s += 4;
pos -= 4;
} else if (c >= 0xe0) { /* three bytes encoded, 16 bits */
- c = ((s[0]&63)<<12) | ((s[1]&63)<<6) | (s[2]&63);
+ if(pos-3 >= 0) {
+ c = ((s[0]&63)<<12) | ((s[1]&63)<<6) | (s[2]&63);
+ } else {
+ c = '?';
+ }
s += 3;
pos -= 3;
} else if (c >= 0xc0) { /* two bytes encoded, 11 bits */
- c = ((s[0]&63)<<6) | (s[1]&63);
+ if(pos-2 >= 0) {
+ c = ((s[0]&63)<<6) | (s[1]&63);
+ } else {
+ c = '?';
+ }
s += 2;
pos -= 2;
} else {
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index c31057002..c4b1c4711 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlreader.c,v 1.13.2.14.2.9 2007/09/20 09:30:45 rrichards Exp $ */
+/* $Id: php_xmlreader.c,v 1.13.2.14.2.10 2007/12/31 07:20:14 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h
index 9c38ab72c..485458e0e 100644
--- a/ext/xmlreader/php_xmlreader.h
+++ b/ext/xmlreader/php_xmlreader.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlreader.h,v 1.3.2.2.2.2 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_xmlreader.h,v 1.3.2.2.2.3 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_XMLREADER_H
#define PHP_XMLREADER_H
diff --git a/ext/xmlrpc/php_xmlrpc.h b/ext/xmlrpc/php_xmlrpc.h
index 257b55181..68aeb5b81 100644
--- a/ext/xmlrpc/php_xmlrpc.h
+++ b/ext/xmlrpc/php_xmlrpc.h
@@ -37,7 +37,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -51,7 +51,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlrpc.h,v 1.11.2.1.2.2 2007/01/12 12:32:15 tony2001 Exp $ */
+/* $Id: php_xmlrpc.h,v 1.11.2.1.2.3 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef _PHP_XMLRPC_H
#define _PHP_XMLRPC_H
diff --git a/ext/xmlrpc/tests/bug42736.phpt b/ext/xmlrpc/tests/bug42736.phpt
new file mode 100644
index 000000000..b9a46cff5
--- /dev/null
+++ b/ext/xmlrpc/tests/bug42736.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Bug #42736 (xmlrpc_server_call_method() crashes)
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+--FILE--
+<?php
+
+class SOAP_Array {
+ public function get($id){
+ return $this->add($id);
+ }
+}
+
+$xml = xmlrpc_server_create();
+
+$Myrequest = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>GetProducts</methodName><params><param><value><dateTime.iso8601>20060922T14:26:19</dateTime.iso8601></value></param></params></methodCall>';
+
+class MyClass {
+ function GetProducts($dummy, $time){
+ return array('faultString' => $time);
+ }
+}
+$myclass = new MyClass();
+xmlrpc_server_register_method($xml, 'GetProducts', array($myclass, 'GetProducts'));
+$response = xmlrpc_server_call_method($xml, $Myrequest, null);
+
+var_dump($response);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(402) "<?xml version="1.0" encoding="iso-8859-1"?>
+<methodResponse>
+<params>
+ <param>
+ <value>
+ <struct>
+ <member>
+ <name>faultString</name>
+ <value>
+ <array>
+ <data>
+ <value>
+ <dateTime.iso8601>20060922T14:26:19</dateTime.iso8601>
+ </value>
+ </data>
+ </array>
+ </value>
+ </member>
+ </struct>
+ </value>
+ </param>
+</params>
+</methodResponse>
+"
+Done
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index ca4e417d3..87b899469 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -37,7 +37,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -51,7 +51,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xmlrpc-epi-php.c,v 1.39.2.5.2.6 2007/09/18 19:49:53 iliaa Exp $ */
+/* $Id: xmlrpc-epi-php.c,v 1.39.2.5.2.8 2007/12/31 07:20:14 sebastian Exp $ */
/**********************************************************************
* BUGS: *
@@ -874,10 +874,9 @@ static XMLRPC_VALUE php_xmlrpc_callback(XMLRPC_SERVER server, XMLRPC_REQUEST xRe
pData->php_executed = 1;
- zval_dtor(xmlrpc_params);
- FREE_ZVAL(xmlrpc_params);
+ zval_ptr_dtor(&xmlrpc_params);
- return NULL;
+ return NULL;
}
/* called by the C server when it first receives an introspection request. We pass this on to
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 81fdf6225..b0bd71c37 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlwriter.c,v 1.20.2.12.2.16 2007/10/24 22:50:19 iliaa Exp $ */
+/* $Id: php_xmlwriter.c,v 1.20.2.12.2.17 2007/12/31 07:20:14 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/xmlwriter/php_xmlwriter.h b/ext/xmlwriter/php_xmlwriter.h
index d37ce7e44..9f54e5855 100644
--- a/ext/xmlwriter/php_xmlwriter.h
+++ b/ext/xmlwriter/php_xmlwriter.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlwriter.h,v 1.10.2.5.2.3 2007/01/01 09:36:10 sebastian Exp $ */
+/* $Id: php_xmlwriter.h,v 1.10.2.5.2.4 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_XMLWRITER_H
#define PHP_XMLWRITER_H
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 0c840060f..a7e5537f3 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xsl.c,v 1.32.2.6.2.2 2007/01/12 12:17:32 tony2001 Exp $ */
+/* $Id: php_xsl.c,v 1.32.2.6.2.3 2007/12/31 07:20:14 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h
index b94037904..a64ace360 100644
--- a/ext/xsl/php_xsl.h
+++ b/ext/xsl/php_xsl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xsl.h,v 1.15.2.1.2.1 2007/01/01 09:36:10 sebastian Exp $ */
+/* $Id: php_xsl.h,v 1.15.2.1.2.2 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_XSL_H
#define PHP_XSL_H
diff --git a/ext/xsl/xsl_fe.h b/ext/xsl/xsl_fe.h
index 1b6a30964..d7384b0ae 100644
--- a/ext/xsl/xsl_fe.h
+++ b/ext/xsl/xsl_fe.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xsl_fe.h,v 1.8.2.1.2.2 2007/10/06 21:35:53 tony2001 Exp $ */
+/* $Id: xsl_fe.h,v 1.8.2.1.2.3 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef XSL_FE_H
#define XSL_FE_H
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index c6a1b986e..dc9a370b8 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xsltprocessor.c,v 1.39.2.2.2.10 2007/10/06 21:35:53 tony2001 Exp $ */
+/* $Id: xsltprocessor.c,v 1.39.2.2.2.13 2008/01/29 21:21:28 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -27,6 +27,57 @@
#include "php_xsl.h"
#include "ext/libxml/php_libxml.h"
+/* {{{ arginfo */
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_import_stylesheet, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_transform_to_doc, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, doc, DOMNode, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_transform_to_uri, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
+ ZEND_ARG_INFO(0, uri)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_transform_to_xml, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_set_parameter, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespace)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_get_parameter, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespace)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_remove_parameter, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespace)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_has_exslt_support, 0, 0, 0)
+ZEND_END_ARG_INFO();
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xsl_xsltprocessor_register_php_functions, 0, 0, 0)
+ ZEND_ARG_INFO(0, restrict)
+ZEND_END_ARG_INFO();
+/* }}} */
+
/*
* class xsl_xsltprocessor
*
@@ -35,15 +86,15 @@
*/
zend_function_entry php_xsl_xsltprocessor_class_functions[] = {
- PHP_FALIAS(importStylesheet, xsl_xsltprocessor_import_stylesheet, NULL)
- PHP_FALIAS(transformToDoc, xsl_xsltprocessor_transform_to_doc, NULL)
- PHP_FALIAS(transformToUri, xsl_xsltprocessor_transform_to_uri, NULL)
- PHP_FALIAS(transformToXml, xsl_xsltprocessor_transform_to_xml, NULL)
- PHP_FALIAS(setParameter, xsl_xsltprocessor_set_parameter, NULL)
- PHP_FALIAS(getParameter, xsl_xsltprocessor_get_parameter, NULL)
- PHP_FALIAS(removeParameter, xsl_xsltprocessor_remove_parameter, NULL)
- PHP_FALIAS(hasExsltSupport, xsl_xsltprocessor_has_exslt_support, NULL)
- PHP_FALIAS(registerPHPFunctions, xsl_xsltprocessor_register_php_functions, NULL)
+ PHP_FALIAS(importStylesheet, xsl_xsltprocessor_import_stylesheet, arginfo_xsl_xsltprocessor_import_stylesheet)
+ PHP_FALIAS(transformToDoc, xsl_xsltprocessor_transform_to_doc, arginfo_xsl_xsltprocessor_transform_to_doc)
+ PHP_FALIAS(transformToUri, xsl_xsltprocessor_transform_to_uri, arginfo_xsl_xsltprocessor_transform_to_uri)
+ PHP_FALIAS(transformToXml, xsl_xsltprocessor_transform_to_xml, arginfo_xsl_xsltprocessor_transform_to_xml)
+ PHP_FALIAS(setParameter, xsl_xsltprocessor_set_parameter, arginfo_xsl_xsltprocessor_set_parameter)
+ PHP_FALIAS(getParameter, xsl_xsltprocessor_get_parameter, arginfo_xsl_xsltprocessor_get_parameter)
+ PHP_FALIAS(removeParameter, xsl_xsltprocessor_remove_parameter, arginfo_xsl_xsltprocessor_remove_parameter)
+ PHP_FALIAS(hasExsltSupport, xsl_xsltprocessor_has_exslt_support, arginfo_xsl_xsltprocessor_has_exslt_support)
+ PHP_FALIAS(registerPHPFunctions, xsl_xsltprocessor_register_php_functions, arginfo_xsl_xsltprocessor_register_php_functions)
{NULL, NULL, NULL}
};
@@ -723,7 +774,7 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter)
}
/* }}} end xsl_xsltprocessor_remove_parameter */
-/* {{{ proto void xsl_xsltprocessor_register_php_functions();
+/* {{{ proto void xsl_xsltprocessor_register_php_functions([mixed $restrict]);
*/
PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
{
diff --git a/ext/zip/Makefile.frag b/ext/zip/Makefile.frag
new file mode 100644
index 000000000..b3781e3e7
--- /dev/null
+++ b/ext/zip/Makefile.frag
@@ -0,0 +1,28 @@
+phpincludedir=$(prefix)/include/php
+
+ZIP_HEADER_FILES= \
+ zip.h \
+ zipint.h \
+ zip_alias.h \
+ zipint_alias.h
+
+install-zip-headers:
+ @echo "Installing ZIP headers: $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib"
+ @$(mkinstalldirs) $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib
+ @for f in $(ZIP_HEADER_FILES); do \
+ if test -f "$(top_srcdir)/lib/$$f"; then \
+ $(INSTALL_DATA) $(top_srcdir)/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \
+ elif test -f "$(top_builddir)/lib/$$f"; then \
+ $(INSTALL_DATA) $(top_builddir)/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \
+ elif test -f "$(top_srcdir)/ext/zip/lib/$$f"; then \
+ $(INSTALL_DATA) $(top_srcdir)/ext/zip/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \
+ elif test -f "$(top_builddir)/ext/zip/lib/$$f"; then \
+ $(INSTALL_DATA) $(top_builddir)/ext/zip/lib/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/zip/lib; \
+ else \
+ echo "hmmm"; \
+ fi \
+ done;
+
+# mini hack
+install: $(all_targets) $(install_targets) install-zip-headers
+
diff --git a/ext/zip/config.m4 b/ext/zip/config.m4
index c54eaac82..f31f260d9 100644
--- a/ext/zip/config.m4
+++ b/ext/zip/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.8.2.3 2007/07/03 17:25:35 sniper Exp $
+dnl $Id: config.m4,v 1.8.2.4 2008/01/18 00:31:23 cellog Exp $
dnl
PHP_ARG_ENABLE(zip, for zip archive read/writesupport,
@@ -66,4 +66,12 @@ if test "$PHP_ZIP" != "no"; then
PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
PHP_SUBST(ZIP_SHARED_LIBADD)
+ ifdef([PHP_INSTALL_HEADERS],
+ [
+ dnl Sadly, this is a complete NOP for pecl extensions
+ PHP_INSTALL_HEADERS(ext/zip/lib, [lib/zip.h lib/zipint.h lib/zip_alias.h lib/zipint_alias.h])
+ ])
+
+ dnl so we always include the known-good working hack.
+ PHP_ADD_MAKEFILE_FRAGMENT
fi
diff --git a/ext/zip/config.w32 b/ext/zip/config.w32
index a68e0505a..f0bc4c6db 100644
--- a/ext/zip/config.w32
+++ b/ext/zip/config.w32
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.1.2.1 2006/11/03 16:46:18 pajoye Exp $
+// $Id: config.w32,v 1.1.2.4 2008/01/14 03:19:41 cellog Exp $
// vim:ft=javascript
ARG_ENABLE("zip", "ZIP support", "no");
@@ -31,6 +31,7 @@ if (PHP_ZIP != "no") {
AC_DEFINE('HAVE_ZLIB', 1);
AC_DEFINE('HAVE_ZIP', 1);
+ ADD_FLAG("CFLAGS_ZIP", "/D PHP_ZIP_EXPORTS ");
} else {
WARNING("zip not enabled; libraries and headers not found");
}
diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h
index de115d38a..04ffb1471 100644
--- a/ext/zip/lib/zip.h
+++ b/ext/zip/lib/zip.h
@@ -5,7 +5,7 @@
$NiH: zip.h,v 1.57 2006/04/24 14:04:19 dillo Exp $
zip.h -- exported declarations.
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -37,16 +37,24 @@
*/
-
-#ifdef __cplusplus
-extern "C" {
+#include "main/php.h"
+/* #defines that rename all zip_ functions and structs */
+#include "zip_alias.h"
+#ifdef PHP_WIN32
+#include "zip_win32.h"
+# ifdef PHP_ZIP_EXPORTS
+# define PHPZIPAPI __declspec(dllexport)
+# else
+# define PHPZIPAPI
+# endif
+#else
+#define PHPZIPAPI
#endif
-
+BEGIN_EXTERN_C()
#include <sys/types.h>
#include <stdio.h>
#include <time.h>
-#include "zip_win32.h"
/* flags for zip_open */
@@ -162,49 +170,46 @@ struct zip_source;
-int zip_add(struct zip *, const char *, struct zip_source *);
-int zip_add_dir(struct zip *, const char *);
-int zip_close(struct zip *);
-int zip_delete(struct zip *, int);
-void zip_error_clear(struct zip *);
-void zip_error_get(struct zip *, int *, int *);
-int zip_error_get_sys_type(int);
-int zip_error_to_str(char *, size_t, int, int);
-int zip_fclose(struct zip_file *);
-void zip_file_error_clear(struct zip_file *);
-void zip_file_error_get(struct zip_file *, int *, int *);
-const char *zip_file_strerror(struct zip_file *);
-struct zip_file *zip_fopen(struct zip *, const char *, int);
-struct zip_file *zip_fopen_index(struct zip *, int, int);
-ssize_t zip_fread(struct zip_file *, void *, size_t);
-const char *zip_get_archive_comment(struct zip *, int *, int);
-const char *zip_get_file_comment(struct zip *, int, int *, int);
-const char *zip_get_name(struct zip *, int, int);
-int zip_get_num_files(struct zip *);
-int zip_name_locate(struct zip *, const char *, int);
-struct zip *zip_open(const char *, int, int *);
-int zip_rename(struct zip *, int, const char *);
-int zip_replace(struct zip *, int, struct zip_source *);
-int zip_set_archive_comment(struct zip *, const char *, int);
-int zip_set_file_comment(struct zip *, int, const char *, int);
-struct zip_source *zip_source_buffer(struct zip *, const void *, off_t, int);
-struct zip_source *zip_source_file(struct zip *, const char *, off_t, off_t);
-struct zip_source *zip_source_filep(struct zip *, FILE *, off_t, off_t);
-void zip_source_free(struct zip_source *);
-struct zip_source *zip_source_function(struct zip *,
+PHPZIPAPI int zip_add(struct zip *, const char *, struct zip_source *);
+PHPZIPAPI int zip_add_dir(struct zip *, const char *);
+PHPZIPAPI int zip_close(struct zip *);
+PHPZIPAPI int zip_delete(struct zip *, int);
+PHPZIPAPI void zip_error_clear(struct zip *);
+PHPZIPAPI void zip_error_get(struct zip *, int *, int *);
+PHPZIPAPI int zip_error_get_sys_type(int);
+PHPZIPAPI int zip_error_to_str(char *, size_t, int, int);
+PHPZIPAPI int zip_fclose(struct zip_file *);
+PHPZIPAPI void zip_file_error_clear(struct zip_file *);
+PHPZIPAPI void zip_file_error_get(struct zip_file *, int *, int *);
+PHPZIPAPI const char *zip_file_strerror(struct zip_file *);
+PHPZIPAPI struct zip_file *zip_fopen(struct zip *, const char *, int);
+PHPZIPAPI struct zip_file *zip_fopen_index(struct zip *, int, int);
+PHPZIPAPI ssize_t zip_fread(struct zip_file *, void *, size_t);
+PHPZIPAPI const char *zip_get_archive_comment(struct zip *, int *, int);
+PHPZIPAPI const char *zip_get_file_comment(struct zip *, int, int *, int);
+PHPZIPAPI const char *zip_get_name(struct zip *, int, int);
+PHPZIPAPI int zip_get_num_files(struct zip *);
+PHPZIPAPI int zip_name_locate(struct zip *, const char *, int);
+PHPZIPAPI struct zip *zip_open(const char *, int, int *);
+PHPZIPAPI int zip_rename(struct zip *, int, const char *);
+PHPZIPAPI int zip_replace(struct zip *, int, struct zip_source *);
+PHPZIPAPI int zip_set_archive_comment(struct zip *, const char *, int);
+PHPZIPAPI int zip_set_file_comment(struct zip *, int, const char *, int);
+PHPZIPAPI struct zip_source *zip_source_buffer(struct zip *, const void *, off_t, int);
+PHPZIPAPI struct zip_source *zip_source_file(struct zip *, const char *, off_t, off_t);
+PHPZIPAPI struct zip_source *zip_source_filep(struct zip *, FILE *, off_t, off_t);
+PHPZIPAPI void zip_source_free(struct zip_source *);
+PHPZIPAPI struct zip_source *zip_source_function(struct zip *,
zip_source_callback, void *);
-struct zip_source *zip_source_zip(struct zip *, struct zip *, int, int,
+PHPZIPAPI struct zip_source *zip_source_zip(struct zip *, struct zip *, int, int,
off_t, off_t);
-int zip_stat(struct zip *, const char *, int, struct zip_stat *);
-int zip_stat_index(struct zip *, int, int, struct zip_stat *);
-void zip_stat_init(struct zip_stat *);
-const char *zip_strerror(struct zip *);
-int zip_unchange(struct zip *, int);
-int zip_unchange_all(struct zip *);
-int zip_unchange_archive(struct zip *);
-
-#ifdef __cplusplus
-}
-#endif
-
+PHPZIPAPI int zip_stat(struct zip *, const char *, int, struct zip_stat *);
+PHPZIPAPI int zip_stat_index(struct zip *, int, int, struct zip_stat *);
+PHPZIPAPI void zip_stat_init(struct zip_stat *);
+PHPZIPAPI const char *zip_strerror(struct zip *);
+PHPZIPAPI int zip_unchange(struct zip *, int);
+PHPZIPAPI int zip_unchange_all(struct zip *);
+PHPZIPAPI int zip_unchange_archive(struct zip *);
+
+END_EXTERN_C();
#endif /* _HAD_ZIP_H */
diff --git a/ext/zip/lib/zip_add.c b/ext/zip/lib/zip_add.c
index 535d6e468..70d1162f7 100644
--- a/ext/zip/lib/zip_add.c
+++ b/ext/zip/lib/zip_add.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_add(struct zip *za, const char *name, struct zip_source *source)
{
if (name == NULL || source == NULL) {
diff --git a/ext/zip/lib/zip_add_dir.c b/ext/zip/lib/zip_add_dir.c
index 957aaf1d2..d4da559ec 100644
--- a/ext/zip/lib/zip_add_dir.c
+++ b/ext/zip/lib/zip_add_dir.c
@@ -2,7 +2,7 @@
$NiH: zip_add_dir.c,v 1.1 2006/10/03 12:23:13 dillo Exp $
zip_add_dir.c -- add directory
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -43,7 +43,7 @@
-int
+PHPZIPAPI int
zip_add_dir(struct zip *za, const char *name)
{
int len, ret;
diff --git a/ext/zip/lib/zip_alias.h b/ext/zip/lib/zip_alias.h
new file mode 100644
index 000000000..27a7b45df
--- /dev/null
+++ b/ext/zip/lib/zip_alias.h
@@ -0,0 +1,45 @@
+
+#define zip_source_cmd php_ziplib__zip_source_cmd
+#define zip_source_callback php_ziplib__zip_source_callback
+#define zip_stat php_ziplib__zip_stat
+#define zip php_ziplib__zip
+#define zip_file php_ziplib__zip_file
+#define zip_source php_ziplib__zip_source
+#define zip_add php_ziplib__zip_add
+#define zip_add_dir php_ziplib__zip_add_dir
+#define zip_close php_ziplib__zip_close
+#define zip_delete php_ziplib__zip_delete
+#define zip_error_clear php_ziplib__zip_error_clear
+#define zip_error_get php_ziplib__zip_error_get
+#define zip_error_get_sys_type php_ziplib__zip_error_get_sys_type
+#define zip_error_to_str php_ziplib__zip_error_to_str
+#define zip_fclose php_ziplib__zip_fclose
+#define zip_file_error_clear php_ziplib__zip_fille_error_clear
+#define zip_file_error_get php_ziplib__zip_file_error_get
+#define zip_file_strerror php_ziplib__zip_file_strerror
+#define zip_fopen php_ziplib__zip_fopen
+#define zip_fopen_index php_ziplib__zip_fopen_index
+#define zip_fread php_ziplib__zip_fread
+#define zip_get_archive_comment php_ziplib__zip_get_archive_comment
+#define zip_get_file_comment php_ziplib__zip_get_file_comment
+#define zip_get_name php_ziplib__zip_get_name
+#define zip_get_num_files php_ziplib__zip_get_num_files
+#define zip_name_locate php_ziplib__zip_name_locate
+#define zip_open php_ziplib__zip_open
+#define zip_rename php_ziplib__zip_rename
+#define zip_replace php_ziplib__zip_replace
+#define zip_set_archive_comment php_ziplib__zip_set_archive_comment
+#define zip_set_file_comment php_ziplib__zip_set_file_comment
+#define zip_source_buffer php_ziplib__zip_source_buffer
+#define zip_source_file php_ziplib__zip_source_file
+#define zip_source_filep php_ziplib__zip_source_filep
+#define zip_source_free php_ziplib__zip_source_free
+#define zip_source_function php_ziplib__zip_source_function
+#define zip_source_zip php_ziplib__zip_source_zip
+#define zip_stat php_ziplib__zip_stat
+#define zip_stat_index php_ziplib__zip_stat_index
+#define zip_stat_init php_ziplib__zip_stat_init
+#define zip_strerror php_ziplib__zip_strerror
+#define zip_unchange php_ziplib__zip_unchange
+#define zip_unchange_all php_ziplib__zip_unchange_all
+#define zip_unchange_archive php_ziplib__zip_unchange_archive
diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c
index e701321a8..11ba8e223 100644
--- a/ext/zip/lib/zip_close.c
+++ b/ext/zip/lib/zip_close.c
@@ -56,7 +56,7 @@ static int _zip_cdir_set_comment(struct zip_cdir *, struct zip *);
static int _zip_changed(struct zip *, int *);
static char *_zip_create_temp_output(struct zip *, FILE **);
-int
+PHPZIPAPI int
zip_close(struct zip *za)
{
int survivors;
diff --git a/ext/zip/lib/zip_delete.c b/ext/zip/lib/zip_delete.c
index 7244e612f..eb5055b68 100644
--- a/ext/zip/lib/zip_delete.c
+++ b/ext/zip/lib/zip_delete.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_delete(struct zip *za, int idx)
{
if (idx < 0 || idx >= za->nentry) {
diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c
index 8423ad534..f796f8d66 100644
--- a/ext/zip/lib/zip_dirent.c
+++ b/ext/zip/lib/zip_dirent.c
@@ -56,7 +56,7 @@ static void _zip_write4(unsigned int, FILE *);
-void
+PHPZIPAPI void
_zip_cdir_free(struct zip_cdir *cd)
{
int i;
@@ -73,7 +73,7 @@ _zip_cdir_free(struct zip_cdir *cd)
-struct zip_cdir *
+PHPZIPAPI struct zip_cdir *
_zip_cdir_new(int nentry, struct zip_error *error)
{
struct zip_cdir *cd;
@@ -102,7 +102,7 @@ _zip_cdir_new(int nentry, struct zip_error *error)
-int
+PHPZIPAPI int
_zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error)
{
int i;
@@ -136,7 +136,7 @@ _zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error)
-void
+PHPZIPAPI void
_zip_dirent_finalize(struct zip_dirent *zde)
{
free(zde->filename);
@@ -149,7 +149,7 @@ _zip_dirent_finalize(struct zip_dirent *zde)
-void
+PHPZIPAPI void
_zip_dirent_init(struct zip_dirent *de)
{
de->version_madeby = 0;
@@ -188,7 +188,7 @@ _zip_dirent_init(struct zip_dirent *de)
returned.
*/
-int
+PHPZIPAPI int
_zip_dirent_read(struct zip_dirent *zde, FILE *fp,
unsigned char **bufp, unsigned int left, int localp,
struct zip_error *error)
@@ -333,7 +333,7 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp,
returned.
*/
-int
+PHPZIPAPI int
_zip_dirent_write(struct zip_dirent *zde, FILE *fp, int localp,
struct zip_error *error)
{
@@ -409,7 +409,7 @@ _zip_d2u_time(int dtime, int ddate)
-unsigned short
+PHPZIPAPI unsigned short
_zip_read2(unsigned char **a)
{
unsigned short ret;
@@ -422,7 +422,7 @@ _zip_read2(unsigned char **a)
-unsigned int
+PHPZIPAPI unsigned int
_zip_read4(unsigned char **a)
{
unsigned int ret;
diff --git a/ext/zip/lib/zip_entry_free.c b/ext/zip/lib/zip_entry_free.c
index 48443cefd..1bab313ed 100644
--- a/ext/zip/lib/zip_entry_free.c
+++ b/ext/zip/lib/zip_entry_free.c
@@ -42,7 +42,7 @@
-void
+PHPZIPAPI void
_zip_entry_free(struct zip_entry *ze)
{
free(ze->ch_filename);
diff --git a/ext/zip/lib/zip_entry_new.c b/ext/zip/lib/zip_entry_new.c
index 390b72ad7..67e13fd84 100644
--- a/ext/zip/lib/zip_entry_new.c
+++ b/ext/zip/lib/zip_entry_new.c
@@ -42,7 +42,7 @@
-struct zip_entry *
+PHPZIPAPI struct zip_entry *
_zip_entry_new(struct zip *za)
{
struct zip_entry *ze;
diff --git a/ext/zip/lib/zip_error.c b/ext/zip/lib/zip_error.c
index aec1638de..4816b73ae 100644
--- a/ext/zip/lib/zip_error.c
+++ b/ext/zip/lib/zip_error.c
@@ -2,7 +2,7 @@
$NiH: zip_error.c,v 1.7 2005/06/09 19:57:09 dillo Exp $
zip_error.c -- struct zip_error helper functions
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -42,7 +42,7 @@
-void
+PHPZIPAPI void
_zip_error_clear(struct zip_error *err)
{
err->zip_err = ZIP_ER_OK;
@@ -51,7 +51,7 @@ _zip_error_clear(struct zip_error *err)
-void
+PHPZIPAPI void
_zip_error_copy(struct zip_error *dst, struct zip_error *src)
{
dst->zip_err = src->zip_err;
@@ -60,7 +60,7 @@ _zip_error_copy(struct zip_error *dst, struct zip_error *src)
-void
+PHPZIPAPI void
_zip_error_fini(struct zip_error *err)
{
free(err->str);
@@ -69,7 +69,7 @@ _zip_error_fini(struct zip_error *err)
-void
+PHPZIPAPI void
_zip_error_get(struct zip_error *err, int *zep, int *sep)
{
if (zep)
@@ -84,7 +84,7 @@ _zip_error_get(struct zip_error *err, int *zep, int *sep)
-void
+PHPZIPAPI void
_zip_error_init(struct zip_error *err)
{
err->zip_err = ZIP_ER_OK;
@@ -94,7 +94,7 @@ _zip_error_init(struct zip_error *err)
-void
+PHPZIPAPI void
_zip_error_set(struct zip_error *err, int ze, int se)
{
if (err) {
diff --git a/ext/zip/lib/zip_error_clear.c b/ext/zip/lib/zip_error_clear.c
index e3c81eb31..8a76f4440 100644
--- a/ext/zip/lib/zip_error_clear.c
+++ b/ext/zip/lib/zip_error_clear.c
@@ -2,7 +2,7 @@
$NiH: zip_error_clear.c,v 1.1 2006/10/04 15:21:09 dillo Exp $
zip_error_clear.c -- clear zip error
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -40,7 +40,7 @@
-void
+PHPZIPAPI void
zip_error_clear(struct zip *za)
{
_zip_error_clear(&za->error);
diff --git a/ext/zip/lib/zip_error_get.c b/ext/zip/lib/zip_error_get.c
index 712575a86..888b54569 100644
--- a/ext/zip/lib/zip_error_get.c
+++ b/ext/zip/lib/zip_error_get.c
@@ -40,7 +40,7 @@
-void
+PHPZIPAPI void
zip_error_get(struct zip *za, int *zep, int *sep)
{
_zip_error_get(&za->error, zep, sep);
diff --git a/ext/zip/lib/zip_error_get_sys_type.c b/ext/zip/lib/zip_error_get_sys_type.c
index 613ec9432..bfe642383 100644
--- a/ext/zip/lib/zip_error_get_sys_type.c
+++ b/ext/zip/lib/zip_error_get_sys_type.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_error_get_sys_type(int ze)
{
if (ze < 0 || ze >= _zip_nerr_str)
diff --git a/ext/zip/lib/zip_error_strerror.c b/ext/zip/lib/zip_error_strerror.c
index e6eee081d..06e98c76d 100644
--- a/ext/zip/lib/zip_error_strerror.c
+++ b/ext/zip/lib/zip_error_strerror.c
@@ -45,7 +45,7 @@
-const char *
+PHPZIPAPI const char *
_zip_error_strerror(struct zip_error *err)
{
const char *zs, *ss;
diff --git a/ext/zip/lib/zip_error_to_str.c b/ext/zip/lib/zip_error_to_str.c
index e56619225..665803472 100644
--- a/ext/zip/lib/zip_error_to_str.c
+++ b/ext/zip/lib/zip_error_to_str.c
@@ -45,7 +45,7 @@
-int
+PHPZIPAPI int
zip_error_to_str(char *buf, size_t len, int ze, int se)
{
const char *zs, *ss;
diff --git a/ext/zip/lib/zip_fclose.c b/ext/zip/lib/zip_fclose.c
index c0105a929..91f30b7bb 100644
--- a/ext/zip/lib/zip_fclose.c
+++ b/ext/zip/lib/zip_fclose.c
@@ -42,7 +42,7 @@
-int
+PHPZIPAPI int
zip_fclose(struct zip_file *zf)
{
int i, ret;
diff --git a/ext/zip/lib/zip_file_error_clear.c b/ext/zip/lib/zip_file_error_clear.c
index 86ed68f27..dca33b35f 100644
--- a/ext/zip/lib/zip_file_error_clear.c
+++ b/ext/zip/lib/zip_file_error_clear.c
@@ -2,7 +2,7 @@
$NiH: zip_file_error_clear.c,v 1.4 2006/10/04 18:37:54 wiz Exp $
zip_file_error_clear.c -- clear zip file error
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -40,7 +40,7 @@
-void
+PHPZIPAPI void
zip_file_error_clear(struct zip_file *zf)
{
_zip_error_clear(&zf->error);
diff --git a/ext/zip/lib/zip_file_error_get.c b/ext/zip/lib/zip_file_error_get.c
index 2ab3a73a4..05516703c 100644
--- a/ext/zip/lib/zip_file_error_get.c
+++ b/ext/zip/lib/zip_file_error_get.c
@@ -40,7 +40,7 @@
-void
+PHPZIPAPI void
zip_file_error_get(struct zip_file *zf, int *zep, int *sep)
{
_zip_error_get(&zf->error, zep, sep);
diff --git a/ext/zip/lib/zip_file_get_offset.c b/ext/zip/lib/zip_file_get_offset.c
index 8bcc64934..493004023 100644
--- a/ext/zip/lib/zip_file_get_offset.c
+++ b/ext/zip/lib/zip_file_get_offset.c
@@ -56,7 +56,7 @@
On error, fills in za->error and returns 0.
*/
-unsigned int
+PHPZIPAPI unsigned int
_zip_file_get_offset(struct zip *za, int idx)
{
struct zip_dirent de;
diff --git a/ext/zip/lib/zip_file_strerror.c b/ext/zip/lib/zip_file_strerror.c
index aaff18999..2cc79c133 100644
--- a/ext/zip/lib/zip_file_strerror.c
+++ b/ext/zip/lib/zip_file_strerror.c
@@ -40,7 +40,7 @@
-const char *
+PHPZIPAPI const char *
zip_file_strerror(struct zip_file *zf)
{
return _zip_error_strerror(&zf->error);
diff --git a/ext/zip/lib/zip_fopen.c b/ext/zip/lib/zip_fopen.c
index 850a8d835..c05ad45bd 100644
--- a/ext/zip/lib/zip_fopen.c
+++ b/ext/zip/lib/zip_fopen.c
@@ -40,7 +40,7 @@
-struct zip_file *
+PHPZIPAPI struct zip_file *
zip_fopen(struct zip *za, const char *fname, int flags)
{
int idx;
diff --git a/ext/zip/lib/zip_fopen_index.c b/ext/zip/lib/zip_fopen_index.c
index 5da9230b2..105cefe73 100644
--- a/ext/zip/lib/zip_fopen_index.c
+++ b/ext/zip/lib/zip_fopen_index.c
@@ -46,7 +46,7 @@ static struct zip_file *_zip_file_new(struct zip *za);
-struct zip_file *
+PHPZIPAPI struct zip_file *
zip_fopen_index(struct zip *za, int fileno, int flags)
{
int len, ret;
@@ -141,7 +141,7 @@ zip_fopen_index(struct zip *za, int fileno, int flags)
-int
+PHPZIPAPI int
_zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zf)
{
int i, j;
diff --git a/ext/zip/lib/zip_fread.c b/ext/zip/lib/zip_fread.c
index aeb64c90f..064d2b97f 100644
--- a/ext/zip/lib/zip_fread.c
+++ b/ext/zip/lib/zip_fread.c
@@ -40,7 +40,7 @@
-ssize_t
+PHPZIPAPI ssize_t
zip_fread(struct zip_file *zf, void *outbuf, size_t toread)
{
int ret;
diff --git a/ext/zip/lib/zip_free.c b/ext/zip/lib/zip_free.c
index c78697d25..534c58eb0 100644
--- a/ext/zip/lib/zip_free.c
+++ b/ext/zip/lib/zip_free.c
@@ -45,7 +45,7 @@
frees the space allocated to a zipfile struct, and closes the
corresponding file. */
-void
+PHPZIPAPI void
_zip_free(struct zip *za)
{
int i;
diff --git a/ext/zip/lib/zip_get_archive_comment.c b/ext/zip/lib/zip_get_archive_comment.c
index 7844c5e19..c23597c09 100644
--- a/ext/zip/lib/zip_get_archive_comment.c
+++ b/ext/zip/lib/zip_get_archive_comment.c
@@ -40,7 +40,7 @@
-const char *
+PHPZIPAPI const char *
zip_get_archive_comment(struct zip *za, int *lenp, int flags)
{
if ((flags & ZIP_FL_UNCHANGED)
diff --git a/ext/zip/lib/zip_get_file_comment.c b/ext/zip/lib/zip_get_file_comment.c
index 79a5c236b..476ac7da0 100644
--- a/ext/zip/lib/zip_get_file_comment.c
+++ b/ext/zip/lib/zip_get_file_comment.c
@@ -40,7 +40,7 @@
-const char *
+PHPZIPAPI const char *
zip_get_file_comment(struct zip *za, int idx, int *lenp, int flags)
{
if (idx < 0 || idx >= za->nentry) {
diff --git a/ext/zip/lib/zip_get_name.c b/ext/zip/lib/zip_get_name.c
index c45dd0333..c2cae2518 100644
--- a/ext/zip/lib/zip_get_name.c
+++ b/ext/zip/lib/zip_get_name.c
@@ -40,7 +40,7 @@
-const char *
+PHPZIPAPI const char *
zip_get_name(struct zip *za, int idx, int flags)
{
return _zip_get_name(za, idx, flags, &za->error);
@@ -48,7 +48,7 @@ zip_get_name(struct zip *za, int idx, int flags)
-const char *
+PHPZIPAPI const char *
_zip_get_name(struct zip *za, int idx, int flags, struct zip_error *error)
{
if (idx < 0 || idx >= za->nentry) {
diff --git a/ext/zip/lib/zip_get_num_files.c b/ext/zip/lib/zip_get_num_files.c
index 0cc81edb0..05a54fcb6 100644
--- a/ext/zip/lib/zip_get_num_files.c
+++ b/ext/zip/lib/zip_get_num_files.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_get_num_files(struct zip *za)
{
if (za == NULL)
diff --git a/ext/zip/lib/zip_memdup.c b/ext/zip/lib/zip_memdup.c
index c4ecf4a69..ebb7426dd 100644
--- a/ext/zip/lib/zip_memdup.c
+++ b/ext/zip/lib/zip_memdup.c
@@ -41,7 +41,7 @@
-void *
+PHPZIPAPI void *
_zip_memdup(const void *mem, size_t len, struct zip_error *error)
{
void *ret;
diff --git a/ext/zip/lib/zip_name_locate.c b/ext/zip/lib/zip_name_locate.c
index a2fce2d03..108db4f60 100644
--- a/ext/zip/lib/zip_name_locate.c
+++ b/ext/zip/lib/zip_name_locate.c
@@ -42,7 +42,7 @@
-int
+PHPZIPAPI int
zip_name_locate(struct zip *za, const char *fname, int flags)
{
return _zip_name_locate(za, fname, flags, &za->error);
@@ -50,7 +50,7 @@ zip_name_locate(struct zip *za, const char *fname, int flags)
-int
+PHPZIPAPI int
_zip_name_locate(struct zip *za, const char *fname, int flags,
struct zip_error *error)
{
@@ -62,8 +62,11 @@ _zip_name_locate(struct zip *za, const char *fname, int flags,
_zip_error_set(error, ZIP_ER_INVAL, 0);
return -1;
}
-
- cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp;
+#ifdef PHP_WIN32
+ cmp = (flags & ZIP_FL_NOCASE) ? stricmp : strcmp;
+#else
+ cmp = (flags & ZIP_FL_NOCASE) ? strcasecmp : strcmp;
+#endif
n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry;
for (i=0; i<n; i++) {
diff --git a/ext/zip/lib/zip_new.c b/ext/zip/lib/zip_new.c
index 660183a15..378513b6c 100644
--- a/ext/zip/lib/zip_new.c
+++ b/ext/zip/lib/zip_new.c
@@ -45,7 +45,7 @@
creates a new zipfile struct, and sets the contents to zero; returns
the new struct. */
-struct zip *
+PHPZIPAPI struct zip *
_zip_new(struct zip_error *error)
{
struct zip *za;
diff --git a/ext/zip/lib/zip_open.c b/ext/zip/lib/zip_open.c
index 60526e8c9..711dcb1ca 100644
--- a/ext/zip/lib/zip_open.c
+++ b/ext/zip/lib/zip_open.c
@@ -2,7 +2,7 @@
$NiH: zip_open.c,v 1.38 2006/05/04 00:01:26 dillo Exp $
zip_open.c -- open zip archive
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -58,7 +58,7 @@ static struct zip_cdir *_zip_readcdir(FILE *, unsigned char *, unsigned char *,
-struct zip *
+PHPZIPAPI struct zip *
zip_open(const char *fn, int flags, int *zep)
{
FILE *fp;
diff --git a/ext/zip/lib/zip_rename.c b/ext/zip/lib/zip_rename.c
index f35291893..8141dc46a 100644
--- a/ext/zip/lib/zip_rename.c
+++ b/ext/zip/lib/zip_rename.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_rename(struct zip *za, int idx, const char *name)
{
if (idx >= za->nentry || idx < 0) {
diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c
index ae78e62b8..12db005f2 100644
--- a/ext/zip/lib/zip_replace.c
+++ b/ext/zip/lib/zip_replace.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_replace(struct zip *za, int idx, struct zip_source *source)
{
if (idx < 0 || idx >= za->nentry || source == NULL) {
@@ -57,7 +57,7 @@ zip_replace(struct zip *za, int idx, struct zip_source *source)
-int
+PHPZIPAPI int
_zip_replace(struct zip *za, int idx, const char *name,
struct zip_source *source)
{
diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c
index b0929e56b..7649a80de 100644
--- a/ext/zip/lib/zip_set_archive_comment.c
+++ b/ext/zip/lib/zip_set_archive_comment.c
@@ -42,7 +42,7 @@
-int
+PHPZIPAPI int
zip_set_archive_comment(struct zip *za, const char *comment, int len)
{
char *tmpcom;
diff --git a/ext/zip/lib/zip_set_file_comment.c b/ext/zip/lib/zip_set_file_comment.c
index cbf71db5c..5454aa21d 100644
--- a/ext/zip/lib/zip_set_file_comment.c
+++ b/ext/zip/lib/zip_set_file_comment.c
@@ -42,7 +42,7 @@
-int
+PHPZIPAPI int
zip_set_file_comment(struct zip *za, int idx, const char *comment, int len)
{
char *tmpcom;
diff --git a/ext/zip/lib/zip_set_name.c b/ext/zip/lib/zip_set_name.c
index 46dca5646..8a401faac 100644
--- a/ext/zip/lib/zip_set_name.c
+++ b/ext/zip/lib/zip_set_name.c
@@ -42,7 +42,7 @@
-int
+PHPZIPAPI int
_zip_set_name(struct zip *za, int idx, const char *name)
{
char *s;
diff --git a/ext/zip/lib/zip_source_buffer.c b/ext/zip/lib/zip_source_buffer.c
index a01f18d3f..95875b74c 100644
--- a/ext/zip/lib/zip_source_buffer.c
+++ b/ext/zip/lib/zip_source_buffer.c
@@ -2,7 +2,7 @@
$NiH: zip_source_buffer.c,v 1.8 2006/04/23 14:50:49 wiz Exp $
zip_source_buffer.c -- create zip data source from buffer
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -52,7 +52,7 @@ static ssize_t read_data(void *state, void *data, size_t len,
-struct zip_source *
+PHPZIPAPI struct zip_source *
zip_source_buffer(struct zip *za, const void *data, off_t len, int freep)
{
struct read_data *f;
diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c
index d635da342..486e1900d 100644
--- a/ext/zip/lib/zip_source_file.c
+++ b/ext/zip/lib/zip_source_file.c
@@ -43,7 +43,7 @@
-struct zip_source *
+PHPZIPAPI struct zip_source *
zip_source_file(struct zip *za, const char *fname, off_t start, off_t len)
{
struct zip_source *zs;
diff --git a/ext/zip/lib/zip_source_filep.c b/ext/zip/lib/zip_source_filep.c
index efc702686..8a3304265 100644
--- a/ext/zip/lib/zip_source_filep.c
+++ b/ext/zip/lib/zip_source_filep.c
@@ -2,7 +2,7 @@
$NiH: zip_source_filep.c,v 1.6 2005/06/09 19:57:10 dillo Exp $
zip_source_filep.c -- create data source from FILE *
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
@@ -57,7 +57,7 @@ static ssize_t read_file(void *state, void *data, size_t len,
-struct zip_source *
+PHPZIPAPI struct zip_source *
zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len)
{
struct read_file *f;
diff --git a/ext/zip/lib/zip_source_free.c b/ext/zip/lib/zip_source_free.c
index 33e36eaf4..707309c91 100644
--- a/ext/zip/lib/zip_source_free.c
+++ b/ext/zip/lib/zip_source_free.c
@@ -42,7 +42,7 @@
-void
+PHPZIPAPI void
zip_source_free(struct zip_source *source)
{
if (source == NULL)
diff --git a/ext/zip/lib/zip_source_function.c b/ext/zip/lib/zip_source_function.c
index 4f01a43c5..4ab110924 100644
--- a/ext/zip/lib/zip_source_function.c
+++ b/ext/zip/lib/zip_source_function.c
@@ -42,7 +42,7 @@
-struct zip_source *
+PHPZIPAPI struct zip_source *
zip_source_function(struct zip *za, zip_source_callback zcb, void *ud)
{
struct zip_source *zs;
diff --git a/ext/zip/lib/zip_source_zip.c b/ext/zip/lib/zip_source_zip.c
index a31fd2787..75e656402 100644
--- a/ext/zip/lib/zip_source_zip.c
+++ b/ext/zip/lib/zip_source_zip.c
@@ -52,7 +52,7 @@ static ssize_t read_zip(void *st, void *data, size_t len,
-struct zip_source *
+PHPZIPAPI struct zip_source *
zip_source_zip(struct zip *za, struct zip *srcza, int srcidx, int flags,
off_t start, off_t len)
{
diff --git a/ext/zip/lib/zip_stat.c b/ext/zip/lib/zip_stat.c
index bea153d15..7c6cbf00d 100644
--- a/ext/zip/lib/zip_stat.c
+++ b/ext/zip/lib/zip_stat.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_stat(struct zip *za, const char *fname, int flags, struct zip_stat *st)
{
int idx;
diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c
index bab79a74b..cf55565ef 100644
--- a/ext/zip/lib/zip_stat_index.c
+++ b/ext/zip/lib/zip_stat_index.c
@@ -40,7 +40,7 @@
-int
+PHPZIPAPI int
zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st)
{
const char *name;
diff --git a/ext/zip/lib/zip_stat_init.c b/ext/zip/lib/zip_stat_init.c
index 7ab0f4da7..e9c056dfc 100644
--- a/ext/zip/lib/zip_stat_init.c
+++ b/ext/zip/lib/zip_stat_init.c
@@ -39,7 +39,7 @@
-void
+PHPZIPAPI void
zip_stat_init(struct zip_stat *st)
{
st->name = NULL;
diff --git a/ext/zip/lib/zip_strerror.c b/ext/zip/lib/zip_strerror.c
index 83e298506..f3e5aa9fe 100644
--- a/ext/zip/lib/zip_strerror.c
+++ b/ext/zip/lib/zip_strerror.c
@@ -40,7 +40,7 @@
-const char *
+PHPZIPAPI const char *
zip_strerror(struct zip *za)
{
return _zip_error_strerror(&za->error);
diff --git a/ext/zip/lib/zip_unchange.c b/ext/zip/lib/zip_unchange.c
index 34e7f2d36..80070e7a3 100644
--- a/ext/zip/lib/zip_unchange.c
+++ b/ext/zip/lib/zip_unchange.c
@@ -41,7 +41,7 @@
-int
+PHPZIPAPI int
zip_unchange(struct zip *za, int idx)
{
return _zip_unchange(za, idx, 0);
@@ -49,7 +49,7 @@ zip_unchange(struct zip *za, int idx)
-int
+PHPZIPAPI int
_zip_unchange(struct zip *za, int idx, int allow_duplicates)
{
int i;
diff --git a/ext/zip/lib/zip_unchange_all.c b/ext/zip/lib/zip_unchange_all.c
index f1e27da04..2d4459c82 100644
--- a/ext/zip/lib/zip_unchange_all.c
+++ b/ext/zip/lib/zip_unchange_all.c
@@ -41,7 +41,7 @@
-int
+PHPZIPAPI int
zip_unchange_all(struct zip *za)
{
int ret, i;
diff --git a/ext/zip/lib/zip_unchange_archive.c b/ext/zip/lib/zip_unchange_archive.c
index 7418aaf6a..6c2bc6dcb 100644
--- a/ext/zip/lib/zip_unchange_archive.c
+++ b/ext/zip/lib/zip_unchange_archive.c
@@ -41,7 +41,7 @@
-int
+PHPZIPAPI int
zip_unchange_archive(struct zip *za)
{
free(za->ch_comment);
diff --git a/ext/zip/lib/zip_unchange_data.c b/ext/zip/lib/zip_unchange_data.c
index 252676926..dfa2ea545 100644
--- a/ext/zip/lib/zip_unchange_data.c
+++ b/ext/zip/lib/zip_unchange_data.c
@@ -39,7 +39,7 @@
#include "zipint.h"
-void
+PHPZIPAPI void
_zip_unchange_data(struct zip_entry *ze)
{
if (ze->source) {
diff --git a/ext/zip/lib/zip_win32.h b/ext/zip/lib/zip_win32.h
index a33347ba0..ea3860d60 100644
--- a/ext/zip/lib/zip_win32.h
+++ b/ext/zip/lib/zip_win32.h
@@ -1,6 +1,3 @@
-
-#ifdef _MSC_VER
-
#define _POSIX_
#include <windows.h>
#include <io.h>
@@ -12,9 +9,6 @@
#ifndef mode_t
# define mode_t int
#endif
-#ifndef strcasecmp
-# define strcasecmp stricmp
-#endif
#ifndef snprintf
# define snprintf _snprintf
#endif
@@ -26,4 +20,3 @@
# define fseeko fseek
#endif
*/
-#endif
diff --git a/ext/zip/lib/zipint.h b/ext/zip/lib/zipint.h
index ebf2743f9..33632aca4 100644
--- a/ext/zip/lib/zipint.h
+++ b/ext/zip/lib/zipint.h
@@ -39,6 +39,10 @@
#include <zlib.h>
#include "zip.h"
+/* #defines that rename all zip_ functions and structs */
+#include "zipint_alias.h"
+
+BEGIN_EXTERN_C()
#ifndef HAVE_FSEEKO
#define fseeko(s, o, w) (fseek((s), (long int)(o), (w)))
#endif
@@ -185,42 +189,43 @@ extern const int _zip_err_type[];
-void _zip_cdir_free(struct zip_cdir *);
-struct zip_cdir *_zip_cdir_new(int, struct zip_error *);
-int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *);
+PHPZIPAPI void _zip_cdir_free(struct zip_cdir *);
+PHPZIPAPI struct zip_cdir *_zip_cdir_new(int, struct zip_error *);
+PHPZIPAPI int _zip_cdir_write(struct zip_cdir *, FILE *, struct zip_error *);
-void _zip_dirent_finalize(struct zip_dirent *);
-void _zip_dirent_init(struct zip_dirent *);
-int _zip_dirent_read(struct zip_dirent *, FILE *,
+PHPZIPAPI void _zip_dirent_finalize(struct zip_dirent *);
+PHPZIPAPI void _zip_dirent_init(struct zip_dirent *);
+PHPZIPAPI int _zip_dirent_read(struct zip_dirent *, FILE *,
unsigned char **, unsigned int, int, struct zip_error *);
-int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *);
-
-void _zip_entry_free(struct zip_entry *);
-void _zip_entry_init(struct zip *, int);
-struct zip_entry *_zip_entry_new(struct zip *);
-
-void _zip_error_clear(struct zip_error *);
-void _zip_error_copy(struct zip_error *, struct zip_error *);
-void _zip_error_fini(struct zip_error *);
-void _zip_error_get(struct zip_error *, int *, int *);
-void _zip_error_init(struct zip_error *);
-void _zip_error_set(struct zip_error *, int, int);
-const char *_zip_error_strerror(struct zip_error *);
-
-int _zip_file_fillbuf(void *, size_t, struct zip_file *);
-unsigned int _zip_file_get_offset(struct zip *, int);
-
-void _zip_free(struct zip *);
-const char *_zip_get_name(struct zip *, int, int, struct zip_error *);
-int _zip_local_header_read(struct zip *, int);
-void *_zip_memdup(const void *, size_t, struct zip_error *);
-int _zip_name_locate(struct zip *, const char *, int, struct zip_error *);
-struct zip *_zip_new(struct zip_error *);
-unsigned short _zip_read2(unsigned char **);
-unsigned int _zip_read4(unsigned char **);
-int _zip_replace(struct zip *, int, const char *, struct zip_source *);
-int _zip_set_name(struct zip *, int, const char *);
-int _zip_unchange(struct zip *, int, int);
-void _zip_unchange_data(struct zip_entry *);
-
+PHPZIPAPI int _zip_dirent_write(struct zip_dirent *, FILE *, int, struct zip_error *);
+
+PHPZIPAPI void _zip_entry_free(struct zip_entry *);
+PHPZIPAPI void _zip_entry_init(struct zip *, int);
+PHPZIPAPI struct zip_entry *_zip_entry_new(struct zip *);
+
+PHPZIPAPI void _zip_error_clear(struct zip_error *);
+PHPZIPAPI void _zip_error_copy(struct zip_error *, struct zip_error *);
+PHPZIPAPI void _zip_error_fini(struct zip_error *);
+PHPZIPAPI void _zip_error_get(struct zip_error *, int *, int *);
+PHPZIPAPI void _zip_error_init(struct zip_error *);
+PHPZIPAPI void _zip_error_set(struct zip_error *, int, int);
+PHPZIPAPI const char *_zip_error_strerror(struct zip_error *);
+
+PHPZIPAPI int _zip_file_fillbuf(void *, size_t, struct zip_file *);
+PHPZIPAPI unsigned int _zip_file_get_offset(struct zip *, int);
+
+PHPZIPAPI void _zip_free(struct zip *);
+PHPZIPAPI const char *_zip_get_name(struct zip *, int, int, struct zip_error *);
+PHPZIPAPI int _zip_local_header_read(struct zip *, int);
+PHPZIPAPI void *_zip_memdup(const void *, size_t, struct zip_error *);
+PHPZIPAPI int _zip_name_locate(struct zip *, const char *, int, struct zip_error *);
+PHPZIPAPI struct zip *_zip_new(struct zip_error *);
+PHPZIPAPI unsigned short _zip_read2(unsigned char **);
+PHPZIPAPI unsigned int _zip_read4(unsigned char **);
+PHPZIPAPI int _zip_replace(struct zip *, int, const char *, struct zip_source *);
+PHPZIPAPI int _zip_set_name(struct zip *, int, const char *);
+PHPZIPAPI int _zip_unchange(struct zip *, int, int);
+PHPZIPAPI void _zip_unchange_data(struct zip_entry *);
+
+END_EXTERN_C();
#endif /* zipint.h */
diff --git a/ext/zip/lib/zipint_alias.h b/ext/zip/lib/zipint_alias.h
new file mode 100644
index 000000000..e8541b36e
--- /dev/null
+++ b/ext/zip/lib/zipint_alias.h
@@ -0,0 +1,49 @@
+
+/* state of change of a file in zip archive */
+#define zip_state php_ziplib__zip_state
+#define zip_error php_ziplib__zip_error
+#define zip_dirent php_ziplib__zip_dirent
+#define zip_cdir php_ziplib__zip_cdir
+#define zip_source php_ziplib__zip_source
+#define zip_entry php_ziplib__zip_entry
+
+#define _zip_err_str php_ziplib___zip_err_str
+#define _zip_nerr_str php_ziplib___zip_nerr_str
+#define _zip_err_type php_ziplib___zip_err_type
+
+#define _zip_cdir_free php_ziplib___zip_cdir_free
+#define _zip_cdir_new php_ziplib___zip_cdir_new
+#define _zip_cdir_write php_ziplib___zip_cdir_write
+
+#define _zip_dirent_finalize php_ziplib___zip_dirent_finalize
+#define _zip_dirent_init php_ziplib___zip_dirent_init
+#define _zip_dirent_read php_ziplib___zip_dirent_read
+#define _zip_dirent_write php_ziplib___zip_dirent_write
+
+#define _zip_entry_free php_ziplib___zip_entry_free
+#define _zip_entry_init php_ziplib___zip_entry_init
+#define _zip_entry_new php_ziplib___zip_entry_new
+
+#define _zip_error_clear php_ziplib___zip_error_clear
+#define _zip_error_copy php_ziplib___zip_error_copy
+#define _zip_error_fini php_ziplib___zip_error_fini
+#define _zip_error_get php_ziplib___zip_error_get
+#define _zip_error_init php_ziplib___zip_error_init
+#define _zip_error_set php_ziplib___zip_error_set
+#define _zip_error_strerror php_ziplib___zip_error_strerror
+
+#define _zip_file_fillbuf php_ziplib___zip_file_fillbuf
+#define _zip_file_get_offset php_ziplib___zip_file_get_offset
+
+#define _zip_free php_ziplib___zip_free
+#define _zip_get_name php_ziplib___zip_get_name
+#define _zip_local_header_read php_ziplib___zip_local_header_read
+#define _zip_memdup php_ziplib___zip_memdup
+#define _zip_name_locate php_ziplib___zip_name_locate
+#define _zip_new php_ziplib___zip_new
+#define _zip_read2 php_ziplib___zip_read2
+#define _zip_read4 php_ziplib___zip_read4
+#define _zip_replace php_ziplib___zip_replace
+#define _zip_set_name php_ziplib___zip_set_name
+#define _zip_unchange php_ziplib___zip_unchange
+#define _zip_unchange_data php_ziplib___zip_unchange_data
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 6f27fe950..b066a211c 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zip.c,v 1.1.2.38 2007/08/06 22:02:32 bjori Exp $ */
+/* $Id: php_zip.c,v 1.1.2.43 2008/01/18 00:51:38 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -31,16 +31,17 @@
#include "lib/zip.h"
#include "lib/zipint.h"
-static PHP_FUNCTION(zip_open);
-static PHP_FUNCTION(zip_read);
-static PHP_FUNCTION(zip_close);
-static PHP_FUNCTION(zip_entry_read);
-static PHP_FUNCTION(zip_entry_filesize);
-static PHP_FUNCTION(zip_entry_name);
-static PHP_FUNCTION(zip_entry_compressedsize);
-static PHP_FUNCTION(zip_entry_compressionmethod);
-static PHP_FUNCTION(zip_entry_open);
-static PHP_FUNCTION(zip_entry_close);
+/* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */
+static PHP_NAMED_FUNCTION(zif_zip_open);
+static PHP_NAMED_FUNCTION(zif_zip_read);
+static PHP_NAMED_FUNCTION(zif_zip_close);
+static PHP_NAMED_FUNCTION(zif_zip_entry_read);
+static PHP_NAMED_FUNCTION(zif_zip_entry_filesize);
+static PHP_NAMED_FUNCTION(zif_zip_entry_name);
+static PHP_NAMED_FUNCTION(zif_zip_entry_compressedsize);
+static PHP_NAMED_FUNCTION(zif_zip_entry_compressionmethod);
+static PHP_NAMED_FUNCTION(zif_zip_entry_open);
+static PHP_NAMED_FUNCTION(zif_zip_entry_close);
/* {{{ Resource le */
static int le_zip_dir;
@@ -273,9 +274,9 @@ static char * php_zipobj_get_zip_comment(struct zip *za, int *len TSRMLS_DC) /*
/* {{{ zend_function_entry */
static zend_function_entry zip_functions[] = {
- PHP_FE(zip_open, NULL)
- PHP_FE(zip_close, NULL)
- PHP_FE(zip_read, NULL)
+ ZEND_RAW_FENTRY("zip_open", zif_zip_open, NULL, 0)
+ ZEND_RAW_FENTRY("zip_close", zif_zip_close, NULL, 0)
+ ZEND_RAW_FENTRY("zip_read", zif_zip_read, NULL, 0)
PHP_FE(zip_entry_open, NULL)
PHP_FE(zip_entry_close, NULL)
PHP_FE(zip_entry_read, NULL)
@@ -634,6 +635,8 @@ static void php_zip_free_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC)
/* }}}*/
+/* reset macro */
+#undef zip
/* {{{ function prototypes */
static PHP_MINIT_FUNCTION(zip);
static PHP_MSHUTDOWN_FUNCTION(zip);
@@ -651,7 +654,7 @@ zend_module_entry zip_module_entry = {
NULL,
NULL,
PHP_MINFO(zip),
- "1.4.0",
+ "2.0.0",
STANDARD_MODULE_PROPERTIES
};
/* }}} */
@@ -659,10 +662,12 @@ zend_module_entry zip_module_entry = {
#ifdef COMPILE_DL_ZIP
ZEND_GET_MODULE(zip)
#endif
+/* set macro */
+#define zip php_ziplib__zip
/* {{{ proto resource zip_open(string filename)
Create new zip using source uri for output */
-static PHP_FUNCTION(zip_open)
+static PHP_NAMED_FUNCTION(zif_zip_open)
{
char *filename;
int filename_len;
@@ -704,7 +709,7 @@ static PHP_FUNCTION(zip_open)
/* {{{ proto void zip_close(resource zip)
Close a Zip archive */
-static PHP_FUNCTION(zip_close)
+static PHP_NAMED_FUNCTION(zif_zip_close)
{
zval * zip;
zip_rsrc *z_rsrc = NULL;
@@ -721,7 +726,7 @@ static PHP_FUNCTION(zip_close)
/* {{{ proto resource zip_read(resource zip)
Returns the next file in the archive */
-static PHP_FUNCTION(zip_read)
+static PHP_NAMED_FUNCTION(zif_zip_read)
{
zval *zip_dp;
zip_read_rsrc *zr_rsrc;
@@ -765,7 +770,7 @@ static PHP_FUNCTION(zip_read)
/* {{{ proto bool zip_entry_open(resource zip_dp, resource zip_entry [, string mode])
Open a Zip File, pointed by the resource entry */
/* Dummy function to follow the old API */
-static PHP_FUNCTION(zip_entry_open)
+static PHP_NAMED_FUNCTION(zif_zip_entry_open)
{
zval * zip;
zval * zip_entry;
@@ -792,7 +797,7 @@ static PHP_FUNCTION(zip_entry_open)
/* {{{ proto void zip_entry_close(resource zip_ent)
Close a zip entry */
/* another dummy function to fit in the old api*/
-static PHP_FUNCTION(zip_entry_close)
+static PHP_NAMED_FUNCTION(zif_zip_entry_close)
{
zval * zip_entry;
zip_read_rsrc * zr_rsrc;
@@ -809,7 +814,7 @@ static PHP_FUNCTION(zip_entry_close)
/* {{{ proto mixed zip_entry_read(resource zip_entry [, int len])
Read from an open directory entry */
-static PHP_FUNCTION(zip_entry_read)
+static PHP_NAMED_FUNCTION(zif_zip_entry_read)
{
zval * zip_entry;
long len = 0;
@@ -909,7 +914,7 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{
/* {{{ proto string zip_entry_name(resource zip_entry)
Return the name given a ZZip entry */
-static PHP_FUNCTION(zip_entry_name)
+static PHP_NAMED_FUNCTION(zif_zip_entry_name)
{
php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
@@ -917,7 +922,7 @@ static PHP_FUNCTION(zip_entry_name)
/* {{{ proto int zip_entry_compressedsize(resource zip_entry)
Return the compressed size of a ZZip entry */
-static PHP_FUNCTION(zip_entry_compressedsize)
+static PHP_NAMED_FUNCTION(zif_zip_entry_compressedsize)
{
php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
@@ -925,7 +930,7 @@ static PHP_FUNCTION(zip_entry_compressedsize)
/* {{{ proto int zip_entry_filesize(resource zip_entry)
Return the actual filesize of a ZZip entry */
-static PHP_FUNCTION(zip_entry_filesize)
+static PHP_NAMED_FUNCTION(zif_zip_entry_filesize)
{
php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
}
@@ -933,13 +938,13 @@ static PHP_FUNCTION(zip_entry_filesize)
/* {{{ proto string zip_entry_compressionmethod(resource zip_entry)
Return a string containing the compression method used on a particular entry */
-static PHP_FUNCTION(zip_entry_compressionmethod)
+static PHP_NAMED_FUNCTION(zif_zip_entry_compressionmethod)
{
php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
}
/* }}} */
-/* {{{ proto mixed open(string source [, int flags])
+/* {{{ proto mixed ZipArchive::open(string source [, int flags])
Create new zip using source uri for output, return TRUE on success or the error code */
static ZIPARCHIVE_METHOD(open)
{
@@ -997,7 +1002,7 @@ static ZIPARCHIVE_METHOD(open)
}
/* }}} */
-/* {{{ proto bool close()
+/* {{{ proto bool ZipArchive::close()
close the zip archive */
static ZIPARCHIVE_METHOD(close)
{
@@ -1026,7 +1031,7 @@ static ZIPARCHIVE_METHOD(close)
}
/* }}} */
-/* {{{ proto bool createEmptyDir(string dirname) U
+/* {{{ proto bool ZipArchive::createEmptyDir(string dirname)
Returns the index of the entry named filename in the archive */
static ZIPARCHIVE_METHOD(addEmptyDir)
{
@@ -1085,7 +1090,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
}
/* }}} */
-/* {{{ proto bool addFile(string filepath[, string entryname[, int start [, int length]]])
+/* {{{ proto bool ZipArchive::addFile(string filepath[, string entryname[, int start [, int length]]])
Add a file in a Zip archive using its path and the name to use. */
static ZIPARCHIVE_METHOD(addFile)
{
@@ -1157,7 +1162,7 @@ static ZIPARCHIVE_METHOD(addFile)
}
/* }}} */
-/* {{{ proto bool addFromString(string name, string content)
+/* {{{ proto bool ZipArchive::addFromString(string name, string content)
Add a file using content and the entry name */
static ZIPARCHIVE_METHOD(addFromString)
{
@@ -1222,7 +1227,7 @@ static ZIPARCHIVE_METHOD(addFromString)
}
/* }}} */
-/* {{{ proto array statName(string filename[, int flags])
+/* {{{ proto array ZipArchive::statName(string filename[, int flags])
Returns the information about a the zip entry filename */
static ZIPARCHIVE_METHOD(statName)
{
@@ -1250,7 +1255,7 @@ static ZIPARCHIVE_METHOD(statName)
}
/* }}} */
-/* {{{ proto resource statIndex(int index[, int flags])
+/* {{{ proto resource ZipArchive::statIndex(int index[, int flags])
Returns the zip entry informations using its index */
static ZIPARCHIVE_METHOD(statIndex)
{
@@ -1278,7 +1283,7 @@ static ZIPARCHIVE_METHOD(statIndex)
}
/* }}} */
-/* {{{ proto int locateName(string filename[, int flags])
+/* {{{ proto int ZipArchive::locateName(string filename[, int flags])
Returns the index of the entry named filename in the archive */
static ZIPARCHIVE_METHOD(locateName)
{
@@ -1318,7 +1323,7 @@ static ZIPARCHIVE_METHOD(locateName)
}
/* }}} */
-/* {{{ proto string getNameIndex(int index [, int flags])
+/* {{{ proto string ZipArchive::getNameIndex(int index [, int flags])
Returns the name of the file at position index */
static ZIPARCHIVE_METHOD(getNameIndex)
{
@@ -1348,7 +1353,7 @@ static ZIPARCHIVE_METHOD(getNameIndex)
}
/* }}} */
-/* {{{ proto bool setArchiveComment(string name, string comment)
+/* {{{ proto bool ZipArchive::setArchiveComment(string name, string comment)
Set or remove (NULL/'') the comment of the archive */
static ZIPARCHIVE_METHOD(setArchiveComment)
{
@@ -1374,7 +1379,7 @@ static ZIPARCHIVE_METHOD(setArchiveComment)
}
/* }}} */
-/* {{{ proto string getArchiveComment()
+/* {{{ proto string ZipArchive::getArchiveComment()
Returns the comment of an entry using its index */
static ZIPARCHIVE_METHOD(getArchiveComment)
{
@@ -1399,7 +1404,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment)
}
/* }}} */
-/* {{{ proto bool setCommentName(string name, string comment)
+/* {{{ proto bool ZipArchive::setCommentName(string name, string comment)
Set or remove (NULL/'') the comment of an entry using its Name */
static ZIPARCHIVE_METHOD(setCommentName)
{
@@ -1432,7 +1437,7 @@ static ZIPARCHIVE_METHOD(setCommentName)
}
/* }}} */
-/* {{{ proto bool setCommentIndex(int index, string comment)
+/* {{{ proto bool ZipArchive::setCommentIndex(int index, string comment)
Set or remove (NULL/'') the comment of an entry using its index */
static ZIPARCHIVE_METHOD(setCommentIndex)
{
@@ -1459,7 +1464,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex)
}
/* }}} */
-/* {{{ proto string getCommentName(string name)
+/* {{{ proto string ZipArchive::getCommentName(string name)
Returns the comment of an entry using its name */
static ZIPARCHIVE_METHOD(getCommentName)
{
@@ -1496,7 +1501,7 @@ static ZIPARCHIVE_METHOD(getCommentName)
}
/* }}} */
-/* {{{ proto string getCommentIndex(int index)
+/* {{{ proto string ZipArchive::getCommentIndex(int index)
Returns the comment of an entry using its index */
static ZIPARCHIVE_METHOD(getCommentIndex)
{
@@ -1524,7 +1529,7 @@ static ZIPARCHIVE_METHOD(getCommentIndex)
}
/* }}} */
-/* {{{ proto bool deleteIndex(int index)
+/* {{{ proto bool ZipArchive::deleteIndex(int index)
Delete a file using its index */
static ZIPARCHIVE_METHOD(deleteIndex)
{
@@ -1554,7 +1559,7 @@ static ZIPARCHIVE_METHOD(deleteIndex)
}
/* }}} */
-/* {{{ proto bool deleteName(string name)
+/* {{{ proto bool ZipArchive::deleteName(string name)
Delete a file using its index */
static ZIPARCHIVE_METHOD(deleteName)
{
@@ -1585,7 +1590,7 @@ static ZIPARCHIVE_METHOD(deleteName)
}
/* }}} */
-/* {{{ proto bool renameIndex(int index, string new_name)
+/* {{{ proto bool ZipArchive::renameIndex(int index, string new_name)
Rename an entry selected by its index to new_name */
static ZIPARCHIVE_METHOD(renameIndex)
{
@@ -1621,7 +1626,7 @@ static ZIPARCHIVE_METHOD(renameIndex)
}
/* }}} */
-/* {{{ proto bool renameName(string name, string new_name)
+/* {{{ proto bool ZipArchive::renameName(string name, string new_name)
Rename an entry selected by its name to new_name */
static ZIPARCHIVE_METHOD(renameName)
{
@@ -1655,7 +1660,7 @@ static ZIPARCHIVE_METHOD(renameName)
}
/* }}} */
-/* {{{ proto bool unchangeIndex(int index)
+/* {{{ proto bool ZipArchive::unchangeIndex(int index)
Changes to the file at position index are reverted */
static ZIPARCHIVE_METHOD(unchangeIndex)
{
@@ -1685,7 +1690,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex)
}
/* }}} */
-/* {{{ proto bool unchangeName(string name)
+/* {{{ proto bool ZipArchive::unchangeName(string name)
Changes to the file named 'name' are reverted */
static ZIPARCHIVE_METHOD(unchangeName)
{
@@ -1719,7 +1724,7 @@ static ZIPARCHIVE_METHOD(unchangeName)
}
/* }}} */
-/* {{{ proto bool unchangeAll()
+/* {{{ proto bool ZipArchive::unchangeAll()
All changes to files and global information in archive are reverted */
static ZIPARCHIVE_METHOD(unchangeAll)
{
@@ -1740,7 +1745,7 @@ static ZIPARCHIVE_METHOD(unchangeAll)
}
/* }}} */
-/* {{{ proto bool unchangeAll()
+/* {{{ proto bool ZipArchive::unchangeAll()
Revert all global changes to the archive archive. For now, this only reverts archive comment changes. */
static ZIPARCHIVE_METHOD(unchangeArchive)
{
@@ -1761,7 +1766,7 @@ static ZIPARCHIVE_METHOD(unchangeArchive)
}
/* }}} */
-/* {{{ array bool extractTo(string pathto[, mixed files])
+/* {{{ proto bool ZipArchive::extractTo(string pathto[, mixed files])
Extract one or more file from a zip archive */
/* TODO:
* - allow index or array of indeces
@@ -1918,7 +1923,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
}
/* }}} */
-/* {{{ proto string getFromName(string entryname[, int len [, int flags]])
+/* {{{ proto string ZipArchive::getFromName(string entryname[, int len [, int flags]])
get the contents of an entry using its name */
static ZIPARCHIVE_METHOD(getFromName)
{
@@ -1926,7 +1931,7 @@ static ZIPARCHIVE_METHOD(getFromName)
}
/* }}} */
-/* {{{ proto string getFromIndex(string entryname[, int len [, int flags]])
+/* {{{ proto string ZipArchive::getFromIndex(string entryname[, int len [, int flags]])
get the contents of an entry using its index */
static ZIPARCHIVE_METHOD(getFromIndex)
{
@@ -1934,7 +1939,7 @@ static ZIPARCHIVE_METHOD(getFromIndex)
}
/* }}} */
-/* {{{ proto resource getStream(string entryname)
+/* {{{ proto resource ZipArchive::getStream(string entryname)
get a stream for an entry using its name */
static ZIPARCHIVE_METHOD(getStream)
{
@@ -2004,7 +2009,9 @@ static zend_function_entry zip_class_functions[] = {
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
+#undef zip
static PHP_MINIT_FUNCTION(zip)
+#define zip php_ziplib__zip
{
zend_class_entry ce;
@@ -2085,7 +2092,9 @@ static PHP_MINIT_FUNCTION(zip)
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
+#undef zip
static PHP_MSHUTDOWN_FUNCTION(zip)
+#define zip php_ziplib__zip
{
zend_hash_destroy(&zip_prop_handlers);
php_unregister_url_stream_wrapper("zip" TSRMLS_CC);
@@ -2096,14 +2105,15 @@ static PHP_MSHUTDOWN_FUNCTION(zip)
/* {{{ PHP_MINFO_FUNCTION
*/
+#undef zip
static PHP_MINFO_FUNCTION(zip)
{
php_info_print_table_start();
php_info_print_table_row(2, "Zip", "enabled");
- php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.38 2007/08/06 22:02:32 bjori Exp $");
- php_info_print_table_row(2, "Zip version", "2.0.0");
- php_info_print_table_row(2, "Libzip version", "0.7.1");
+ php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.43 2008/01/18 00:51:38 pajoye Exp $");
+ php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING);
+ php_info_print_table_row(2, "Libzip version", "0.8.0-compatible");
php_info_print_table_end();
}
diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h
index 498bdc919..6712b5291 100644
--- a/ext/zip/php_zip.h
+++ b/ext/zip/php_zip.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zip.h,v 1.10.2.3 2007/03/14 11:08:57 pajoye Exp $ */
+/* $Id: php_zip.h,v 1.10.2.5 2008/01/18 00:51:38 pajoye Exp $ */
#ifndef PHP_ZIP_H
#define PHP_ZIP_H
@@ -30,6 +30,8 @@ extern zend_module_entry zip_module_entry;
#include "lib/zip.h"
+#define PHP_ZIP_VERSION_STRING "1.8.11"
+
/* {{{ OPENBASEDIR_CHECKPATH(filename) */
#if (PHP_MAJOR_VERSION < 6)
#define OPENBASEDIR_CHECKPATH(filename) \
diff --git a/ext/zip/tests/oo_properties.phpt b/ext/zip/tests/oo_properties.phpt
index dc4498a87..f7d126696 100644
--- a/ext/zip/tests/oo_properties.phpt
+++ b/ext/zip/tests/oo_properties.phpt
@@ -2,7 +2,7 @@
ziparchive::properties isset()/empty() checks
--SKIPIF--
<?php
-/* $Id: oo_properties.phpt,v 1.1.2.4 2007/08/13 12:46:40 tony2001 Exp $ */
+/* $Id: oo_properties.phpt,v 1.1.2.5 2007/11/19 11:12:36 tony2001 Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
@@ -41,7 +41,7 @@ zip->numFiles (4):
empty(): 0
isset(): 1
-Notice: Undefined property: ZipArchive::$bogus in %s on line %d
+Notice: Undefined property: ZipArchive::$bogus in %s on line %d
zip->bogus (0):
empty(): 1
isset(): 0
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index 047b73f3f..89e6ee213 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zlib.h,v 1.42.2.1.2.2 2007/01/01 09:36:10 sebastian Exp $ */
+/* $Id: php_zlib.h,v 1.42.2.1.2.3 2007/12/31 07:20:14 sebastian Exp $ */
#ifndef PHP_ZLIB_H
#define PHP_ZLIB_H
diff --git a/ext/zlib/tests/bug.tar b/ext/zlib/tests/bug.tar
new file mode 100644
index 000000000..77fd77832
--- /dev/null
+++ b/ext/zlib/tests/bug.tar
Binary files differ
diff --git a/ext/zlib/tests/bug_40189.phpt b/ext/zlib/tests/bug_40189.phpt
new file mode 100644
index 000000000..07e5191a9
--- /dev/null
+++ b/ext/zlib/tests/bug_40189.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #40189 (endless loop in zlib.inflate stream filter)
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+// this string is an excerpt of a phar archive that caused an infinite loop
+$a = "\x3\x0\x85\x46\x2f\x7c\xc2\xaa\x69\x2b\x6d\xe5\xdb\xfe\xe4\x21\x8f\x0\x97\x21\x1d\x2\x0\x0\x0\x47\x42\x4d\x42";
+var_dump(base64_encode($a));
+$gp = fopen(dirname(__FILE__) . '/test.other', 'wb');
+$fp = fopen('data://text/plain;base64,AwCFRi98wqppK23l2/7kIY8AlyEdAgAAAEdCTUI=', 'r');
+stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
+var_dump(stream_copy_to_stream($fp, $gp, 5));
+fclose($fp);
+fclose($gp);
+var_dump(file_get_contents(dirname(__FILE__) . '/test.other'));
+?>
+--CLEAN--
+<?php
+@unlink(dirname(__FILE__) . '/test.other');
+?>
+--EXPECT--
+string(40) "AwCFRi98wqppK23l2/7kIY8AlyEdAgAAAEdCTUI="
+int(0)
+string(0) ""
diff --git a/ext/zlib/tests/bug_40189_2.phpt b/ext/zlib/tests/bug_40189_2.phpt
new file mode 100644
index 000000000..13a19dbd9
--- /dev/null
+++ b/ext/zlib/tests/bug_40189_2.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #40189 (test for truncated deflate, also part of erroneous fix for #40189)
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+$a = fopen(dirname(__FILE__). '/bug.tar', 'rb');
+stream_filter_append($a, 'zlib.deflate', STREAM_FILTER_READ, array('window' => 15+16));
+$b = fread($a, 4716032);
+var_dump(strlen($b));
+// when broken, this outputs "int(686904)"
+?>
+--EXPECT--
+int(1676116) \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_filter_inflate2.phpt b/ext/zlib/tests/zlib_filter_inflate2.phpt
new file mode 100644
index 000000000..028e743ee
--- /dev/null
+++ b/ext/zlib/tests/zlib_filter_inflate2.phpt
@@ -0,0 +1,41 @@
+--TEST--
+zlib.inflate of gzip-encoded stream
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php /* $Id: zlib_filter_inflate2.phpt,v 1.1.2.3 2008/04/08 08:45:04 jani Exp $ */
+
+$a = gzopen(dirname(__FILE__) . '/test.txt.gz', 'w');
+fwrite($a, "This is quite the thing ain't it\n");
+fclose($a);
+
+$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
+stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
+echo fread($fp, 2000);
+fclose($fp);
+echo "1\n";
+$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
+// zlib format
+$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
+stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+16));
+echo "2\n";
+echo fread($fp, 2000);
+fclose($fp);
+// auto-detect
+$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
+stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+32));
+echo "3\n";
+echo fread($fp, 2000);
+fclose($fp);
+
+?>
+--CLEAN--
+<?php
+@unlink(dirname(__FILE__) . '/test.txt.gz');
+?>
+--EXPECT--
+1
+2
+This is quite the thing ain't it
+3
+This is quite the thing ain't it \ No newline at end of file
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 2df9aaae3..6b6c45453 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib.c,v 1.183.2.6.2.5 2007/01/01 09:36:10 sebastian Exp $ */
+/* $Id: zlib.c,v 1.183.2.6.2.6 2007/12/31 07:20:14 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index fd3e19c7a..e168c407f 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib_filter.c,v 1.6.2.2.2.4 2007/01/25 12:22:21 tony2001 Exp $ */
+/* $Id: zlib_filter.c,v 1.6.2.2.2.11 2008/02/12 23:29:18 cellog Exp $ */
#include "php.h"
#include "php_zlib.h"
@@ -100,11 +100,6 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
consumed += desired;
bin += desired;
- if (!desired) {
- flags |= PSFS_FLAG_FLUSH_CLOSE;
- break;
- }
-
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -113,7 +108,12 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
data->strm.avail_out = data->outbuf_len;
data->strm.next_out = data->outbuf;
exit_status = PSFS_PASS_ON;
+ } else if (status == Z_STREAM_END && data->strm.avail_out >= data->outbuf_len) {
+ /* no more data to decompress, and nothing was spat out */
+ php_stream_bucket_delref(bucket TSRMLS_CC);
+ return PSFS_PASS_ON;
}
+
}
php_stream_bucket_delref(bucket TSRMLS_CC);
}
@@ -213,11 +213,6 @@ static php_stream_filter_status_t php_zlib_deflate_filter(
consumed += desired;
bin += desired;
- if (!desired) {
- flags |= PSFS_FLAG_FLUSH_CLOSE;
- break;
- }
-
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -320,15 +315,17 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
if ((Z_TYPE_P(filterparams) == IS_ARRAY || Z_TYPE_P(filterparams) == IS_OBJECT) &&
zend_hash_find(HASH_OF(filterparams), "window", sizeof("window"), (void **) &tmpzval) == SUCCESS) {
+ zval tmp;
+
/* log-2 base of history window (9 - 15) */
- SEPARATE_ZVAL(tmpzval);
- convert_to_long_ex(tmpzval);
- if (Z_LVAL_PP(tmpzval) < -MAX_WBITS || Z_LVAL_PP(tmpzval) > MAX_WBITS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL_PP(tmpzval));
+ tmp = **tmpzval;
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 32) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL(tmp));
} else {
- windowBits = Z_LVAL_PP(tmpzval);
+ windowBits = Z_LVAL(tmp);
}
- zval_ptr_dtor(tmpzval);
}
}
@@ -352,27 +349,33 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
case IS_ARRAY:
case IS_OBJECT:
if (zend_hash_find(HASH_OF(filterparams), "memory", sizeof("memory"), (void**) &tmpzval) == SUCCESS) {
+ zval tmp;
+
+ tmp = **tmpzval;
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+
/* Memory Level (1 - 9) */
- SEPARATE_ZVAL(tmpzval);
- convert_to_long_ex(tmpzval);
- if (Z_LVAL_PP(tmpzval) < 1 || Z_LVAL_PP(tmpzval) > MAX_MEM_LEVEL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%ld)", Z_LVAL_PP(tmpzval));
+ if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > MAX_MEM_LEVEL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%ld)", Z_LVAL(tmp));
} else {
- memLevel = Z_LVAL_PP(tmpzval);
+ memLevel = Z_LVAL(tmp);
}
- zval_ptr_dtor(tmpzval);
}
if (zend_hash_find(HASH_OF(filterparams), "window", sizeof("window"), (void**) &tmpzval) == SUCCESS) {
+ zval tmp;
+
+ tmp = **tmpzval;
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+
/* log-2 base of history window (9 - 15) */
- SEPARATE_ZVAL(tmpzval);
- convert_to_long_ex(tmpzval);
- if (Z_LVAL_PP(tmpzval) < -MAX_WBITS || Z_LVAL_PP(tmpzval) > MAX_WBITS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL_PP(tmpzval));
+ if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 16) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL(tmp));
} else {
- windowBits = Z_LVAL_PP(tmpzval);
+ windowBits = Z_LVAL(tmp);
}
- zval_ptr_dtor(tmpzval);
}
if (zend_hash_find(HASH_OF(filterparams), "level", sizeof("level"), (void**) &tmpzval) == SUCCESS) {
@@ -383,17 +386,20 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
case IS_STRING:
case IS_DOUBLE:
case IS_LONG:
- tmpzval = &filterparams;
+ {
+ zval tmp;
+
+ tmp = *filterparams;
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
factory_setlevel:
- /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
- SEPARATE_ZVAL(tmpzval);
- convert_to_long_ex(tmpzval);
- if (Z_LVAL_PP(tmpzval) < -1 || Z_LVAL_PP(tmpzval) > 9) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL_PP(tmpzval));
- } else {
- level = Z_LVAL_PP(tmpzval);
+ /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
+ if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL(tmp));
+ } else {
+ level = Z_LVAL(tmp);
+ }
}
- zval_ptr_dtor(tmpzval);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filter parameter, ignored.");
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index e1153ece3..926a179df 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2007 The PHP Group |
+ | Copyright (c) 1997-2008 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 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib_fopen_wrapper.c,v 1.46.2.1.2.4 2007/05/08 12:08:17 dmitry Exp $ */
+/* $Id: zlib_fopen_wrapper.c,v 1.46.2.1.2.5 2007/12/31 07:20:14 sebastian Exp $ */
#define _GNU_SOURCE