summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bcmath/bcmath.c4
-rw-r--r--ext/curl/config.m484
-rw-r--r--ext/curl/interface.c14
-rw-r--r--ext/dba/config.m49
-rwxr-xr-xext/dba/tests/bug36436.phpt2
-rw-r--r--ext/dbase/dbf_head.c4
-rw-r--r--ext/dbase/tests/bug31754.phpt2
-rw-r--r--ext/dom/element.c3
-rw-r--r--ext/dom/node.c13
-rw-r--r--ext/dom/tests/bug36756.phpt2
-rw-r--r--ext/dom/tests/bug41257.phpt31
-rw-r--r--ext/dom/tests/bug41374.phpt32
-rw-r--r--ext/dom/text.c25
-rw-r--r--ext/filter/logical_filters.c4
-rw-r--r--ext/filter/tests/031.phpt2
-rw-r--r--ext/filter/tests/033.phpt2
-rw-r--r--ext/filter/tests/044.phpt2
-rw-r--r--ext/filter/tests/PMOPB45.phpt11
-rw-r--r--ext/filter/tests/bug39763.phpt2
-rw-r--r--ext/filter/tests/filter_data.phpt2
-rw-r--r--ext/ftp/tests/bug27809.phpt2
-rw-r--r--ext/ftp/tests/bug37799.phpt2
-rw-r--r--ext/ftp/tests/bug39458-2.phpt2
-rw-r--r--ext/ftp/tests/bug39458.phpt2
-rw-r--r--ext/ftp/tests/bug39583-2.phpt2
-rw-r--r--ext/ftp/tests/bug39583.phpt2
-rw-r--r--ext/ftp/tests/bug7216-2.phpt2
-rw-r--r--ext/ftp/tests/bug7216.phpt2
-rw-r--r--ext/gd/config.m421
-rw-r--r--ext/gd/gd.c22
-rw-r--r--ext/gd/libgd/gd_png.c6
-rw-r--r--ext/gd/tests/bug39780.phpt4
-rw-r--r--ext/gd/tests/bug41442.phpt37
-rw-r--r--ext/gd/tests/createfromstring.phpt1
-rw-r--r--ext/gd/tests/libgd00086.phpt21
-rw-r--r--ext/gd/tests/libgd00086.pngbin0 -> 93 bytes
-rw-r--r--ext/gmp/tests/001.phpt2
-rw-r--r--ext/gmp/tests/011.phpt9
-rw-r--r--ext/gmp/tests/012.phpt2
-rw-r--r--ext/gmp/tests/013.phpt2
-rw-r--r--ext/gmp/tests/014.phpt2
-rw-r--r--ext/gmp/tests/015.phpt2
-rw-r--r--ext/gmp/tests/016.phpt2
-rw-r--r--ext/gmp/tests/017.phpt2
-rw-r--r--ext/gmp/tests/018.phpt2
-rw-r--r--ext/gmp/tests/019.phpt2
-rw-r--r--ext/gmp/tests/020.phpt2
-rw-r--r--ext/gmp/tests/021.phpt2
-rw-r--r--ext/gmp/tests/022.phpt2
-rw-r--r--ext/gmp/tests/023.phpt2
-rw-r--r--ext/gmp/tests/024.phpt2
-rw-r--r--ext/gmp/tests/025.phpt2
-rw-r--r--ext/gmp/tests/026.phpt2
-rw-r--r--ext/gmp/tests/027.phpt2
-rw-r--r--ext/gmp/tests/028.phpt2
-rw-r--r--ext/gmp/tests/029.phpt2
-rw-r--r--ext/gmp/tests/030.phpt2
-rw-r--r--ext/gmp/tests/031.phpt2
-rw-r--r--ext/gmp/tests/032.phpt2
-rw-r--r--ext/gmp/tests/033.phpt2
-rw-r--r--ext/gmp/tests/034.phpt2
-rw-r--r--ext/gmp/tests/035.phpt2
-rw-r--r--ext/gmp/tests/036.phpt2
-rw-r--r--ext/gmp/tests/037.phpt2
-rw-r--r--ext/gmp/tests/038.phpt2
-rw-r--r--ext/gmp/tests/039.phpt2
-rw-r--r--ext/gmp/tests/bug32773.phpt2
-rw-r--r--ext/iconv/iconv.c6
-rw-r--r--ext/iconv/tests/bug16069.phpt2
-rw-r--r--ext/iconv/tests/iconv004.phpt4
-rw-r--r--ext/json/JSON_parser.c10
-rw-r--r--ext/json/json.c8
-rw-r--r--ext/json/tests/bug41403.phpt41
-rw-r--r--ext/json/tests/bug41504.phpt29
-rw-r--r--ext/json/tests/fail001.phpt7
-rw-r--r--ext/json/tests/pass001.1.phpt6
-rw-r--r--ext/json/tests/pass001.phpt6
-rw-r--r--ext/mcrypt/tests/bug37595.phptbin1094 -> 1094 bytes
-rw-r--r--ext/mcrypt/tests/bug8040.phpt2
-rw-r--r--ext/mysql/php_mysql.c40
-rw-r--r--ext/mysql/php_mysql.h5
-rw-r--r--ext/mysqli/tests/019.phpt2
-rw-r--r--ext/mysqli/tests/bug28817.phpt2
-rw-r--r--ext/mysqli/tests/bug30967.phpt2
-rw-r--r--ext/mysqli/tests/bug31141.phpt2
-rw-r--r--ext/mysqli/tests/bug31668.phpt2
-rw-r--r--ext/mysqli/tests/bug32405.phpt2
-rw-r--r--ext/mysqli/tests/bug33090.phpt2
-rw-r--r--ext/mysqli/tests/bug33263.phpt2
-rw-r--r--ext/mysqli/tests/bug34785.phpt2
-rw-r--r--ext/mysqli/tests/bug34810.phpt2
-rw-r--r--ext/mysqli/tests/bug35103.phpt2
-rw-r--r--ext/mysqli/tests/bug35517.phpt2
-rw-r--r--ext/mysqli/tests/bug35759.phpt2
-rw-r--r--ext/mysqli/tests/bug36420.phpt2
-rw-r--r--ext/mysqli/tests/bug36745.phpt2
-rw-r--r--ext/mysqli/tests/bug36802.phpt2
-rw-r--r--ext/mysqli/tests/bug36949.phpt2
-rw-r--r--ext/mysqli/tests/bug37090.phpt2
-rw-r--r--ext/oci8/config.m46
-rw-r--r--ext/oci8/tests/bug27303.phpt4
-rw-r--r--ext/oci8/tests/bug27303_2.phpt2
-rw-r--r--ext/oci8/tests/bug27303_3.phpt2
-rw-r--r--ext/oci8/tests/bug27303_4.phpt2
-rw-r--r--ext/oci8/tests/bug32325.phpt2
-rw-r--r--ext/oci8/tests/bug35973.phpt2
-rw-r--r--ext/oci8/tests/bug36010.phpt2
-rw-r--r--ext/oci8/tests/bug38161.phpt2
-rw-r--r--ext/oci8/tests/pecl_bug10194.phpt2
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob.phpt2
-rw-r--r--ext/openssl/openssl.c24
-rw-r--r--ext/openssl/tests/bug28382.phpt2
-rw-r--r--ext/openssl/tests/bug36732.phpt2
-rw-r--r--ext/openssl/tests/bug37820.phpt3
-rw-r--r--ext/openssl/tests/bug39217.phpt19
-rw-r--r--ext/openssl/tests/bug39217cert1.txt17
-rw-r--r--ext/openssl/tests/bug39217cert2.txt18
-rw-r--r--ext/openssl/tests/bug41353.phpt16
-rw-r--r--ext/openssl/xp_ssl.c14
-rw-r--r--ext/pcre/tests/bug21758.phpt2
-rw-r--r--ext/pcre/tests/bug27011.phpt2
-rw-r--r--ext/pcre/tests/bug38600.phpt2
-rw-r--r--ext/pcre/tests/bug40195.phpt2
-rwxr-xr-xext/pdo/pdo_dbh.c3
-rwxr-xr-xext/pdo/pdo_stmt.c30
-rwxr-xr-xext/pdo/php_pdo_driver.h3
-rw-r--r--ext/pdo/tests/bug_34630.phpt2
-rw-r--r--ext/pdo/tests/bug_34687.phpt2
-rw-r--r--ext/pdo/tests/bug_35671.phpt2
-rwxr-xr-xext/pdo/tests/bug_36428.phpt2
-rw-r--r--ext/pdo/tests/bug_38253.phpt2
-rw-r--r--ext/pdo/tests/bug_38394.phpt2
-rw-r--r--ext/pdo/tests/bug_39398.phpt2
-rw-r--r--ext/pdo/tests/pdo_034.phpt64
-rw-r--r--ext/pdo/tests/pecl_bug_5217.phpt2
-rw-r--r--ext/pdo/tests/pecl_bug_5772.phpt2
-rw-r--r--ext/pdo/tests/pecl_bug_5809.phpt2
-rwxr-xr-xext/pdo_mysql/mysql_statement.c3
-rw-r--r--ext/pdo_mysql/tests/bug_33689.phpt5
-rw-r--r--ext/pdo_mysql/tests/pecl_bug_5200.phpt2
-rw-r--r--ext/pdo_mysql/tests/pecl_bug_5780.phpt2
-rw-r--r--ext/pdo_mysql/tests/pecl_bug_5802.phpt2
-rw-r--r--ext/pdo_oci/tests/bug_33707.phpt2
-rw-r--r--ext/pdo_odbc/php_pdo_odbc.h4
-rw-r--r--ext/pdo_pgsql/tests/bug_33876.phpt2
-rw-r--r--ext/pdo_sqlite/sqlite/VERSION2
-rw-r--r--ext/pdo_sqlite/sqlite/src/btree.c28
-rw-r--r--ext/pdo_sqlite/sqlite/src/expr.c4
-rw-r--r--ext/pdo_sqlite/sqlite/src/keywordhash.h2
-rw-r--r--ext/pdo_sqlite/sqlite/src/legacy.c5
-rw-r--r--ext/pdo_sqlite/sqlite/src/loadext.c42
-rw-r--r--ext/pdo_sqlite/sqlite/src/prepare.c16
-rw-r--r--ext/pdo_sqlite/sqlite/src/test1.c5
-rw-r--r--ext/pdo_sqlite/sqlite/src/vdbe.c6
-rw-r--r--ext/pdo_sqlite/sqlite/src/vtab.c24
-rw-r--r--ext/pdo_sqlite/sqlite/src/where.c9
-rw-r--r--ext/pgsql/tests/80_bug14383.phpt4
-rwxr-xr-xext/pgsql/tests/80_bug24499.phpt2
-rwxr-xr-xext/pgsql/tests/80_bug27597.phpt2
-rw-r--r--ext/reflection/php_reflection.c23
-rw-r--r--ext/session/session.c7
-rw-r--r--ext/session/tests/007.phpt1
-rw-r--r--ext/session/tests/008-php4.2.3.phpt1
-rw-r--r--ext/session/tests/bug31454.phpt2
-rw-r--r--ext/session/tests/bug36459.phpt2
-rw-r--r--ext/session/tests/bug38377.phpt2
-rwxr-xr-xext/simplexml/tests/bug37565.phpt2
-rw-r--r--ext/soap/php_encoding.c12
-rw-r--r--ext/soap/php_http.c6
-rw-r--r--ext/soap/php_sdl.c12
-rw-r--r--ext/soap/soap.c34
-rwxr-xr-xext/soap/tests/any.phpt2
-rw-r--r--ext/soap/tests/bugs/bug28751.phpt2
-rw-r--r--ext/soap/tests/bugs/bug29839.phpt4
-rw-r--r--ext/soap/tests/bugs/bug30106.phpt2
-rw-r--r--ext/soap/tests/bugs/bug30799.phpt2
-rw-r--r--ext/soap/tests/bugs/bug30928.phpt2
-rw-r--r--ext/soap/tests/bugs/bug30994.phpt4
-rw-r--r--ext/soap/tests/bugs/bug31422.phpt4
-rw-r--r--ext/soap/tests/bugs/bug31695.phpt2
-rw-r--r--ext/soap/tests/bugs/bug31755.phpt2
-rw-r--r--ext/soap/tests/bugs/bug32776.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug34453.phpt4
-rwxr-xr-xext/soap/tests/bugs/bug35142.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug35273.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug36226.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug36629.phpt4
-rwxr-xr-xext/soap/tests/bugs/bug39815.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug39832.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug41004.phpt2
-rwxr-xr-xext/soap/tests/bugs/bug41337.phpt12
-rwxr-xr-xext/soap/tests/bugs/bug41337.wsdl63
-rwxr-xr-xext/soap/tests/bugs/bug41337_2.phpt12
-rwxr-xr-xext/soap/tests/bugs/bug41337_2.wsdl36
-rwxr-xr-xext/soap/tests/bugs/bug41337_2_1.wsdl47
-rw-r--r--ext/soap/tests/bugs/bug41477.phpt20
-rw-r--r--ext/soap/tests/classmap001.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_012p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_012s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_013p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_013s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_014p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_015p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/Base/round2_base.inc2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_001p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_001s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_002p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_002s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_004p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_005p.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound2_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_import2_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound1.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound2.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclit.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclitparams.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_emptysa.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_import1.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_import3.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupD/round3_groupD_rpcenc.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupE/round3_groupE_list.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/round3_groupF_ext.inc2
-rw-r--r--ext/soap/tests/interop/Round3/GroupF/round3_groupF_headers.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimedoc.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimerpc.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimedoc.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimerpc.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_006w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_001w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_002w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_006w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_007w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_008w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_009w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_010w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_006w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_007w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_008w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_009w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_010w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_011w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_005w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_006w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_007w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_008w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_009w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_010w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_011w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_soapfault.inc2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_003w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_008w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_009w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_011w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_014w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_015w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_019w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_020w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_021w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_022w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_023w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_024w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_025w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_028w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_032w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_033w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt2
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc2
-rw-r--r--ext/soap/tests/schema/schema004.phpt4
-rw-r--r--ext/soap/tests/schema/schema014.phpt2
-rw-r--r--ext/soap/tests/schema/schema016.phpt2
-rw-r--r--ext/soap/tests/schema/schema017.phpt2
-rw-r--r--ext/soap/tests/schema/schema020.phpt2
-rw-r--r--ext/soap/tests/schema/schema022.phpt2
-rw-r--r--ext/soap/tests/schema/schema054.phpt2
-rw-r--r--ext/soap/tests/schema/schema055.phpt2
-rw-r--r--ext/soap/tests/schema/schema063.phpt2
-rw-r--r--ext/soap/tests/schema/test_schema.inc2
-rw-r--r--ext/soap/tests/server001.phpt2
-rw-r--r--ext/soap/tests/server002.phpt2
-rw-r--r--ext/soap/tests/server003.phpt2
-rw-r--r--ext/soap/tests/server004.phpt2
-rw-r--r--ext/soap/tests/server005.phpt2
-rw-r--r--ext/soap/tests/server006.phpt2
-rw-r--r--ext/soap/tests/server009.phpt4
-rw-r--r--ext/soap/tests/server010.phpt4
-rw-r--r--ext/soap/tests/server013.phpt2
-rw-r--r--ext/soap/tests/server014.phpt2
-rw-r--r--ext/soap/tests/server016.phpt2
-rw-r--r--ext/soap/tests/server017.phpt2
-rw-r--r--ext/soap/tests/server018.phpt2
-rw-r--r--ext/soap/tests/server019.phpt33
-rw-r--r--ext/soap/tests/server020.phpt32
-rw-r--r--ext/soap/tests/server021.phpt2
-rwxr-xr-xext/soap/tests/server022.phpt2
-rwxr-xr-xext/soap/tests/server023.phpt2
-rwxr-xr-xext/soap/tests/server024.phpt2
-rwxr-xr-xext/soap/tests/server025.phpt2
-rwxr-xr-xext/soap/tests/server026.phpt2
-rwxr-xr-xext/soap/tests/server028.phpt2
-rw-r--r--ext/soap/tests/server029.phpt55
-rw-r--r--ext/soap/tests/soap12/T42.phpt2
-rw-r--r--ext/soap/tests/soap12/T47.phpt2
-rw-r--r--ext/soap/tests/soap12/soap12-test.inc2
-rwxr-xr-xext/soap/tests/typemap001.phpt2
-rwxr-xr-xext/soap/tests/typemap002.phpt2
-rwxr-xr-xext/soap/tests/typemap005.phpt2
-rwxr-xr-xext/soap/tests/typemap006.phpt2
-rwxr-xr-xext/soap/tests/typemap009.phpt2
-rwxr-xr-xext/soap/tests/typemap010.phpt2
-rwxr-xr-xext/soap/tests/typemap013.phpt2
-rw-r--r--ext/sockets/php_sockets.h3
-rw-r--r--ext/sockets/sockets.c11
-rwxr-xr-xext/spl/php_spl.c20
-rwxr-xr-xext/spl/spl_iterators.c6
-rwxr-xr-xext/spl/spl_iterators.h3
-rwxr-xr-xext/spl/tests/bug33136.phpt2
-rwxr-xr-xext/spl/tests/bug36287.phpt2
-rw-r--r--ext/sqlite/php_sqlite.h3
-rw-r--r--ext/sqlite/sess_sqlite.c12
-rw-r--r--ext/sqlite/sqlite.c13
-rw-r--r--ext/standard/Makefile.frag2
-rw-r--r--ext/standard/basic_functions.c63
-rw-r--r--ext/standard/basic_functions.h3
-rw-r--r--ext/standard/credits.c3
-rw-r--r--ext/standard/dns.c12
-rw-r--r--ext/standard/file.c15
-rw-r--r--ext/standard/html.c48
-rw-r--r--ext/standard/html.h3
-rw-r--r--ext/standard/image.c10
-rw-r--r--ext/standard/iptc.c10
-rw-r--r--ext/standard/lcg.c10
-rw-r--r--ext/standard/math.c14
-rw-r--r--ext/standard/md5.c21
-rw-r--r--ext/standard/md5.h3
-rw-r--r--ext/standard/php_ext_syslog.h4
-rw-r--r--ext/standard/php_lcg.h3
-rw-r--r--ext/standard/php_var.h46
-rw-r--r--ext/standard/sha1.c16
-rw-r--r--ext/standard/string.c18
-rw-r--r--ext/standard/syslog.c6
-rw-r--r--ext/standard/tests/array/005.phpt309
-rw-r--r--ext/standard/tests/array/009.phpt714
-rw-r--r--ext/standard/tests/array/array_change_key_case.phpt202
-rwxr-xr-xext/standard/tests/array/array_fill_keys.phpt2
-rw-r--r--ext/standard/tests/array/array_key_exists.phpt280
-rw-r--r--ext/standard/tests/array/array_keys.phpt466
-rw-r--r--ext/standard/tests/array/array_keys_64bit.phpt472
-rw-r--r--ext/standard/tests/array/array_map.phpt423
-rw-r--r--ext/standard/tests/array/array_pop.phpt286
-rw-r--r--ext/standard/tests/array/array_search.phpt868
-rw-r--r--ext/standard/tests/array/array_values.phptbin713 -> 5251 bytes
-rw-r--r--ext/standard/tests/array/array_values_64bit.phptbin0 -> 5245 bytes
-rw-r--r--ext/standard/tests/array/bug28974.phpt2
-rwxr-xr-xext/standard/tests/array/bug29253.phpt2
-rwxr-xr-xext/standard/tests/array/bug33940.phpt2
-rwxr-xr-xext/standard/tests/array/bug34982.phpt2
-rw-r--r--ext/standard/tests/array/each.phptbin0 -> 9548 bytes
-rw-r--r--ext/standard/tests/array/end.phpt238
-rw-r--r--ext/standard/tests/array/end_64bit.phpt238
-rw-r--r--ext/standard/tests/array/extract.phpt276
-rw-r--r--ext/standard/tests/array/max.phpt2
-rw-r--r--ext/standard/tests/array/min.phpt2
-rw-r--r--ext/standard/tests/array/range.phpt1920
-rw-r--r--ext/standard/tests/array/range_64bit.phpt1207
-rw-r--r--ext/standard/tests/file/fgetc_basic.phpt543
-rw-r--r--ext/standard/tests/file/fgetc_error.phpt73
-rw-r--r--ext/standard/tests/file/file.inc472
-rw-r--r--ext/standard/tests/file/fileinode_basic.phpt37
-rw-r--r--ext/standard/tests/file/fileinode_error.phpt41
-rw-r--r--ext/standard/tests/file/fileinode_variation.phpt96
-rw-r--r--ext/standard/tests/file/filetype_basic.phpt22
-rw-r--r--ext/standard/tests/file/filetype_error.phpt39
-rw-r--r--ext/standard/tests/file/filetype_variation.phpt73
-rw-r--r--ext/standard/tests/file/flock_basic.phpt44
-rw-r--r--ext/standard/tests/file/flock_error.phpt112
-rw-r--r--ext/standard/tests/file/flock_variation.phpt328
-rw-r--r--ext/standard/tests/file/fnmatch_basic.phpt49
-rw-r--r--ext/standard/tests/file/fnmatch_error.phpt57
-rw-r--r--ext/standard/tests/file/fnmatch_variation.phpt402
-rw-r--r--ext/standard/tests/file/fpassthru_basic.phpt126
-rw-r--r--ext/standard/tests/file/fpassthru_error.phpt40
-rw-r--r--ext/standard/tests/file/fpassthru_variation.phpt114
-rw-r--r--ext/standard/tests/general_functions/bug34794.phpt2
-rw-r--r--ext/standard/tests/general_functions/bug39322.phpt2
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_b.phptbin0 -> 7277 bytes
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phptbin0 -> 7277 bytes
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_e.phpt23
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_o.phpt839
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_v.phpt215
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_basic.phpt906
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_error.phpt56
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation1.phpt589
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation2.phpt1002
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation3.phpt1002
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation4.phpt1201
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation5.phpt714
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation6.phpt846
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation7.phpt844
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation8.phpt595
-rw-r--r--ext/standard/tests/general_functions/import_request.phpt6
-rw-r--r--ext/standard/tests/general_functions/import_request1.phpt99
-rw-r--r--ext/standard/tests/general_functions/import_request2.phpt25
-rw-r--r--ext/standard/tests/general_functions/import_request3.phpt25
-rw-r--r--ext/standard/tests/general_functions/ini_get_all.phpt2
-rw-r--r--ext/standard/tests/general_functions/intval.phpt306
-rw-r--r--ext/standard/tests/general_functions/is_array.phpt215
-rw-r--r--ext/standard/tests/general_functions/is_bool.phpt295
-rw-r--r--ext/standard/tests/general_functions/is_float.phpt441
-rw-r--r--ext/standard/tests/general_functions/is_float_64bit.phpt443
-rw-r--r--ext/standard/tests/general_functions/is_int.phpt466
-rw-r--r--ext/standard/tests/general_functions/is_int_64bit.phpt468
-rw-r--r--ext/standard/tests/general_functions/is_null.phpt297
-rw-r--r--ext/standard/tests/general_functions/is_numeric.phpt388
-rw-r--r--ext/standard/tests/general_functions/is_object.phpt228
-rw-r--r--ext/standard/tests/general_functions/is_resource.phpt2
-rw-r--r--ext/standard/tests/general_functions/is_scalar.phpt241
-rw-r--r--ext/standard/tests/general_functions/is_string.phpt304
-rw-r--r--ext/standard/tests/general_functions/print_r.phpt1736
-rw-r--r--ext/standard/tests/general_functions/print_r_64bit.phpt1737
-rw-r--r--ext/standard/tests/general_functions/strval.phpt310
-rw-r--r--ext/standard/tests/general_functions/var_dump.phpt1911
-rw-r--r--ext/standard/tests/general_functions/var_dump_64bit.phpt1911
-rw-r--r--ext/standard/tests/general_functions/var_export.phpt1054
-rw-r--r--ext/standard/tests/image/iptcembed_001.phpt18
-rw-r--r--ext/standard/tests/math/bug25694.phpt2
-rw-r--r--ext/standard/tests/network/bug41347.phpt19
-rw-r--r--ext/standard/tests/strings/005.phpt24
-rw-r--r--ext/standard/tests/strings/006.phpt19
-rw-r--r--ext/standard/tests/strings/007.phpt17
-rw-r--r--ext/standard/tests/strings/addcslashes.phptbin0 -> 4128 bytes
-rw-r--r--ext/standard/tests/strings/basename_basic.phptbin0 -> 3225 bytes
-rw-r--r--ext/standard/tests/strings/basename_error.phpt58
-rw-r--r--ext/standard/tests/strings/basename_variation.phpt235
-rw-r--r--ext/standard/tests/strings/bug36306.phpt2
-rw-r--r--ext/standard/tests/strings/chr_ord.phptbin191 -> 3181 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split.phpt7
-rw-r--r--ext/standard/tests/strings/dirname_basic.phpt153
-rw-r--r--ext/standard/tests/strings/dirname_error.phpt25
-rw-r--r--ext/standard/tests/strings/dirname_variation.phpt143
-rw-r--r--ext/standard/tests/strings/explode1.phpt509
-rw-r--r--ext/standard/tests/strings/htmlentities18.phpt40
-rw-r--r--ext/standard/tests/strings/implode1.phptbin707 -> 5836 bytes
-rw-r--r--ext/standard/tests/strings/md5_file.phptbin0 -> 3030 bytes
-rwxr-xr-xext/standard/tests/strings/printf_64bit.phpt2
-rwxr-xr-xext/standard/tests/strings/sprintf_f_2.phpt2
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin9070 -> 9091 bytes
-rw-r--r--ext/standard/tests/strings/str_repeat.phptbin332 -> 10822 bytes
-rw-r--r--ext/standard/tests/strings/str_replace.phpt904
-rw-r--r--ext/standard/tests/strings/strpos.phptbin612 -> 9401 bytes
-rw-r--r--ext/standard/tests/strings/strripos_offset.phpt45
-rw-r--r--ext/standard/tests/strings/strstr.phptbin764 -> 10390 bytes
-rw-r--r--ext/standard/tests/strings/substr.phptbin0 -> 4536 bytes
-rw-r--r--ext/standard/tests/strings/substr_count.phpt158
-rw-r--r--ext/standard/tests/strings/trim1.phptbin0 -> 2010 bytes
-rw-r--r--ext/sybase_ct/tests/bug22403.phpt6
-rw-r--r--ext/sybase_ct/tests/bug26407.phpt4
-rw-r--r--ext/sybase_ct/tests/bug27843.phpt4
-rw-r--r--ext/sybase_ct/tests/bug28354.phpt4
-rw-r--r--ext/sybase_ct/tests/test.inc3
-rw-r--r--ext/sybase_ct/tests/test_fetch_object.phpt4
-rw-r--r--ext/sybase_ct/tests/test_long.phpt4
-rw-r--r--ext/sybase_ct/tests/test_msghandler.phpt6
-rw-r--r--ext/sybase_ct/tests/test_msghandler_handled.phpt7
-rw-r--r--ext/sybase_ct/tests/test_unbuffered_query.phpt4
-rw-r--r--ext/sysvsem/sysvsem.c7
-rw-r--r--ext/tidy/tidy.c20
-rw-r--r--ext/tokenizer/Makefile.frag4
-rw-r--r--ext/tokenizer/php_tokenizer.h3
-rw-r--r--ext/tokenizer/tests/001.phpt4
-rw-r--r--ext/tokenizer/tokenizer.c15
-rw-r--r--ext/wddx/tests/001.phpt2
-rw-r--r--ext/wddx/tests/bug41283.phpt27
-rw-r--r--ext/wddx/wddx.c5
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c6
-rw-r--r--ext/xmlwriter/php_xmlwriter.c58
-rw-r--r--ext/xmlwriter/tests/bug41287.phpt43
-rw-r--r--ext/xmlwriter/tests/bug41326.phpt50
-rw-r--r--ext/zip/php_zip.c61
-rw-r--r--ext/zip/tests/bug7214.phpt6
-rw-r--r--ext/zip/tests/bug7658.phpt4
-rw-r--r--ext/zip/tests/bug8009.phpt4
-rw-r--r--ext/zip/tests/bug8700.phpt4
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c6
518 files changed, 35481 insertions, 1841 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index 6cbde85cd..d60bd4c89 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bcmath.c,v 1.62.2.2.2.5 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: bcmath.c,v 1.62.2.2.2.6 2007/05/10 09:53:36 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -142,7 +142,7 @@ ZEND_GET_MODULE(bcmath)
/* {{{ PHP_INI */
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("bcmath.scale", "0", PHP_INI_ALL, OnUpdateLong, bc_precision, zend_bcmath_globals, bcmath_globals)
+ STD_PHP_INI_ENTRY("bcmath.scale", "0", PHP_INI_ALL, OnUpdateLongGEZero, bc_precision, zend_bcmath_globals, bcmath_globals)
PHP_INI_END()
/* }}} */
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
index 15b9f5e1f..c7a0f77b7 100644
--- a/ext/curl/config.m4
+++ b/ext/curl/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.28.2.3.2.3 2006/09/15 15:42:53 tony2001 Exp $
+dnl $Id: config.m4,v 1.28.2.3.2.7 2007/05/25 12:47:55 mike Exp $
dnl
PHP_ARG_WITH(curl, for cURL support,
@@ -52,33 +52,65 @@ if test "$PHP_CURL" != "no"; then
AC_MSG_CHECKING([for SSL support in libcurl])
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
if test "$CURL_SSL" = "SSL"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="`$CURL_CONFIG --cflags`"
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="`$CURL_CONFIG --libs` $ld_runpath_switch$CURL_DIR/$PHP_LIBDIR"
+
+ AC_PROG_CPP
+ AC_MSG_CHECKING([for openssl support in libcurl])
+ AC_TRY_RUN([
+ #include <curl/curl.h>
+ int main(int argc, char *argv[]) {
+ curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
+ if (data && data->ssl_version && *data->ssl_version) {
+ const char *ptr = data->ssl_version;
+ while(*ptr == ' ') ++ptr;
+ return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1);
+ }
+ return 1;
+ }
+ ],[
AC_MSG_RESULT([yes])
- AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
-
- AC_MSG_CHECKING([for SSL library used])
- CURL_SSL_FLAVOUR=
- for i in $CURL_LIBS; do
- if test "$i" = "-lssl"; then
- CURL_SSL_FLAVOUR="openssl"
- AC_MSG_RESULT([openssl])
- AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
- AC_CHECK_HEADERS([openssl/crypto.h])
- break
- elif test "$i" = "-lgnutls"; then
- CURL_SSL_FLAVOUR="gnutls"
- AC_MSG_RESULT([gnutls])
- AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
- AC_CHECK_HEADERS([gcrypt.h])
- break
- fi
- done
- if test -z "$CURL_SSL_FLAVOUR"; then
- AC_MSG_RESULT([unknown!])
- AC_MSG_WARN([Could not determine the type of SSL library used!])
- AC_MSG_WARN([Building will fail in ZTS mode!])
- fi
- else
+ AC_CHECK_HEADER([openssl/crypto.h], [
+ AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
+ ])
+ ], [
+ AC_MSG_RESULT([no])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+
+ AC_MSG_CHECKING([for gnutls support in libcurl])
+ AC_TRY_RUN([
+ #include <curl/curl.h>
+ int main(int argc, char *argv[]) {
+ curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
+ if (data && data->ssl_version && *data->ssl_version) {
+ const char *ptr = data->ssl_version;
+ while(*ptr == ' ') ++ptr;
+ return strncasecmp(ptr, "GnuTLS", sizeof("GnuTLS")-1);
+ }
+ return 1;
+ }
+ ], [
+ AC_MSG_RESULT([yes])
+ AC_CHECK_HEADER([gcrypt.h], [
+ AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
+ ])
+ ], [
+ AC_MSG_RESULT([no])
+ ], [
AC_MSG_RESULT([no])
+ ])
+
+ CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ else
+ AC_MSG_RESULT([no])
fi
PHP_ADD_INCLUDE($CURL_DIR/include)
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 03093d02c..d6704715f 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.62.2.14.2.25 2007/04/23 14:36:56 tony2001 Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.26 2007/05/22 08:39:20 pollita Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -387,6 +387,9 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD);
REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT);
+#ifdef CURLOPT_TIMEOUT_MS
+ REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT_MS);
+#endif
REGISTER_CURL_CONSTANT(CURLOPT_POSTFIELDS);
REGISTER_CURL_CONSTANT(CURLOPT_REFERER);
REGISTER_CURL_CONSTANT(CURLOPT_USERAGENT);
@@ -430,6 +433,9 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_RANDOM_FILE);
REGISTER_CURL_CONSTANT(CURLOPT_EGDSOCKET);
REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT);
+#ifdef CURLOPT_CONNECTTIMEOUT_MS
+ REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT_MS);
+#endif
REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYPEER);
REGISTER_CURL_CONSTANT(CURLOPT_CAINFO);
REGISTER_CURL_CONSTANT(CURLOPT_CAPATH);
@@ -1224,6 +1230,9 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_MUTE:
#endif
case CURLOPT_TIMEOUT:
+#ifdef CURLOPT_TIMEOUT_MS
+ case CURLOPT_TIMEOUT_MS:
+#endif
case CURLOPT_FTP_USE_EPSV:
case CURLOPT_LOW_SPEED_LIMIT:
case CURLOPT_SSLVERSION:
@@ -1240,6 +1249,9 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_FRESH_CONNECT:
case CURLOPT_FORBID_REUSE:
case CURLOPT_CONNECTTIMEOUT:
+#ifdef CURLOPT_CONNECTTIMEOUT_MS
+ case CURLOPT_CONNECTTIMEOUT_MS:
+#endif
case CURLOPT_SSL_VERIFYHOST:
case CURLOPT_SSL_VERIFYPEER:
case CURLOPT_DNS_USE_GLOBAL_CACHE:
diff --git a/ext/dba/config.m4 b/ext/dba/config.m4
index 5fceba71b..0c9215203 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.4 2006/12/05 17:54:52 iliaa Exp $
+dnl $Id: config.m4,v 1.70.2.2.2.5 2007/05/21 11:38:53 tony2001 Exp $
dnl
dnl Suppose we need FlatFile if no support or only CDB is used.
@@ -172,6 +172,7 @@ dnl parameters(version, library list, function)
AC_DEFUN([PHP_DBA_DB_CHECK],[
for LIB in $2; do
if test -f $THIS_PREFIX/$PHP_LIBDIR/lib$LIB.a || test -f $THIS_PREFIX/$PHP_LIBDIR/lib$LIB.$SHLIB_SUFFIX_NAME; then
+ lib_found="";
PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/$PHP_LIBDIR, -l$LIB,[
AC_TRY_LINK([
#include "$THIS_INCLUDE"
@@ -185,10 +186,14 @@ AC_DEFUN([PHP_DBA_DB_CHECK],[
#endif
],[
THIS_LIBS=$LIB
- break
+ lib_found=1
])
])
])
+ if test -n "$lib_found"; then
+ lib_found="";
+ break;
+ fi
fi
done
if test -z "$THIS_LIBS"; then
diff --git a/ext/dba/tests/bug36436.phpt b/ext/dba/tests/bug36436.phpt
index e85cf8528..60470660e 100755
--- a/ext/dba/tests/bug36436.phpt
+++ b/ext/dba/tests/bug36436.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #36436 DBA problem with Berkeley DB4
+Bug #36436 (DBA problem with Berkeley DB4)
--SKIPIF--
<?php
$handler = 'db4';
diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c
index 0f9ad6146..33e3a425d 100644
--- a/ext/dbase/dbf_head.c
+++ b/ext/dbase/dbf_head.c
@@ -184,7 +184,7 @@ int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
/* build the on disk field info */
scp = dbf->db_fname; dcp = dbfield.dbf_name;
- strlcpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN);
+ strlcpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN + 1);
dbfield.dbf_type = dbf->db_type;
switch (dbf->db_type) {
@@ -215,7 +215,7 @@ void put_dbf_info(dbhead_t *dbh)
int fcnt;
if ((cp = db_cur_date(NULL))) {
- strlcpy(dbh->db_date, cp, 8);
+ strlcpy(dbh->db_date, cp, 9);
free(cp);
}
put_dbf_head(dbh);
diff --git a/ext/dbase/tests/bug31754.phpt b/ext/dbase/tests/bug31754.phpt
index 32f802b57..bc116ed1b 100644
--- a/ext/dbase/tests/bug31754.phpt
+++ b/ext/dbase/tests/bug31754.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31754: (dbase_open() fails for mode = 1)
+Bug #31754 (dbase_open() fails for mode = 1)
--SKIPIF--
<?php
if (!extension_loaded('dbase')) {
diff --git a/ext/dom/element.c b/ext/dom/element.c
index c31338d81..4d9303f50 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: element.c,v 1.36.2.4.2.7 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: element.c,v 1.36.2.4.2.8 2007/05/04 19:30:59 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -709,6 +709,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
} else {
nsptr = dom_get_ns(elemp, uri, &errorcode, prefix);
}
+ xmlReconciliateNs(elemp->doc, elemp);
}
} else {
if (is_xmlns == 1) {
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 256235ee9..ce04c182f 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: node.c,v 1.37.2.3.2.7 2007/03/18 21:31:04 rrichards Exp $ */
+/* $Id: node.c,v 1.37.2.3.2.8 2007/05/04 19:30:59 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1586,8 +1586,11 @@ PHP_FUNCTION(dom_node_is_default_namespace)
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+ if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
+ nodep = xmlDocGetRootElement((xmlDocPtr) nodep);
+ }
- if (uri_len > 0) {
+ if (nodep && uri_len > 0) {
nsptr = xmlSearchNs(nodep->doc, nodep, NULL);
if (nsptr && xmlStrEqual(nsptr->href, uri)) {
RETURN_TRUE;
@@ -1617,6 +1620,12 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+ if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) {
+ nodep = xmlDocGetRootElement((xmlDocPtr) nodep);
+ if (nodep == NULL) {
+ RETURN_NULL();
+ }
+ }
nsptr = xmlSearchNs(nodep->doc, nodep, prefix);
if (nsptr && nsptr->href != NULL) {
diff --git a/ext/dom/tests/bug36756.phpt b/ext/dom/tests/bug36756.phpt
index e24f9f080..af7488d3f 100644
--- a/ext/dom/tests/bug36756.phpt
+++ b/ext/dom/tests/bug36756.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #36756: (DOMDocument::removeChild corrupts node)
+Bug #36756 (DOMDocument::removeChild corrupts node)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/dom/tests/bug41257.phpt b/ext/dom/tests/bug41257.phpt
new file mode 100644
index 000000000..58e6acfd5
--- /dev/null
+++ b/ext/dom/tests/bug41257.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug # 41257: (lookupNamespaceURI does not work as expected)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc = new DOMDocument();
+$doc->load(dirname(__FILE__)."/nsdoc.xml");
+
+$root = $doc->documentElement;
+
+$duri = $doc->lookupNamespaceURI("ns2")."\n";
+$euri = $root->lookupNamespaceURI("ns2")."\n";
+
+var_dump($duri == $euri);
+
+$dpref = $doc->lookupPrefix("http://ns2")."\n";
+$epref = $root->lookupPrefix("http://ns2")."\n";
+
+var_dump($dpref == $epref);
+
+$disdef = $doc->isDefaultNamespace("http://ns")."\n";
+$eisdef = $root->isDefaultNamespace("http://ns")."\n";
+
+var_dump($dpref === $epref);
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/dom/tests/bug41374.phpt b/ext/dom/tests/bug41374.phpt
new file mode 100644
index 000000000..6de5ffbc0
--- /dev/null
+++ b/ext/dom/tests/bug41374.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug # 41374: (wholetext concats values of wrong nodes)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$xml = (binary)<<<EOXML
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<root>foo<child />baz</root>
+EOXML;
+
+$doc = new DOMDocument();
+$doc->loadXML($xml);
+
+$root = $doc->documentElement;
+$foo = $root->firstChild;
+
+var_dump($foo->wholeText == "foo");
+
+$bar = $root->insertBefore($doc->createTextNode("bar"), $foo->nextSibling);
+
+var_dump($foo->wholeText == "foobar");
+var_dump($foo->wholeText == $bar->wholeText);
+$baz = $bar->nextSibling->nextSibling;
+
+var_dump($baz->wholeText === $foo->wholeText);
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(false)
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 3a03c7516..6cc47bdda 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: text.c,v 1.23.2.1.2.2 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: text.c,v 1.23.2.1.2.4 2007/05/14 11:52:35 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -87,7 +87,7 @@ Since: DOM Level 3
int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC)
{
xmlNodePtr node;
- xmlChar *wholetext;
+ xmlChar *wholetext = NULL;
node = dom_object_get_node(obj);
@@ -96,11 +96,24 @@ int dom_text_whole_text_read(dom_object *obj, zval **retval TSRMLS_DC)
return FAILURE;
}
- ALLOC_ZVAL(*retval);
- wholetext = xmlNodeListGetString(node->doc, node, 1);
- ZVAL_STRING(*retval, wholetext, 1);
+ /* Find starting text node */
+ while (node->prev && ((node->prev->type == XML_TEXT_NODE) || (node->prev->type == XML_CDATA_SECTION_NODE))) {
+ node = node->prev;
+ }
+
+ /* concatenate all adjacent text and cdata nodes */
+ while (node && ((node->type == XML_TEXT_NODE) || (node->type == XML_CDATA_SECTION_NODE))) {
+ wholetext = xmlStrcat(wholetext, node->content);
+ node = node->next;
+ }
- xmlFree(wholetext);
+ ALLOC_ZVAL(*retval);
+ if (wholetext != NULL) {
+ ZVAL_STRING(*retval, wholetext, 1);
+ xmlFree(wholetext);
+ } else {
+ ZVAL_EMPTY_STRING(*retval);
+ }
return SUCCESS;
}
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index 73220bc5d..4463f4e0d 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: logical_filters.c,v 1.1.2.21 2007/01/01 09:36:00 sebastian Exp $ */
+/* $Id: logical_filters.c,v 1.1.2.22 2007/05/03 23:38:27 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\\-]+))$/";
+ 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";
pcre *re = NULL;
pcre_extra *pcre_extra = NULL;
diff --git a/ext/filter/tests/031.phpt b/ext/filter/tests/031.phpt
index 02ef90a34..23691fbbb 100644
--- a/ext/filter/tests/031.phpt
+++ b/ext/filter/tests/031.phpt
@@ -2,6 +2,8 @@
filter_var() and FLOAT
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/filter/tests/033.phpt b/ext/filter/tests/033.phpt
index 18a361690..f965e35c1 100644
--- a/ext/filter/tests/033.phpt
+++ b/ext/filter/tests/033.phpt
@@ -2,6 +2,8 @@
Test all filters returned by filter_list()
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
+--INI--
+precision=14
--FILE--
<?php
include dirname(__FILE__) . '/033_run.inc';
diff --git a/ext/filter/tests/044.phpt b/ext/filter/tests/044.phpt
index 6fa6c2e30..ff4689381 100644
--- a/ext/filter/tests/044.phpt
+++ b/ext/filter/tests/044.phpt
@@ -2,6 +2,8 @@
Integer validation with spaces
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
+--INI--
+precision=14
--FILE--
<?php
$vals = array(
diff --git a/ext/filter/tests/PMOPB45.phpt b/ext/filter/tests/PMOPB45.phpt
new file mode 100644
index 000000000..532eb219d
--- /dev/null
+++ b/ext/filter/tests/PMOPB45.phpt
@@ -0,0 +1,11 @@
+--TEST--
+PMOPB-45-2007:PHP ext/filter Email Validation Vulnerability
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+ $var = "test@example.com\n";
+ var_dump(filter_var($var, FILTER_VALIDATE_EMAIL));
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/filter/tests/bug39763.phpt b/ext/filter/tests/bug39763.phpt
index cc8d9ccee..b0eaaadf0 100644
--- a/ext/filter/tests/bug39763.phpt
+++ b/ext/filter/tests/bug39763.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #39763 filter applies magic_quotes twice in parse_str()
+Bug #39763 (filter applies magic_quotes twice in parse_str())
--INI--
magic_quotes_gpc=1
filter.default=
diff --git a/ext/filter/tests/filter_data.phpt b/ext/filter/tests/filter_data.phpt
index 6926a8851..1071b3efa 100644
--- a/ext/filter/tests/filter_data.phpt
+++ b/ext/filter/tests/filter_data.phpt
@@ -2,6 +2,8 @@
Simple filter_var() tests
--SKIPIF--
<?php if (!extension_loaded("filter")) die("skip"); ?>
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/ftp/tests/bug27809.phpt b/ext/ftp/tests/bug27809.phpt
index bcbe03f13..ff9765c10 100644
--- a/ext/ftp/tests/bug27809.phpt
+++ b/ext/ftp/tests/bug27809.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #27809: ftp_systype returns null
+Bug #27809 (ftp_systype returns null)
--SKIPIF--
<?php
require 'skipif.inc';
diff --git a/ext/ftp/tests/bug37799.phpt b/ext/ftp/tests/bug37799.phpt
index a47d58678..bc9ce002a 100644
--- a/ext/ftp/tests/bug37799.phpt
+++ b/ext/ftp/tests/bug37799.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #37799: ftp_ssl_connect() falls back to non-ssl connection
+Bug #37799 (ftp_ssl_connect() falls back to non-ssl connection)
--SKIPIF--
<?php
$ssl = 1;
diff --git a/ext/ftp/tests/bug39458-2.phpt b/ext/ftp/tests/bug39458-2.phpt
index 4cd2a4523..9e4be5d5f 100644
--- a/ext/ftp/tests/bug39458-2.phpt
+++ b/ext/ftp/tests/bug39458-2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #39458: ftp_nlist() returns false on empty directories (other server behaviour)
+Bug #39458 (ftp_nlist() returns false on empty directories (other server behaviour))
--SKIPIF--
<?php
require 'skipif.inc';
diff --git a/ext/ftp/tests/bug39458.phpt b/ext/ftp/tests/bug39458.phpt
index 5ea345776..828664990 100644
--- a/ext/ftp/tests/bug39458.phpt
+++ b/ext/ftp/tests/bug39458.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #39458: ftp_nlist() returns false on empty directories
+Bug #39458 (ftp_nlist() returns false on empty directories)
--SKIPIF--
<?php
require 'skipif.inc';
diff --git a/ext/ftp/tests/bug39583-2.phpt b/ext/ftp/tests/bug39583-2.phpt
index 44921b320..0a8423d39 100644
--- a/ext/ftp/tests/bug39583-2.phpt
+++ b/ext/ftp/tests/bug39583-2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #39583: FTP always transfers in binary mode
+Bug #39583 (FTP always transfers in binary mode)
--SKIPIF--
<?php
require 'skipif.inc';
diff --git a/ext/ftp/tests/bug39583.phpt b/ext/ftp/tests/bug39583.phpt
index 3c73758dc..b3af56ec0 100644
--- a/ext/ftp/tests/bug39583.phpt
+++ b/ext/ftp/tests/bug39583.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #39583: FTP always transfers in binary mode
+Bug #39583 (FTP always transfers in binary mode)
--SKIPIF--
<?php
require 'skipif.inc';
diff --git a/ext/ftp/tests/bug7216-2.phpt b/ext/ftp/tests/bug7216-2.phpt
index 62b6ec84b..23ab85119 100644
--- a/ext/ftp/tests/bug7216-2.phpt
+++ b/ext/ftp/tests/bug7216-2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #7216: ftp_mkdir returns nothing (2)
+Bug #7216 (ftp_mkdir returns nothing (2))
--SKIPIF--
<?php
require 'skipif.inc';
diff --git a/ext/ftp/tests/bug7216.phpt b/ext/ftp/tests/bug7216.phpt
index 870e02ea6..000bb1ded 100644
--- a/ext/ftp/tests/bug7216.phpt
+++ b/ext/ftp/tests/bug7216.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #7216: ftp_mkdir returns nothing
+Bug #7216 (ftp_mkdir returns nothing)
--SKIPIF--
<?php
require 'skipif.inc';
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index 524e75236..08ecfb377 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.154.2.1.2.3 2007/04/04 00:47:55 pajoye Exp $
+dnl $Id: config.m4,v 1.154.2.1.2.4 2007/05/04 21:57:47 sniper Exp $
dnl
dnl
@@ -211,15 +211,22 @@ AC_DEFUN([PHP_GD_FREETYPE2],[
fi
done
- if test -n "$FREETYPE2_DIR" ; then
+ if test -z "$FREETYPE2_DIR"; then
+ AC_MSG_ERROR([freetype.h not found.])
+ fi
+
+ PHP_CHECK_LIBRARY(freetype, FT_New_Face,
+ [
PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
PHP_ADD_INCLUDE($FREETYPE2_DIR/include)
PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
- else
- AC_MSG_ERROR([freetype2 not found!])
- fi
+ ],[
+ AC_MSG_ERROR([Problem with freetype.(a|so). Please check config.log for more information.])
+ ],[
+ -L$FREETYPE2_DIR/$PHP_LIBDIR
+ ])
else
AC_MSG_RESULT([If configure fails try --with-freetype-dir=<DIR>])
fi
@@ -440,6 +447,10 @@ if test "$PHP_GD" != "no"; then
GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS"
PHP_ADD_BUILD_DIR($ext_builddir/libgd)
GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/"
+
+ PHP_TEST_BUILD(foobar, [], [
+ AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
+ ], [ -L$GD_LIB $GD_SHARED_LIBADD ], [char foobar () {}])
else
GD_HEADER_DIRS="ext/gd/"
GDLIB_CFLAGS="-I$GD_INCLUDE $GDLIB_CFLAGS"
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 7d64fd28b..a46295054 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.312.2.20.2.24 2007/04/24 12:51:22 sniper Exp $ */
+/* $Id: gd.c,v 1.312.2.20.2.26 2007/05/22 10:22:49 tony2001 Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -1370,8 +1370,10 @@ PHP_MINFO_FUNCTION(gd)
char tmp[256];
#ifdef FREETYPE_PATCH
snprintf(tmp, sizeof(tmp), "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
-#else
+#elif defined(FREETYPE_MAJOR)
snprintf(tmp, sizeof(tmp), "%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR);
+#else
+ snprintf(tmp, sizeof(tmp), "1.x");
#endif
php_info_print_table_row(2, "FreeType Version", tmp);
}
@@ -2824,6 +2826,14 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
(*func_p)(im, fp);
break;
#endif
+#ifdef HAVE_GD_GD2
+ case PHP_GDIMG_TYPE_GD2:
+ if (q == -1) {
+ q = 128;
+ }
+ (*func_p)(im, fp, q, t);
+ break;
+#endif
default:
if (q == -1) {
q = 128;
@@ -2876,6 +2886,14 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
(*func_p)(im, tmp);
break;
#endif
+#ifdef HAVE_GD_GD2
+ case PHP_GDIMG_TYPE_GD2:
+ if (q == -1) {
+ q = 128;
+ }
+ (*func_p)(im, tmp, q, t);
+ break;
+#endif
default:
(*func_p)(im, tmp);
break;
diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c
index 0f6436f12..a002a9521 100644
--- a/ext/gd/libgd/gd_png.c
+++ b/ext/gd/libgd/gd_png.c
@@ -71,7 +71,11 @@ static void gdPngErrorHandler (png_structp png_ptr, png_const_charp msg)
static void gdPngReadData (png_structp png_ptr, png_bytep data, png_size_t length)
{
- gdGetBuf(data, length, (gdIOCtx *) png_get_io_ptr(png_ptr));
+ int check;
+ check = gdGetBuf(data, length, (gdIOCtx *) png_get_io_ptr(png_ptr));
+ if (check != length) {
+ png_error(png_ptr, "Read Error: truncated data");
+ }
}
static void gdPngWriteData (png_structp png_ptr, png_bytep data, png_size_t length)
diff --git a/ext/gd/tests/bug39780.phpt b/ext/gd/tests/bug39780.phpt
index 3a23aa9df..efa092bfb 100644
--- a/ext/gd/tests/bug39780.phpt
+++ b/ext/gd/tests/bug39780.phpt
@@ -13,9 +13,9 @@ var_dump($im);
?>
--EXPECTF--
-Warning: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: CRC error in %s on line %d
+Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data in %s on line %d
Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in %s on line %d
-Warning: imagecreatefrompng(): '%s' is not a valid PNG file in %s on line %d
+Warning: imagecreatefrompng(): '%sbug39780.png' is not a valid PNG file in %s on line %d
bool(false)
diff --git a/ext/gd/tests/bug41442.phpt b/ext/gd/tests/bug41442.phpt
new file mode 100644
index 000000000..78a61bec9
--- /dev/null
+++ b/ext/gd/tests/bug41442.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #41442 (imagegd2() under output control)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) {
+ die("skip gd extension not available.");
+ }
+ if (!function_exists("imagegd2")) {
+ die("skip GD2 support unavailable");
+ }
+?>
+--FILE--
+<?php
+
+$str = file_get_contents(dirname(__FILE__).'/src.gd2');
+$res = imagecreatefromstring($str);
+
+/* string */
+ob_start();
+imagegd2($res);
+$str2 = ob_get_clean();
+var_dump(imagecreatefromstring($str2));
+
+/* file */
+$file = dirname(__FILE__)."/bug41442.gd2";
+imagegd2($res, $file);
+$str2 = file_get_contents($file);
+var_dump(imagecreatefromstring($str2));
+
+@unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+resource(%d) of type (gd)
+resource(%d) of type (gd)
+Done
diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt
index b3d7dde15..a3c2e977b 100644
--- a/ext/gd/tests/createfromstring.phpt
+++ b/ext/gd/tests/createfromstring.phpt
@@ -3,6 +3,7 @@ imagecreatefromstring
--SKIPIF--
<?php
if (!function_exists('imagecreatefromstring')) die("skip gd extension not available\n");
+ if (!function_exists('imagepng')) die("skip no imagpng()\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/libgd00086.phpt b/ext/gd/tests/libgd00086.phpt
new file mode 100644
index 000000000..60f28107c
--- /dev/null
+++ b/ext/gd/tests/libgd00086.phpt
@@ -0,0 +1,21 @@
+--TEST--
+libgd #86 (Possible infinite loop in imagecreatefrompng)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!GD_BUNDLED) die('skip external GD libraries always fail');
+?>
+--FILE--
+<?php
+
+$im = imagecreatefrompng(dirname(__FILE__) . '/libgd00086.png');
+var_dump($im);
+?>
+--EXPECTF--
+
+Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data in %s on line %d
+
+Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in %s on line %d
+
+Warning: imagecreatefrompng(): '%s' is not a valid PNG file in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/libgd00086.png b/ext/gd/tests/libgd00086.png
new file mode 100644
index 000000000..0e7c8dda0
--- /dev/null
+++ b/ext/gd/tests/libgd00086.png
Binary files differ
diff --git a/ext/gmp/tests/001.phpt b/ext/gmp/tests/001.phpt
index 382d374cb..5126f7314 100644
--- a/ext/gmp/tests/001.phpt
+++ b/ext/gmp/tests/001.phpt
@@ -18,4 +18,4 @@ echo "gmp extension is available";
*/
?>
--EXPECT--
-gmp extension is available \ No newline at end of file
+gmp extension is available
diff --git a/ext/gmp/tests/011.phpt b/ext/gmp/tests/011.phpt
index ec5d24f3f..0ca3ca384 100644
--- a/ext/gmp/tests/011.phpt
+++ b/ext/gmp/tests/011.phpt
@@ -1,5 +1,12 @@
--TEST--
-gmp_divexact() tests (OK to fail with GMP =< 4.2.1)
+gmp_divexact() tests
+--SKIPIF--
+<?php
+if (!extension_loaded("gmp")) die ("skip");
+if (!defined('GMP_VERSION') || version_compare("4.2.1", GMP_VERSION, ">=")) {
+ die("skip your GMP is too old and will crash");
+}
+?>
--FILE--
<?php
diff --git a/ext/gmp/tests/012.phpt b/ext/gmp/tests/012.phpt
index ff60385bb..a8de91598 100644
--- a/ext/gmp/tests/012.phpt
+++ b/ext/gmp/tests/012.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_neg() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/013.phpt b/ext/gmp/tests/013.phpt
index b576d4448..8d6e1d0d5 100644
--- a/ext/gmp/tests/013.phpt
+++ b/ext/gmp/tests/013.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_abs() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/014.phpt b/ext/gmp/tests/014.phpt
index 850574865..f52c32cdb 100644
--- a/ext/gmp/tests/014.phpt
+++ b/ext/gmp/tests/014.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_fact() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/015.phpt b/ext/gmp/tests/015.phpt
index 2eea93a97..98ae349b5 100644
--- a/ext/gmp/tests/015.phpt
+++ b/ext/gmp/tests/015.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_pow() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/016.phpt b/ext/gmp/tests/016.phpt
index 6f63b28a0..6bd3afd07 100644
--- a/ext/gmp/tests/016.phpt
+++ b/ext/gmp/tests/016.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_powm() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/017.phpt b/ext/gmp/tests/017.phpt
index 4254a07ae..8349862b7 100644
--- a/ext/gmp/tests/017.phpt
+++ b/ext/gmp/tests/017.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_sqrt() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/018.phpt b/ext/gmp/tests/018.phpt
index 9aeff6597..c8146cf95 100644
--- a/ext/gmp/tests/018.phpt
+++ b/ext/gmp/tests/018.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_sqrtrem() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/019.phpt b/ext/gmp/tests/019.phpt
index d632d1400..10bca880b 100644
--- a/ext/gmp/tests/019.phpt
+++ b/ext/gmp/tests/019.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_perfect_square() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/020.phpt b/ext/gmp/tests/020.phpt
index 37c3ebdc6..c689ec552 100644
--- a/ext/gmp/tests/020.phpt
+++ b/ext/gmp/tests/020.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_prob_prime() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/021.phpt b/ext/gmp/tests/021.phpt
index 48d8291ae..01b4d1cd6 100644
--- a/ext/gmp/tests/021.phpt
+++ b/ext/gmp/tests/021.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_gcd() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/022.phpt b/ext/gmp/tests/022.phpt
index 0df874dc7..cfa919bf6 100644
--- a/ext/gmp/tests/022.phpt
+++ b/ext/gmp/tests/022.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_gcdext() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/023.phpt b/ext/gmp/tests/023.phpt
index 59d1592cb..a7cc9a7a8 100644
--- a/ext/gmp/tests/023.phpt
+++ b/ext/gmp/tests/023.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_invert() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/024.phpt b/ext/gmp/tests/024.phpt
index 4f9a369c9..9b46d9483 100644
--- a/ext/gmp/tests/024.phpt
+++ b/ext/gmp/tests/024.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_jacobi() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/025.phpt b/ext/gmp/tests/025.phpt
index db01a4c13..99ac184df 100644
--- a/ext/gmp/tests/025.phpt
+++ b/ext/gmp/tests/025.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_legendre() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/026.phpt b/ext/gmp/tests/026.phpt
index 39c18501f..d95262287 100644
--- a/ext/gmp/tests/026.phpt
+++ b/ext/gmp/tests/026.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_cmp() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/027.phpt b/ext/gmp/tests/027.phpt
index b22fa2ac0..d4fee571f 100644
--- a/ext/gmp/tests/027.phpt
+++ b/ext/gmp/tests/027.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_sign() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/028.phpt b/ext/gmp/tests/028.phpt
index 95f910ab4..a61a39a07 100644
--- a/ext/gmp/tests/028.phpt
+++ b/ext/gmp/tests/028.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_random() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/029.phpt b/ext/gmp/tests/029.phpt
index b49ae2842..0846ad135 100644
--- a/ext/gmp/tests/029.phpt
+++ b/ext/gmp/tests/029.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_and() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/030.phpt b/ext/gmp/tests/030.phpt
index 116630bca..86c5caeea 100644
--- a/ext/gmp/tests/030.phpt
+++ b/ext/gmp/tests/030.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_or() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/031.phpt b/ext/gmp/tests/031.phpt
index fc8a56143..80a7ff89c 100644
--- a/ext/gmp/tests/031.phpt
+++ b/ext/gmp/tests/031.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_com() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/032.phpt b/ext/gmp/tests/032.phpt
index 5cca14063..4f426aac1 100644
--- a/ext/gmp/tests/032.phpt
+++ b/ext/gmp/tests/032.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_xor() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/033.phpt b/ext/gmp/tests/033.phpt
index 070ff0ef2..ea5cc5da7 100644
--- a/ext/gmp/tests/033.phpt
+++ b/ext/gmp/tests/033.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_setbit() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/034.phpt b/ext/gmp/tests/034.phpt
index b3f65547f..1614c0016 100644
--- a/ext/gmp/tests/034.phpt
+++ b/ext/gmp/tests/034.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_clrbit() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/035.phpt b/ext/gmp/tests/035.phpt
index 81410b5c7..a9b0c1a33 100644
--- a/ext/gmp/tests/035.phpt
+++ b/ext/gmp/tests/035.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_popcount() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/036.phpt b/ext/gmp/tests/036.phpt
index 2d429c40a..fa2d67c82 100644
--- a/ext/gmp/tests/036.phpt
+++ b/ext/gmp/tests/036.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_hamdist() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/037.phpt b/ext/gmp/tests/037.phpt
index 90ba3558d..478904302 100644
--- a/ext/gmp/tests/037.phpt
+++ b/ext/gmp/tests/037.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_scan0() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/038.phpt b/ext/gmp/tests/038.phpt
index c4764faff..b278c2586 100644
--- a/ext/gmp/tests/038.phpt
+++ b/ext/gmp/tests/038.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_scan1() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/039.phpt b/ext/gmp/tests/039.phpt
index 9a4edb541..3f373a84f 100644
--- a/ext/gmp/tests/039.phpt
+++ b/ext/gmp/tests/039.phpt
@@ -1,5 +1,7 @@
--TEST--
gmp_init() basic tests
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/gmp/tests/bug32773.phpt b/ext/gmp/tests/bug32773.phpt
index feb9d8d75..6823fa1a1 100644
--- a/ext/gmp/tests/bug32773.phpt
+++ b/ext/gmp/tests/bug32773.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #32773 binary GMP functions returns unexpected value, when second parameter is int(0)
+Bug #32773 (binary GMP functions returns unexpected value, when second parameter is int(0))
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 6dc722b3b..d6149d776 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.124.2.8.2.15 2007/03/12 19:34:26 tony2001 Exp $ */
+/* $Id: iconv.c,v 1.124.2.8.2.16 2007/05/19 17:52:30 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -2305,8 +2305,8 @@ PHP_FUNCTION(ob_iconv_handler)
ICONVG(output_encoding), ICONVG(internal_encoding));
_php_iconv_show_error(err, ICONVG(output_encoding), ICONVG(internal_encoding) TSRMLS_CC);
if (out_buffer != NULL) {
- spprintf(&content_type, 0, "Content-Type:%s; charset=%s", mimetype, ICONVG(output_encoding));
- if (content_type && sapi_add_header(content_type, strlen(content_type), 0) != FAILURE) {
+ int len = spprintf(&content_type, 0, "Content-Type:%s; charset=%s", mimetype, ICONVG(output_encoding));
+ if (content_type && sapi_add_header(content_type, len, 0) != FAILURE) {
SG(sapi_headers).send_default_content_type = 0;
}
if (mimetype_alloced) {
diff --git a/ext/iconv/tests/bug16069.phpt b/ext/iconv/tests/bug16069.phpt
index 246b90c6c..81fc235e2 100644
--- a/ext/iconv/tests/bug16069.phpt
+++ b/ext/iconv/tests/bug16069.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #16069
+Bug #16069 (ICONV transliteration failure)
--SKIPIF--
<?php
include( 'skipif.inc' );
diff --git a/ext/iconv/tests/iconv004.phpt b/ext/iconv/tests/iconv004.phpt
index 9254f5a12..6c8606536 100644
--- a/ext/iconv/tests/iconv004.phpt
+++ b/ext/iconv/tests/iconv004.phpt
@@ -2,6 +2,10 @@
iconv_mime_encode() sanity cheeck.
--SKIPIF--
<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--INI--
+iconv.input_encoding = ISO-8859-1
+iconv.internal_encoding = ISO-8859-1
+iconv.output_encoding = ISO-8859-1
--FILE--
<?php
var_dump(iconv_mime_encode('', ''));
diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c
index b57d65174..2f2d26812 100644
--- a/ext/json/JSON_parser.c
+++ b/ext/json/JSON_parser.c
@@ -201,7 +201,7 @@ static const int state_transition_table[30][31] = {
/*29*/ {29,29,-1,-1,-1,-1,-1,-1, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
};
-#define JSON_PARSER_MAX_DEPTH 20
+#define JSON_PARSER_MAX_DEPTH 128
/*
@@ -288,7 +288,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type)
}
else if (type == IS_DOUBLE)
{
- ZVAL_DOUBLE(*z, atof(buf->c));
+ ZVAL_DOUBLE(*z, zend_strtod(buf->c, NULL));
}
else if (type == IS_STRING)
{
@@ -364,7 +364,7 @@ static void attach_zval(json_parser *json, int up, int cur, smart_str *key, int
}
else
{
- add_assoc_zval_ex(root, (key->len ? key->c : "_empty_"), (key->len ? (key->len + 1) : sizeof("_empty_")), child);
+ add_assoc_zval_ex(root, (key->len ? key->c : ""), (key->len ? (key->len + 1) : sizeof("")), child);
}
key->len = 0;
}
@@ -507,7 +507,7 @@ JSON_parser(zval *z, unsigned short p[], int length, int assoc TSRMLS_DC)
}
else
{
- add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval);
+ add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : ""), (key.len ? (key.len + 1) : sizeof("")), mval);
}
key.len = 0;
buf.len = 0;
@@ -638,7 +638,7 @@ JSON_parser(zval *z, unsigned short p[], int length, int assoc TSRMLS_DC)
}
else
{
- add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval);
+ add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : ""), (key.len ? (key.len + 1) : sizeof("")), mval);
}
key.len = 0;
}
diff --git a/ext/json/json.c b/ext/json/json.c
index c406522aa..c3dfbf8ab 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: json.c,v 1.9.2.14 2007/04/13 21:34:12 andrei Exp $ */
+/* $Id: json.c,v 1.9.2.15 2007/05/25 13:24:50 bjori Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -387,6 +387,8 @@ static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC) {
return;
}
+/* {{{ proto string json_encode(mixed data)
+ Returns the JSON representation of a value */
static PHP_FUNCTION(json_encode)
{
zval *parameter;
@@ -402,7 +404,10 @@ static PHP_FUNCTION(json_encode)
smart_str_free(&buf);
}
+/* }}} */
+/* {{{ proto mixed json_decode(string json [, bool assoc])
+ Decodes the JSON representation into a PHP value */
static PHP_FUNCTION(json_decode)
{
char *parameter;
@@ -476,6 +481,7 @@ static PHP_FUNCTION(json_decode)
}
}
}
+/* }}} */
/*
* Local variables:
diff --git a/ext/json/tests/bug41403.phpt b/ext/json/tests/bug41403.phpt
new file mode 100644
index 000000000..80576c85b
--- /dev/null
+++ b/ext/json/tests/bug41403.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
+--SKIPIF--
+<?php
+if (setlocale(LC_NUMERIC, "de_DE") === false) {
+ die("skip no de_DE locale");
+}
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+
+setlocale(LC_NUMERIC, 'de_DE');
+var_dump(json_decode('[2.1]'));
+var_dump(json_decode('[0.15]'));
+var_dump(json_decode('[123.13452345]'));
+var_dump(json_decode('[123,13452345]'));
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ float(2,1)
+}
+array(1) {
+ [0]=>
+ float(0,15)
+}
+array(1) {
+ [0]=>
+ float(123,13452345)
+}
+array(2) {
+ [0]=>
+ int(123)
+ [1]=>
+ int(13452345)
+}
+Done
diff --git a/ext/json/tests/bug41504.phpt b/ext/json/tests/bug41504.phpt
new file mode 100644
index 000000000..6e51bb91a
--- /dev/null
+++ b/ext/json/tests/bug41504.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #41504 (json_decode() converts empty array keys to "_empty_")
+--FILE--
+<?php
+
+var_dump(json_decode('{"":"value"}', true));
+var_dump(json_decode('{"":"value", "key":"value"}', true));
+var_dump(json_decode('{"key":"value", "":"value"}', true));
+
+echo "Done\n";
+?>
+--EXPECT--
+array(1) {
+ [""]=>
+ string(5) "value"
+}
+array(2) {
+ [""]=>
+ string(5) "value"
+ ["key"]=>
+ string(5) "value"
+}
+array(2) {
+ ["key"]=>
+ string(5) "value"
+ [""]=>
+ string(5) "value"
+}
+Done \ No newline at end of file
diff --git a/ext/json/tests/fail001.phpt b/ext/json/tests/fail001.phpt
index 2f0c41b90..525bc048c 100644
--- a/ext/json/tests/fail001.phpt
+++ b/ext/json/tests/fail001.phpt
@@ -24,7 +24,7 @@ $tests = array('"A JSON payload should be an object or array, not a string."',
'["Illegal backslash escape: \\x15"]',
'["Illegal backslash escape: \\\'"]',
'["Illegal backslash escape: \\017"]',
- '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]',
+ '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
'{"Missing colon" null}',
'{"Double colon":: null}',
'{"Comma instead of colon", null}',
@@ -128,7 +128,7 @@ AS OBJECT
NULL
AS ARRAY
NULL
-Testing: [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]
+Testing: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
AS OBJECT
NULL
AS ARRAY
@@ -162,4 +162,5 @@ Testing: ['single quote']
AS OBJECT
NULL
AS ARRAY
-NULL \ No newline at end of file
+NULL
+
diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt
index 45eb5739a..58fb678d9 100644
--- a/ext/json/tests/pass001.1.phpt
+++ b/ext/json/tests/pass001.1.phpt
@@ -382,7 +382,7 @@ array(14) {
float(1.23456789E-13)
["E"]=>
float(1.23456789E+34)
- ["_empty_"]=>
+ [""]=>
float(INF)
["E no ."]=>
float(4000000000000)
@@ -528,7 +528,7 @@ array(14) {
ENCODE: FROM OBJECT
["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4.0e+12,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":{},"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
ENCODE: FROM ARRAY
-["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4.0e+12,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":[],"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
+["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"":0,"E no .":4.0e+12,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":[],"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
DECODE AGAIN: AS OBJECT
array(14) {
[0]=>
@@ -744,7 +744,7 @@ array(14) {
float(1.23456789E-13)
["E"]=>
float(1.23456789E+34)
- ["_empty_"]=>
+ [""]=>
int(0)
["E no ."]=>
float(4000000000000)
diff --git a/ext/json/tests/pass001.phpt b/ext/json/tests/pass001.phpt
index 1decd546d..43be11e2b 100644
--- a/ext/json/tests/pass001.phpt
+++ b/ext/json/tests/pass001.phpt
@@ -324,7 +324,7 @@ array(14) {
float(1.23456789E-13)
["E"]=>
float(1.23456789E+34)
- ["_empty_"]=>
+ [""]=>
float(INF)
["zero"]=>
int(0)
@@ -427,7 +427,7 @@ array(14) {
ENCODE: FROM OBJECT
["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","true":true,"false":false,"null":null,"array":[],"object":{},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
ENCODE: FROM ARRAY
-["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","true":true,"false":false,"null":null,"array":[],"object":[],"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
+["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"":0,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","true":true,"false":false,"null":null,"array":[],"object":[],"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
DECODE AGAIN: AS OBJECT
array(14) {
[0]=>
@@ -600,7 +600,7 @@ array(14) {
float(1.23456789E-13)
["E"]=>
float(1.23456789E+34)
- ["_empty_"]=>
+ [""]=>
int(0)
["zero"]=>
int(0)
diff --git a/ext/mcrypt/tests/bug37595.phpt b/ext/mcrypt/tests/bug37595.phpt
index 3c682129f..0530f3e81 100644
--- a/ext/mcrypt/tests/bug37595.phpt
+++ b/ext/mcrypt/tests/bug37595.phpt
Binary files differ
diff --git a/ext/mcrypt/tests/bug8040.phpt b/ext/mcrypt/tests/bug8040.phpt
index 12e28687f..78fef5caf 100644
--- a/ext/mcrypt/tests/bug8040.phpt
+++ b/ext/mcrypt/tests/bug8040.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #8040
+Bug #8040 (MCRYPT_MODE_* do not seem to exist)
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 42a22989d..82efb6592 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mysql.c,v 1.213.2.6.2.10 2007/04/23 09:32:44 tony2001 Exp $ */
+/* $Id: php_mysql.c,v 1.213.2.6.2.12 2007/05/14 18:09:20 scottmac Exp $ */
/* TODO:
*
@@ -101,6 +101,10 @@ static int le_result, le_link, le_plink;
#define MYSQL_HAS_YEAR
#endif
+#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007
+#define MYSQL_HAS_SET_CHARSET
+#endif
+
#define MYSQL_ASSOC 1<<0
#define MYSQL_NUM 1<<1
#define MYSQL_BOTH (MYSQL_ASSOC|MYSQL_NUM)
@@ -181,7 +185,9 @@ zend_function_entry mysql_functions[] = {
#endif
PHP_FE(mysql_info, NULL)
-
+#ifdef MYSQL_HAS_SET_CHARSET
+ PHP_FE(mysql_set_charset, NULL)
+#endif
/* for downwards compatability */
PHP_FALIAS(mysql, mysql_db_query, NULL)
PHP_FALIAS(mysql_fieldname, mysql_field_name, NULL)
@@ -1124,6 +1130,36 @@ PHP_FUNCTION(mysql_client_encoding)
/* }}} */
#endif
+#ifdef MYSQL_HAS_SET_CHARSET
+/* {{{ proto bool mysql_set_charset(string csname [, int link_identifier])
+ sets client character set */
+PHP_FUNCTION(mysql_set_charset)
+{
+ zval *mysql_link = NULL;
+ char *csname;
+ int id = -1, csname_len;
+ php_mysql_conn *mysql;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &csname, &csname_len, &mysql_link) == FAILURE) {
+ return;
+ }
+
+ if (ZEND_NUM_ARGS() == 1) {
+ id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ CHECK_LINK(id);
+ }
+
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
+
+ if (!mysql_set_character_set(&mysql->conn, csname)) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+ }
+}
+/* }}} */
+#endif
+
#ifndef NETWARE /* The below two functions not supported on NetWare */
#if MYSQL_VERSION_ID < 40000
/* {{{ proto bool mysql_create_db(string database_name [, int link_identifier])
diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h
index 90449fe63..7721990d5 100644
--- a/ext/mysql/php_mysql.h
+++ b/ext/mysql/php_mysql.h
@@ -17,7 +17,7 @@
*/
-/* $Id: php_mysql.h,v 1.37.2.1.2.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: php_mysql.h,v 1.37.2.1.2.2 2007/05/14 17:10:47 scottmac Exp $ */
#ifndef PHP_MYSQL_H
#define PHP_MYSQL_H
@@ -91,6 +91,9 @@ PHP_FUNCTION(mysql_stat);
PHP_FUNCTION(mysql_thread_id);
PHP_FUNCTION(mysql_client_encoding);
PHP_FUNCTION(mysql_ping);
+#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007
+PHP_FUNCTION(mysql_set_charset);
+#endif
ZEND_BEGIN_MODULE_GLOBALS(mysql)
long default_link;
diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt
index 173c40490..b5d2e3407 100644
--- a/ext/mysqli/tests/019.phpt
+++ b/ext/mysqli/tests/019.phpt
@@ -2,6 +2,8 @@
mysqli fetch (bind_param + bind_result)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "connect.inc";
diff --git a/ext/mysqli/tests/bug28817.phpt b/ext/mysqli/tests/bug28817.phpt
index 0cc8b1361..a52cc6269 100644
--- a/ext/mysqli/tests/bug28817.phpt
+++ b/ext/mysqli/tests/bug28817.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #28817 testcase (properties)
+Bug #28817 (problems with properties declared in the class extending MySQLi)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug30967.phpt b/ext/mysqli/tests/bug30967.phpt
index 0a82d0d43..410764a77 100644
--- a/ext/mysqli/tests/bug30967.phpt
+++ b/ext/mysqli/tests/bug30967.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #30967 testcase (properties)
+Bug #30967 (problems with properties declared in the class extending the class extending MySQLi)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug31141.phpt b/ext/mysqli/tests/bug31141.phpt
index acad79f1f..3dc0dda1d 100644
--- a/ext/mysqli/tests/bug31141.phpt
+++ b/ext/mysqli/tests/bug31141.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31141 testcase (properties)
+Bug #31141 (properties declared in the class extending MySQLi are not available)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug31668.phpt b/ext/mysqli/tests/bug31668.phpt
index b813096a2..633303033 100644
--- a/ext/mysqli/tests/bug31668.phpt
+++ b/ext/mysqli/tests/bug31668.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31668 multi_query works exactly every other time (multi_query was global, now per connection)
+Bug #31668 (multi_query works exactly every other time (multi_query was global, now per connection))
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug32405.phpt b/ext/mysqli/tests/bug32405.phpt
index f805dc798..456a69048 100644
--- a/ext/mysqli/tests/bug32405.phpt
+++ b/ext/mysqli/tests/bug32405.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #32405
+Bug #32405 (mysqli->fetch() is returning bad data)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug33090.phpt b/ext/mysqli/tests/bug33090.phpt
index 5c1cba961..5cda386e5 100644
--- a/ext/mysqli/tests/bug33090.phpt
+++ b/ext/mysqli/tests/bug33090.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #33090
+Bug #33090 (mysql_prepare doesn't return an error)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug33263.phpt b/ext/mysqli/tests/bug33263.phpt
index 8ccb1e7e5..55285ae89 100644
--- a/ext/mysqli/tests/bug33263.phpt
+++ b/ext/mysqli/tests/bug33263.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #33263 (mysqli_real_connect in __construct)
+Bug #33263 (mysqli_real_connect in __construct)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
diff --git a/ext/mysqli/tests/bug34785.phpt b/ext/mysqli/tests/bug34785.phpt
index a2b9f2288..3fe145a5f 100644
--- a/ext/mysqli/tests/bug34785.phpt
+++ b/ext/mysqli/tests/bug34785.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #32405
+Bug #34785 (Can not properly subclass mysqli_stmt)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug34810.phpt b/ext/mysqli/tests/bug34810.phpt
index 0b8a799a8..58a3bfb6d 100644
--- a/ext/mysqli/tests/bug34810.phpt
+++ b/ext/mysqli/tests/bug34810.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #34810 (mysqli::init() and others use wrong $this pointer without checks)
+Bug #34810 (mysqli::init() and others use wrong $this pointer without checks)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug35103.phpt b/ext/mysqli/tests/bug35103.phpt
index b6118b9b2..19f7f3070 100644
--- a/ext/mysqli/tests/bug35103.phpt
+++ b/ext/mysqli/tests/bug35103.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #35103 Bad handling of unsigned bigint
+Bug #35103 (Bad handling of unsigned bigint)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug35517.phpt b/ext/mysqli/tests/bug35517.phpt
index eb1b54346..84f6e3ece 100644
--- a/ext/mysqli/tests/bug35517.phpt
+++ b/ext/mysqli/tests/bug35517.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #35517 mysqli_stmt_fetch returns NULL
+Bug #35517 (mysqli_stmt_fetch returns NULL)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug35759.phpt b/ext/mysqli/tests/bug35759.phpt
index 5f67a7624..ce598427a 100644
--- a/ext/mysqli/tests/bug35759.phpt
+++ b/ext/mysqli/tests/bug35759.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #35759 : mysqli_stmt_bind_result() makes huge allocation when column empty
+Bug #35759 (mysqli_stmt_bind_result() makes huge allocation when column empty)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug36420.phpt b/ext/mysqli/tests/bug36420.phpt
index d35485e7f..921be8568 100644
--- a/ext/mysqli/tests/bug36420.phpt
+++ b/ext/mysqli/tests/bug36420.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #36420 (segfault when access result->num_rows after calling result->close())
+Bug #36420 (segfault when access result->num_rows after calling result->close())
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug36745.phpt b/ext/mysqli/tests/bug36745.phpt
index 868015c45..980dd893e 100644
--- a/ext/mysqli/tests/bug36745.phpt
+++ b/ext/mysqli/tests/bug36745.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #36745 : LOAD DATA LOCAL INFILE doesn't return correct error message
+Bug #36745 (LOAD DATA LOCAL INFILE doesn't return correct error message)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt
index 99f863330..d3fa8b122 100644
--- a/ext/mysqli/tests/bug36802.phpt
+++ b/ext/mysqli/tests/bug36802.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #36802 : crashes with mysql_init
+Bug #36802 (crashes with mysql_init)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug36949.phpt b/ext/mysqli/tests/bug36949.phpt
index fb57df486..9c7156a1f 100644
--- a/ext/mysqli/tests/bug36949.phpt
+++ b/ext/mysqli/tests/bug36949.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #36949
+Bug #36949 (invalid internal mysqli objects dtor)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/mysqli/tests/bug37090.phpt b/ext/mysqli/tests/bug37090.phpt
index 555a0482b..fa742495e 100644
--- a/ext/mysqli/tests/bug37090.phpt
+++ b/ext/mysqli/tests/bug37090.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #37090: mysqli_set_charset return code
+Bug #37090 (mysqli_set_charset return code)
--SKIPIF--
<?php require_once('skipif.inc');
if (!function_exists('mysqli_set_charset')) {
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index 36feaf4e3..ef941111e 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.4 2007/02/12 09:36:23 tony2001 Exp $
+dnl $Id: config.m4,v 1.55.2.3.2.6 2007/05/04 11:30:37 tony2001 Exp $
dnl
if test -z "$SED"; then
@@ -26,7 +26,7 @@ AC_DEFUN([PHP_OCI_IF_DEFINED],[
AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
AC_CHECK_SIZEOF(long int, 4)
- AC_MSG_CHECKING([checking if we're at 64-bit platform])
+ AC_MSG_CHECKING([if we're on a 64-bit platform])
if test "$ac_cv_sizeof_long_int" = "4" ; then
AC_MSG_RESULT([no])
TMP_OCI8_LIB_DIR=lib32
@@ -101,7 +101,7 @@ PHP_ARG_WITH(oci8, for Oracle (OCI8) support,
Use --with-oci8=instantclient,/path/to/oic/lib
to use an Oracle Instant Client installation])
- AC_MSG_CHECKING([checking PHP version])
+ AC_MSG_CHECKING([PHP version])
tmp_version=$PHP_VERSION
if test -z "$tmp_version"; then
diff --git a/ext/oci8/tests/bug27303.phpt b/ext/oci8/tests/bug27303.phpt
index 191cdffe6..467dbfe63 100644
--- a/ext/oci8/tests/bug27303.phpt
+++ b/ext/oci8/tests/bug27303.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #27303 (OCIBindByName binds numeric PHP values as characters)
+Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
@@ -15,7 +15,7 @@ $create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
foreach ($create_st as $statement) {
$stmt = oci_parse($c, $statement);
- oci_execute($stmt);
+ @oci_execute($stmt);
}
define('MYLIMIT', 200);
diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt
index 67f3552f1..97acefa30 100644
--- a/ext/oci8/tests/bug27303_2.phpt
+++ b/ext/oci8/tests/bug27303_2.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #27303 (OCIBindByName binds numeric PHP values as characters)
+Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
diff --git a/ext/oci8/tests/bug27303_3.phpt b/ext/oci8/tests/bug27303_3.phpt
index 3a8982d30..dd8b62083 100644
--- a/ext/oci8/tests/bug27303_3.phpt
+++ b/ext/oci8/tests/bug27303_3.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #27303 (OCIBindByName binds numeric PHP values as characters)
+Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt
index 8ba4ef44b..ed178f1a7 100644
--- a/ext/oci8/tests/bug27303_4.phpt
+++ b/ext/oci8/tests/bug27303_4.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #27303 (OCIBindByName binds numeric PHP values as characters)
+Bug #27303 (OCIBindByName binds numeric PHP values as characters)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
diff --git a/ext/oci8/tests/bug32325.phpt b/ext/oci8/tests/bug32325.phpt
index 6bfcd404e..00054f51e 100644
--- a/ext/oci8/tests/bug32325.phpt
+++ b/ext/oci8/tests/bug32325.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #32325 (Can't retrieve collection using OCI8)
+Bug #32325 (Can't retrieve collection using OCI8)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
diff --git a/ext/oci8/tests/bug35973.phpt b/ext/oci8/tests/bug35973.phpt
index b62f5cfd0..81e1e58ba 100644
--- a/ext/oci8/tests/bug35973.phpt
+++ b/ext/oci8/tests/bug35973.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
+Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
--SKIPIF--
<?php if (!extension_loaded("oci8")) print "skip"; ?>
--FILE--
diff --git a/ext/oci8/tests/bug36010.phpt b/ext/oci8/tests/bug36010.phpt
index ef435496a..d451f3f2f 100644
--- a/ext/oci8/tests/bug36010.phpt
+++ b/ext/oci8/tests/bug36010.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #36010 (Crash when executing SQL statment with lob parameter twice)
+Bug #36010 (Crash when executing SQL statment with lob parameter twice)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
diff --git a/ext/oci8/tests/bug38161.phpt b/ext/oci8/tests/bug38161.phpt
index 27cfafdc8..e0fbba816 100644
--- a/ext/oci8/tests/bug38161.phpt
+++ b/ext/oci8/tests/bug38161.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
+Bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable)
--SKIPIF--
<?php if (!extension_loaded("oci8")) print "skip"; ?>
--FILE--
diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt
index 1b937c490..4714fadcd 100644
--- a/ext/oci8/tests/pecl_bug10194.phpt
+++ b/ext/oci8/tests/pecl_bug10194.phpt
@@ -44,4 +44,4 @@ require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Allowed memory size of 10485760 bytes exhausted at %s:%d (tried to allocate %d bytes) in %s on line %d
+Fatal error: Allowed memory size of 10485760 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt
index 4e7be26c7..1a44e4494 100644
--- a/ext/oci8/tests/pecl_bug10194_blob.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob.phpt
@@ -44,4 +44,4 @@ require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes) in %s on line %d
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 3163d1748..b9b240429 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: openssl.c,v 1.98.2.5.2.32 2007/04/05 18:08:42 rrichards Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.34 2007/05/19 22:05:08 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -707,11 +707,15 @@ PHP_MINIT_FUNCTION(openssl)
REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT);
/* Ciphers */
+#ifndef OPENSSL_NO_RC2
REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT);
+#endif
+#ifndef OPENSSL_NO_DES
REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT);
+#endif
/* Values for key types */
REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT);
@@ -1541,13 +1545,13 @@ cleanup:
}
/* }}} */
-/* {{{ proto bool openssl_pkcs12_read(mixed PKCS12, array &certs, string pass)
+/* {{{ proto bool openssl_pkcs12_read(string PKCS12, array &certs, string pass)
Parses a PKCS12 to an array */
PHP_FUNCTION(openssl_pkcs12_read)
{
- zval *zp12 = NULL, *zout = NULL, *zextracerts, *zcert, *zpkey;
- char * pass;
- int pass_len;
+ zval *zout = NULL, *zextracerts, *zcert, *zpkey;
+ char *pass, *zp12;
+ int pass_len, zp12_len;
PKCS12 * p12 = NULL;
EVP_PKEY * pkey = NULL;
X509 * cert = NULL;
@@ -1555,14 +1559,14 @@ PHP_FUNCTION(openssl_pkcs12_read)
BIO * bio_in = NULL;
int i;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzs", &zp12, &zout, &pass, &pass_len) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szs", &zp12, &zp12_len, &zout, &pass, &pass_len) == FAILURE)
return;
RETVAL_FALSE;
bio_in = BIO_new(BIO_s_mem());
- if(!BIO_write(bio_in, Z_STRVAL_P(zp12), Z_STRLEN_P(zp12)))
+ if(!BIO_write(bio_in, zp12, zp12_len))
goto cleanup;
if(d2i_PKCS12_bio(bio_in, &p12)) {
@@ -2928,6 +2932,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
/* sanity check the cipher */
switch (cipherid) {
+#ifndef OPENSSL_NO_RC2
case PHP_OPENSSL_CIPHER_RC2_40:
cipher = EVP_rc2_40_cbc();
break;
@@ -2937,12 +2942,17 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
case PHP_OPENSSL_CIPHER_RC2_128:
cipher = EVP_rc2_cbc();
break;
+#endif
+
+#ifndef OPENSSL_NO_DES
case PHP_OPENSSL_CIPHER_DES:
cipher = EVP_des_cbc();
break;
case PHP_OPENSSL_CIPHER_3DES:
cipher = EVP_des_ede3_cbc();
break;
+#endif
+
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid cipher type `%ld'", cipherid);
goto clean_exit;
diff --git a/ext/openssl/tests/bug28382.phpt b/ext/openssl/tests/bug28382.phpt
index 7302f59fa..255f03041 100644
--- a/ext/openssl/tests/bug28382.phpt
+++ b/ext/openssl/tests/bug28382.phpt
@@ -1,5 +1,5 @@
--TEST--
-#28382, openssl_x509_parse extensions support
+Bug #28382 (openssl_x509_parse extensions support)
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
diff --git a/ext/openssl/tests/bug36732.phpt b/ext/openssl/tests/bug36732.phpt
index 9878f4028..290c9e95e 100644
--- a/ext/openssl/tests/bug36732.phpt
+++ b/ext/openssl/tests/bug36732.phpt
@@ -1,5 +1,5 @@
--TEST--
-#36732, add support for req_extensions in openss_csr_new and sign
+Bug #36732 (add support for req_extensions in openss_csr_new and sign)
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
diff --git a/ext/openssl/tests/bug37820.phpt b/ext/openssl/tests/bug37820.phpt
index 485114e20..2eef8c5bd 100644
--- a/ext/openssl/tests/bug37820.phpt
+++ b/ext/openssl/tests/bug37820.phpt
@@ -2,7 +2,8 @@
openssl_sign/verify: accept different algos
--SKIPIF--
<?php
-if (!extension_loaded("openssl")) die("skip");
+if (!extension_loaded("openssl")) die("skip");
+if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
?>
--FILE--
<?php
diff --git a/ext/openssl/tests/bug39217.phpt b/ext/openssl/tests/bug39217.phpt
new file mode 100644
index 000000000..7895e2f3d
--- /dev/null
+++ b/ext/openssl/tests/bug39217.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #39217 (Large serial number return -1)
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+?>
+--FILE--
+<?php
+$dir = dirname(__FILE__);
+$certs = array('bug39217cert2.txt', 'bug39217cert1.txt');
+foreach($certs as $cert) {
+ $res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
+ print_r($res['serialNumber']);
+ echo "\n";
+}
+?>
+--EXPECTF--
+163040343498260435477161879008842183802
+15
diff --git a/ext/openssl/tests/bug39217cert1.txt b/ext/openssl/tests/bug39217cert1.txt
new file mode 100644
index 000000000..c3ddfb4ae
--- /dev/null
+++ b/ext/openssl/tests/bug39217cert1.txt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvzCCAiigAwIBAgIBDzANBgkqhkiG9w0BAQUFADBbMRkwFwYDVQQKExBET0Ug
+U2NpZW5jZSBHcmlkMSAwHgYDVQQLExdDZXJ0aWZpY2F0ZSBBdXRob3JpdGllczEc
+MBoGA1UEAxMTQ2VydGlmaWNhdGUgTWFuYWdlcjAeFw0wMDA4MjkyMjI4MDJaFw0w
+MTA4MjkyMjI4MDJaMHgxDTALBgNVBAoTBEdyaWQxLjAsBgNVBAoTJUxhd3JlbmNl
+IEJlcmtlbGV5IE5hdGlvbmFsIExhYm9yYXRvcnkxIDAeBgNVBAsTF0NlcnRpZmlj
+YXRlIEF1dGhvcml0aWVzMRUwEwYDVQQDEwxMQk5MLUdyaWQtQ0EwgZ8wDQYJKoZI
+hvcNAQEBBQADgY0AMIGJAoGBAL2t4aX933WXYlofuY+L+16Tdl/KxpAammyfcW8u
+kHHT6RYDjaQdfV1FpNEqfSrRjKNwGGGkrG4XHZWiUO0Di0AlBN04lsRY6jB68l6B
+5byujfZv+8EeCI2c1ObBLYZYi4lToJf0sm0Hpn3GD7PZBv6BVHLOuwEFDl9z9Dnc
+DFDdAgMBAAGjdjB0MBEGCWCGSAGG+EIBAQQEAwIAhzAOBgNVHQ8BAf8EBAMCAcYw
+HQYDVR0OBBYEFIn+csPVyp+iprpYUIu1SziMQiDxMA8GA1UdEwEB/wQFMAMBAf8w
+HwYDVR0jBBgwFoAUm85P8ry9WHAx1fIyDn6eveJRFOcwDQYJKoZIhvcNAQEFBQAD
+gYEAHindWQ4P4VUmJVt5sUGA05hSAZriDJDDnkvkm/9AR7xgGxtsy21QruhUVe2E
+eVFBws85zbwRqMpfUQyE/xHhUcka2GQTaKlBlcEjZTMnsh27Si2PMYU/UPr/PIpq
+kBkoxVV1bMWRK57mG2tzzTy9j0wkct4G5IjEsrYNDzW6U3E=
+-----END CERTIFICATE-----
diff --git a/ext/openssl/tests/bug39217cert2.txt b/ext/openssl/tests/bug39217cert2.txt
new file mode 100644
index 000000000..399618ca5
--- /dev/null
+++ b/ext/openssl/tests/bug39217cert2.txt
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC3DCCAkWgAwIBAgIQeqhtj1pzHCrTTq2AldV0ejANBgkqhkiG9w0BAQQFADAy
+MRcwFQYDVQQKEw5FLUFDSEFUIE1JTkRFRjEXMBUGA1UEAxMORS1BQ0hBVCBNSU5E
+RUYwHhcNMDQwMTA1MDAwMDAwWhcNMDYwMTA0MjM1OTU5WjCB5DEOMAwGA1UEBxQF
+UEFSSVMxCzAJBgNVBAYTAkZSMRcwFQYDVQQKFA5FLUFDSEFUIE1JTkRFRjEtMCsG
+A1UECxQkRW50LiAtIENhcCBHZW1pbmkgRXJuc3QgWW91bmcgRnJhbmNlMR8wHQYD
+VQQLFBZTSVJFTiAtIDMyODc4MTc4NjAwMDUzMTQwMgYDVQQDEytDR0VZIEZyYW5j
+ZSAtIENhcCBHZW1pbmkgRXJuc3QgWW91bmcgRnJhbmNlMSYwJAYJKoZIhvcNAQkB
+FhdkZ2FlbWEtbWNvQGNhcGdlbWluaS5mcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
+gYkCgYEApFgcuVTuUe0z+iGTaPw7yVxhZsPq6aIqGHsCvU9fqUcymbmg9l4oTfAk
+gR5bvDo+JTQb1/OPlQCKqyVa7wn6lPs97dMOZMobjCRcvw7z0jVphortA1NS8FRH
+6LsWELZ13uC57IIakpW726Vz3tST9qHHbQoWbX/n8NjHcwL4zUECAwEAAaNAMD4w
+CQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwEQYJYIZIAYb4QgEBBAQDAgeAMBEGCmCG
+SAGG+EUBBgkEAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAWdmEu8TkFdgqA/xN6llo9
+zZR3EUH0X5HstxJRYgofcQyfumJHhgvaNB8vkDhZ3iJORVVxcJ27W36TAJ6b4jcr
+yWjO/nc42XdgknS8r9NIV7VKzmjY7Ip2+9N6JOAWFkjGrnF1G69nrerIJavJTzrb
+PYlQnzJO6SHAoi5j6WsKPw==
+-----END CERTIFICATE-----
diff --git a/ext/openssl/tests/bug41353.phpt b/ext/openssl/tests/bug41353.phpt
new file mode 100644
index 000000000..47fda89f7
--- /dev/null
+++ b/ext/openssl/tests/bug41353.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #41353 (openssl_pkcs12_read() does not verify the type of the first arg)
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+?>
+--FILE--
+<?php
+
+$a = 2;
+openssl_pkcs12_read(1, $a, 1);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Done
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index c6778e06d..4b9d5a7b3 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xp_ssl.c,v 1.22.2.3.2.7 2007/04/04 10:44:55 tony2001 Exp $ */
+/* $Id: xp_ssl.c,v 1.22.2.3.2.8 2007/05/27 17:05:51 iliaa Exp $ */
#include "php.h"
#include "ext/standard/file.h"
@@ -84,7 +84,7 @@ static int is_http_stream_talking_to_iis(php_stream *stream TSRMLS_DC)
return 0;
}
-static int handle_ssl_error(php_stream *stream, int nr_bytes TSRMLS_DC)
+static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init TSRMLS_DC)
{
php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract;
int err = SSL_get_error(sslsock->ssl_handle, nr_bytes);
@@ -104,7 +104,7 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes TSRMLS_DC)
/* re-negotiation, or perhaps the SSL layer needs more
* packets: retry in next iteration */
errno = EAGAIN;
- retry = 1;
+ retry = is_init ? 1 : sslsock->s.is_blocked;
break;
case SSL_ERROR_SYSCALL:
if (ERR_peek_error() == 0) {
@@ -193,7 +193,7 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size
didwrite = SSL_write(sslsock->ssl_handle, buf, count);
if (didwrite <= 0) {
- retry = handle_ssl_error(stream, didwrite TSRMLS_CC);
+ retry = handle_ssl_error(stream, didwrite, 0 TSRMLS_CC);
} else {
break;
}
@@ -226,7 +226,7 @@ static size_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t coun
nr_bytes = SSL_read(sslsock->ssl_handle, buf, count);
if (nr_bytes <= 0) {
- retry = handle_ssl_error(stream, nr_bytes TSRMLS_CC);
+ retry = handle_ssl_error(stream, nr_bytes, 0 TSRMLS_CC);
stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle));
} else {
@@ -373,7 +373,7 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
}
if (!SSL_set_fd(sslsock->ssl_handle, sslsock->s.socket)) {
- handle_ssl_error(stream, 0 TSRMLS_CC);
+ handle_ssl_error(stream, 0, 1 TSRMLS_CC);
}
if (cparam->inputs.session) {
@@ -428,7 +428,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream,
}
if (n <= 0) {
- retry = handle_ssl_error(stream, n TSRMLS_CC);
+ retry = handle_ssl_error(stream, n, 1 TSRMLS_CC);
} else {
break;
}
diff --git a/ext/pcre/tests/bug21758.phpt b/ext/pcre/tests/bug21758.phpt
index 2479087a6..78a1d6a74 100644
--- a/ext/pcre/tests/bug21758.phpt
+++ b/ext/pcre/tests/bug21758.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #27011: preg_replace_callback() not working with class methods
+Bug #21758 (preg_replace_callback() not working with class methods)
--FILE--
<?php
class Foo {
diff --git a/ext/pcre/tests/bug27011.phpt b/ext/pcre/tests/bug27011.phpt
index 9a2434f06..6fa88ef37 100644
--- a/ext/pcre/tests/bug27011.phpt
+++ b/ext/pcre/tests/bug27011.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #27011: segfault in preg_match_all()
+Bug #27011 (segfault in preg_match_all())
--FILE--
<?php
diff --git a/ext/pcre/tests/bug38600.phpt b/ext/pcre/tests/bug38600.phpt
index 8e1f78c0e..fc954e43c 100644
--- a/ext/pcre/tests/bug38600.phpt
+++ b/ext/pcre/tests/bug38600.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #38600: infinite loop in pcre with extended class
+Bug #38600 (infinite loop in pcre with extended class)
--FILE--
<?php
$foo = 'bla bla bla';
diff --git a/ext/pcre/tests/bug40195.phpt b/ext/pcre/tests/bug40195.phpt
index 0de625c36..87ebf42a6 100644
--- a/ext/pcre/tests/bug40195.phpt
+++ b/ext/pcre/tests/bug40195.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #40195: pcre 6.7 regression
+Bug #40195 (pcre 6.7 regression)
--FILE--
<?php
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 116b37c9a..2e776870a 100755
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_dbh.c,v 1.82.2.31.2.10 2007/04/29 14:47:34 iliaa Exp $ */
+/* $Id: pdo_dbh.c,v 1.82.2.31.2.11 2007/05/16 19:33:57 iliaa Exp $ */
/* The PDO Database Handle Class */
@@ -1313,6 +1313,7 @@ void pdo_dbh_init(TSRMLS_D)
REGISTER_PDO_CLASS_CONST_LONG("FETCH_FUNC", (long)PDO_FETCH_FUNC);
REGISTER_PDO_CLASS_CONST_LONG("FETCH_GROUP",(long)PDO_FETCH_GROUP);
REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_KEY_PAIR",(long)PDO_FETCH_KEY_PAIR);
REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE);
#if PHP_MAJOR_VERSION > 5 || PHP_MINOR_VERSION >= 1
REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE);
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index cff987497..27442b76d 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.16 2007/04/17 17:00:16 tony2001 Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.18 2007/05/16 20:04:32 tony2001 Exp $ */
/* The PDO Statement Handle Class */
@@ -900,6 +900,15 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
}
break;
+ case PDO_FETCH_KEY_PAIR:
+ if (stmt->column_count != 2) {
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain extactly 2 columns." TSRMLS_CC);
+ return 0;
+ }
+
+ array_init(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);
@@ -1023,6 +1032,25 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
case PDO_FETCH_ASSOC:
add_assoc_zval(return_value, stmt->columns[i].name, val);
break;
+
+ case PDO_FETCH_KEY_PAIR:
+ {
+ zval *tmp;
+ MAKE_STD_ZVAL(tmp);
+ fetch_value(stmt, tmp, ++i, NULL TSRMLS_CC);
+
+ if (Z_TYPE_P(val) == IS_STRING) {
+ zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(val), Z_STRLEN_P(val) + 1, &tmp, sizeof(zval *), NULL);
+ } else if (Z_TYPE_P(val) == IS_LONG) {
+ zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(val), tmp, sizeof(tmp), NULL);
+ } else {
+ convert_to_string(val);
+ zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(val), Z_STRLEN_P(val) + 1, &tmp, sizeof(zval *), NULL);
+ }
+ zval_dtor(val);
+ FREE_ZVAL(val);
+ }
+ break;
case PDO_FETCH_USE_DEFAULT:
case PDO_FETCH_BOTH:
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index bf3f4adf8..5214034ff 100755
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_driver.h,v 1.66.2.11.2.4 2007/01/01 09:36:04 sebastian Exp $ */
+/* $Id: php_pdo_driver.h,v 1.66.2.11.2.5 2007/05/16 19:33:57 iliaa Exp $ */
#ifndef PHP_PDO_DRIVER_H
#define PHP_PDO_DRIVER_H
@@ -90,6 +90,7 @@ enum pdo_fetch_type {
PDO_FETCH_INTO, /* fetch row into an existing object */
PDO_FETCH_FUNC, /* fetch into function and return its result */
PDO_FETCH_NAMED, /* like PDO_FETCH_ASSOC, but can handle duplicate names */
+ PDO_FETCH_KEY_PAIR, /* fetch into an array where the 1st column is a key and all subsequent columns are values */
PDO_FETCH__MAX /* must be last */
};
diff --git a/ext/pdo/tests/bug_34630.phpt b/ext/pdo/tests/bug_34630.phpt
index dd5f6fce0..070217baf 100644
--- a/ext/pdo/tests/bug_34630.phpt
+++ b/ext/pdo/tests/bug_34630.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PHP Bug #34630: inserting streams as LOBs
+PDO Common: Bug #34630 (inserting streams as LOBs)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/bug_34687.phpt b/ext/pdo/tests/bug_34687.phpt
index 3ab78189d..dbb1471f0 100644
--- a/ext/pdo/tests/bug_34687.phpt
+++ b/ext/pdo/tests/bug_34687.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PHP Bug #34687: query doesn't return error information
+PDO Common: Bug #34687 (query doesn't return error information)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/bug_35671.phpt b/ext/pdo/tests/bug_35671.phpt
index 768773f90..8d1e11419 100644
--- a/ext/pdo/tests/bug_35671.phpt
+++ b/ext/pdo/tests/bug_35671.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PHP Bug #35671: binding by name breakage
+PDO Common: Bug #35671 (binding by name breakage)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/bug_36428.phpt b/ext/pdo/tests/bug_36428.phpt
index 6abba6bd7..703b9d4de 100755
--- a/ext/pdo/tests/bug_36428.phpt
+++ b/ext/pdo/tests/bug_36428.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PHP Bug #36428: Incorrect error message for PDO::fetchAll
+PDO Common: Bug #36428 (Incorrect error message for PDO::fetchAll())
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/bug_38253.phpt b/ext/pdo/tests/bug_38253.phpt
index 6dfdab8df..c89fba866 100644
--- a/ext/pdo/tests/bug_38253.phpt
+++ b/ext/pdo/tests/bug_38253.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PHP Bug #38253: PDO produces segfault with default fetch mode
+PDO Common: Bug #38253 (PDO produces segfault with default fetch mode)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/bug_38394.phpt b/ext/pdo/tests/bug_38394.phpt
index 38ce9bc36..be990b3b1 100644
--- a/ext/pdo/tests/bug_38394.phpt
+++ b/ext/pdo/tests/bug_38394.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PHP Bug #38394: Prepared statement error stops subsequent statements
+PDO Common: Bug #38394 (Prepared statement error stops subsequent statements)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/bug_39398.phpt b/ext/pdo/tests/bug_39398.phpt
index 7b81747cf..633771a95 100644
--- a/ext/pdo/tests/bug_39398.phpt
+++ b/ext/pdo/tests/bug_39398.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PHP Bug #39398: Booleans are not automatically translated to integers
+PDO Common: Bug #39398 (Booleans are not automatically translated to integers)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/pdo_034.phpt b/ext/pdo/tests/pdo_034.phpt
new file mode 100644
index 000000000..0f012c616
--- /dev/null
+++ b/ext/pdo/tests/pdo_034.phpt
@@ -0,0 +1,64 @@
+--TEST--
+PDO Common: PDO::FETCH_KEY_PAIR fetch mode test
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo')) die('skip');
+$dir = getenv('REDIR_TEST_DIR');
+if (false == $dir) die('skip no driver');
+require_once $dir . 'pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+$db = PDOTest::factory();
+
+$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))");
+
+for ($i = 0; $i < 5; $i++) {
+ $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
+}
+
+var_dump($db->query("SELECT a,b FROM test")->fetch(PDO::FETCH_KEY_PAIR));
+var_dump($db->query("SELECT a,b FROM test")->fetchAll(PDO::FETCH_KEY_PAIR));
+var_dump($db->query("SELECT * FROM test")->fetch(PDO::FETCH_KEY_PAIR));
+
+?>
+--EXPECTF--
+array(1) {
+ ["test0"]=>
+ string(1) "0"
+}
+array(5) {
+ [0]=>
+ array(1) {
+ ["test0"]=>
+ string(1) "0"
+ }
+ [1]=>
+ array(1) {
+ ["test1"]=>
+ string(1) "1"
+ }
+ [2]=>
+ array(1) {
+ ["test2"]=>
+ string(1) "2"
+ }
+ [3]=>
+ array(1) {
+ ["test3"]=>
+ string(1) "3"
+ }
+ [4]=>
+ array(1) {
+ ["test4"]=>
+ string(1) "4"
+ }
+}
+
+Warning: PDOStatement::fetch(): SQLSTATE[HY000]: General error: PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain extactly 2 columns. in %s/tests%spdo_034.php on line %d
+
+Warning: PDOStatement::fetch(): SQLSTATE[HY000]: General error%s/tests%spdo_034.php on line %d
+bool(false)
diff --git a/ext/pdo/tests/pecl_bug_5217.phpt b/ext/pdo/tests/pecl_bug_5217.phpt
index 0f9bc2c9d..34de925e4 100644
--- a/ext/pdo/tests/pecl_bug_5217.phpt
+++ b/ext/pdo/tests/pecl_bug_5217.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PECL Bug #5217: serialize/unserialze safety
+PDO Common: PECL Bug #5217 (serialize/unserialze safety)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/pecl_bug_5772.phpt b/ext/pdo/tests/pecl_bug_5772.phpt
index af380ff28..e38c8947e 100644
--- a/ext/pdo/tests/pecl_bug_5772.phpt
+++ b/ext/pdo/tests/pecl_bug_5772.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PECL Bug #5772 PDO::FETCH_FUNC breaks on mixed case func name
+PDO Common: PECL Bug #5772 (PDO::FETCH_FUNC breaks on mixed case func name)
--SKIPIF--
<?php # vim:ft=php:
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo/tests/pecl_bug_5809.phpt b/ext/pdo/tests/pecl_bug_5809.phpt
index fa36233e1..bb412812e 100644
--- a/ext/pdo/tests/pecl_bug_5809.phpt
+++ b/ext/pdo/tests/pecl_bug_5809.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PECL Bug #5809 PDOStatement::execute(array()) changes param
+PDO Common: PECL Bug #5809 (PDOStatement::execute(array()) changes param)
--SKIPIF--
<?php # vim:ft=php:
if (!extension_loaded('pdo')) die('skip');
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index de37ec28a..39e10530c 100755
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysql_statement.c,v 1.48.2.14.2.5 2007/04/15 16:50:42 iliaa Exp $ */
+/* $Id: mysql_statement.c,v 1.48.2.14.2.6 2007/05/17 15:12:23 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -590,6 +590,7 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_va
}
add_assoc_zval(return_value, "flags", flags);
+ add_assoc_string(return_value, "table",(F->table?F->table:""), 1);
return SUCCESS;
}
diff --git a/ext/pdo_mysql/tests/bug_33689.phpt b/ext/pdo_mysql/tests/bug_33689.phpt
index 01bfa706e..74559a145 100644
--- a/ext/pdo_mysql/tests/bug_33689.phpt
+++ b/ext/pdo_mysql/tests/bug_33689.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO MySQL Bug #33689
+PDO MySQL Bug #33689 (query() execute() and fetch() return false on valid select queries)
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
@@ -25,7 +25,7 @@ $stmt = $db->prepare('SELECT * from test');
print_r($stmt->getColumnMeta(0));
$stmt->execute();
print_r($stmt->getColumnMeta(0));
-
+?>
--EXPECTF--
object(PDOStatement)#%d (1) {
["queryString"]=>
@@ -44,6 +44,7 @@ Array
[0] => not_null
)
+ [table] => test
[name] => bar
[len] => 11
[precision] => 0
diff --git a/ext/pdo_mysql/tests/pecl_bug_5200.phpt b/ext/pdo_mysql/tests/pecl_bug_5200.phpt
index 2dffd1141..d07fe9432 100644
--- a/ext/pdo_mysql/tests/pecl_bug_5200.phpt
+++ b/ext/pdo_mysql/tests/pecl_bug_5200.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO MySQL PECL Bug #5200
+PDO MySQL PECL Bug #5200 (Describe table gives unexpected result mysql and type enum)
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
diff --git a/ext/pdo_mysql/tests/pecl_bug_5780.phpt b/ext/pdo_mysql/tests/pecl_bug_5780.phpt
index 3ee1e6e30..c2e0a7937 100644
--- a/ext/pdo_mysql/tests/pecl_bug_5780.phpt
+++ b/ext/pdo_mysql/tests/pecl_bug_5780.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO MySQL PECL Bug #5780
+PDO MySQL PECL Bug #5780 (Failure to produce an error when one is expected)
--SKIPIF--
<?php # vim:ft=php:
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
diff --git a/ext/pdo_mysql/tests/pecl_bug_5802.phpt b/ext/pdo_mysql/tests/pecl_bug_5802.phpt
index 70bd46163..fa22ecdcb 100644
--- a/ext/pdo_mysql/tests/pecl_bug_5802.phpt
+++ b/ext/pdo_mysql/tests/pecl_bug_5802.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO MySQL PECL Bug #5802
+PDO MySQL PECL Bug #5802 (bindParam/bindValue retain the is_null flag)
--SKIPIF--
<?php # vim:ft=php:
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
diff --git a/ext/pdo_oci/tests/bug_33707.phpt b/ext/pdo_oci/tests/bug_33707.phpt
index 6e53e3fb9..1ac9fa45c 100644
--- a/ext/pdo_oci/tests/bug_33707.phpt
+++ b/ext/pdo_oci/tests/bug_33707.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO OCI Bug #33707
+PDO OCI Bug #33707 (Errors in select statements not reported)
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h
index 44861dd7f..fab288d9d 100644
--- a/ext/pdo_odbc/php_pdo_odbc.h
+++ b/ext/pdo_odbc/php_pdo_odbc.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_odbc.h,v 1.2.4.2 2007/01/01 09:36:05 sebastian Exp $ */
+/* $Id: php_pdo_odbc.h,v 1.2.4.3 2007/05/28 12:19:41 bjori Exp $ */
#ifndef PHP_PDO_ODBC_H
#define PHP_PDO_ODBC_H
@@ -40,8 +40,6 @@ PHP_RINIT_FUNCTION(pdo_odbc);
PHP_RSHUTDOWN_FUNCTION(pdo_odbc);
PHP_MINFO_FUNCTION(pdo_odbc);
-PHP_FUNCTION(confirm_pdo_odbc_compiled); /* For testing, remove later. */
-
/*
Declare any global variables you may need between the BEGIN
and END macros here:
diff --git a/ext/pdo_pgsql/tests/bug_33876.phpt b/ext/pdo_pgsql/tests/bug_33876.phpt
index fc9d20f69..0ec04e8bd 100644
--- a/ext/pdo_pgsql/tests/bug_33876.phpt
+++ b/ext/pdo_pgsql/tests/bug_33876.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO PgSQL Bug #33876
+PDO PgSQL Bug #33876 (PDO misquotes/miscasts bool(false))
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
diff --git a/ext/pdo_sqlite/sqlite/VERSION b/ext/pdo_sqlite/sqlite/VERSION
index 272a1ca30..e9f0bde54 100644
--- a/ext/pdo_sqlite/sqlite/VERSION
+++ b/ext/pdo_sqlite/sqlite/VERSION
@@ -1 +1 @@
-3.3.16
+3.3.17
diff --git a/ext/pdo_sqlite/sqlite/src/btree.c b/ext/pdo_sqlite/sqlite/src/btree.c
index 3df2a3b01..2e2843735 100644
--- a/ext/pdo_sqlite/sqlite/src/btree.c
+++ b/ext/pdo_sqlite/sqlite/src/btree.c
@@ -1870,7 +1870,10 @@ static int lockBtree(BtShared *pBt){
if( memcmp(page1, zMagicHeader, 16)!=0 ){
goto page1_init_failed;
}
- if( page1[18]>1 || page1[19]>1 ){
+ if( page1[18]>1 ){
+ pBt->readOnly = 1;
+ }
+ if( page1[19]>1 ){
goto page1_init_failed;
}
pageSize = get2byte(&page1[16]);
@@ -2068,11 +2071,15 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
if( pBt->pPage1==0 ){
rc = lockBtree(pBt);
}
-
+
if( rc==SQLITE_OK && wrflag ){
- rc = sqlite3PagerBegin(pBt->pPage1->pDbPage, wrflag>1);
- if( rc==SQLITE_OK ){
- rc = newDatabase(pBt);
+ if( pBt->readOnly ){
+ rc = SQLITE_READONLY;
+ }else{
+ rc = sqlite3PagerBegin(pBt->pPage1->pDbPage, wrflag>1);
+ if( rc==SQLITE_OK ){
+ rc = newDatabase(pBt);
+ }
}
}
@@ -2782,6 +2789,9 @@ int sqlite3BtreeCursor(
if( rc!=SQLITE_OK ){
return rc;
}
+ if( pBt->readOnly && wrFlag ){
+ return SQLITE_READONLY;
+ }
}
pCur = sqliteMalloc( sizeof(*pCur) );
if( pCur==0 ){
@@ -3519,26 +3529,22 @@ int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
int rc;
MemPage *pPage;
-#ifndef SQLITE_OMIT_SHARED_CACHE
rc = restoreOrClearCursorPosition(pCur);
if( rc!=SQLITE_OK ){
return rc;
}
-#endif
assert( pRes!=0 );
pPage = pCur->pPage;
if( CURSOR_INVALID==pCur->eState ){
*pRes = 1;
return SQLITE_OK;
}
-#ifndef SQLITE_OMIT_SHARED_CACHE
if( pCur->skip>0 ){
pCur->skip = 0;
*pRes = 0;
return SQLITE_OK;
}
pCur->skip = 0;
-#endif
assert( pPage->isInit );
assert( pCur->idx<pPage->nCell );
@@ -3589,24 +3595,20 @@ int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
Pgno pgno;
MemPage *pPage;
-#ifndef SQLITE_OMIT_SHARED_CACHE
rc = restoreOrClearCursorPosition(pCur);
if( rc!=SQLITE_OK ){
return rc;
}
-#endif
if( CURSOR_INVALID==pCur->eState ){
*pRes = 1;
return SQLITE_OK;
}
-#ifndef SQLITE_OMIT_SHARED_CACHE
if( pCur->skip<0 ){
pCur->skip = 0;
*pRes = 0;
return SQLITE_OK;
}
pCur->skip = 0;
-#endif
pPage = pCur->pPage;
assert( pPage->isInit );
diff --git a/ext/pdo_sqlite/sqlite/src/expr.c b/ext/pdo_sqlite/sqlite/src/expr.c
index 4ba63d54b..3cfac3e2e 100644
--- a/ext/pdo_sqlite/sqlite/src/expr.c
+++ b/ext/pdo_sqlite/sqlite/src/expr.c
@@ -237,12 +237,12 @@ Expr *sqlite3Expr(int op, Expr *pLeft, Expr *pRight, const Token *pToken){
}else if( pLeft ){
if( pRight ){
sqlite3ExprSpan(pNew, &pLeft->span, &pRight->span);
- if( pRight->flags && EP_ExpCollate ){
+ if( pRight->flags & EP_ExpCollate ){
pNew->flags |= EP_ExpCollate;
pNew->pColl = pRight->pColl;
}
}
- if( pLeft->flags && EP_ExpCollate ){
+ if( pLeft->flags & EP_ExpCollate ){
pNew->flags |= EP_ExpCollate;
pNew->pColl = pLeft->pColl;
}
diff --git a/ext/pdo_sqlite/sqlite/src/keywordhash.h b/ext/pdo_sqlite/sqlite/src/keywordhash.h
index 11b40e47f..cdf8b630e 100644
--- a/ext/pdo_sqlite/sqlite/src/keywordhash.h
+++ b/ext/pdo_sqlite/sqlite/src/keywordhash.h
@@ -2,7 +2,7 @@
**
** The code in this file has been automatically generated by
**
-** $Header: /repository/php-src/ext/pdo_sqlite/sqlite/src/keywordhash.h,v 1.2.2.1.2.3 2007/04/18 22:53:46 iliaa Exp $
+** $Header: /repository/php-src/ext/pdo_sqlite/sqlite/src/keywordhash.h,v 1.2.2.1.2.4 2007/05/16 21:04:46 iliaa Exp $
**
** The code in this file implements a function that determines whether
** or not a given identifier is really an SQL keyword. The same thing
diff --git a/ext/pdo_sqlite/sqlite/src/legacy.c b/ext/pdo_sqlite/sqlite/src/legacy.c
index 00c0f9eef..085ce8dd7 100644
--- a/ext/pdo_sqlite/sqlite/src/legacy.c
+++ b/ext/pdo_sqlite/sqlite/src/legacy.c
@@ -44,7 +44,6 @@ int sqlite3_exec(
char **azCols = 0;
int nRetry = 0;
- int nChange = 0;
int nCallback;
if( zSql==0 ) return SQLITE_OK;
@@ -64,7 +63,6 @@ int sqlite3_exec(
continue;
}
- db->nChange += nChange;
nCallback = 0;
nCol = sqlite3_column_count(pStmt);
@@ -101,9 +99,6 @@ int sqlite3_exec(
if( rc!=SQLITE_ROW ){
rc = sqlite3_finalize(pStmt);
pStmt = 0;
- if( db->pVdbe==0 ){
- nChange = db->nChange;
- }
if( rc!=SQLITE_SCHEMA ){
nRetry = 0;
zSql = zLeftover;
diff --git a/ext/pdo_sqlite/sqlite/src/loadext.c b/ext/pdo_sqlite/sqlite/src/loadext.c
index dc4dc7e28..b435de21d 100644
--- a/ext/pdo_sqlite/sqlite/src/loadext.c
+++ b/ext/pdo_sqlite/sqlite/src/loadext.c
@@ -37,28 +37,32 @@
#endif
#ifdef SQLITE_OMIT_AUTHORIZATION
-# define sqlite3_set_authorizer 0
+# define sqlite3_set_authorizer 0
#endif
#ifdef SQLITE_OMIT_UTF16
-# define sqlite3_bind_text16 0
-# define sqlite3_collation_needed16 0
-# define sqlite3_column_decltype16 0
-# define sqlite3_column_name16 0
-# define sqlite3_column_text16 0
-# define sqlite3_complete16 0
-# define sqlite3_create_collation16 0
-# define sqlite3_create_function16 0
-# define sqlite3_errmsg16 0
-# define sqlite3_open16 0
-# define sqlite3_prepare16 0
-# define sqlite3_result_error16 0
-# define sqlite3_result_text16 0
-# define sqlite3_result_text16be 0
-# define sqlite3_result_text16le 0
-# define sqlite3_value_text16 0
-# define sqlite3_value_text16be 0
-# define sqlite3_value_text16le 0
+# define sqlite3_bind_text16 0
+# define sqlite3_collation_needed16 0
+# define sqlite3_column_decltype16 0
+# define sqlite3_column_name16 0
+# define sqlite3_column_text16 0
+# define sqlite3_complete16 0
+# define sqlite3_create_collation16 0
+# define sqlite3_create_function16 0
+# define sqlite3_errmsg16 0
+# define sqlite3_open16 0
+# define sqlite3_prepare16 0
+# define sqlite3_prepare16_v2 0
+# define sqlite3_result_error16 0
+# define sqlite3_result_text16 0
+# define sqlite3_result_text16be 0
+# define sqlite3_result_text16le 0
+# define sqlite3_value_text16 0
+# define sqlite3_value_text16be 0
+# define sqlite3_value_text16le 0
+# define sqlite3_column_database_name16 0
+# define sqlite3_column_table_name16 0
+# define sqlite3_column_origin_name16 0
#endif
#ifdef SQLITE_OMIT_COMPLETE
diff --git a/ext/pdo_sqlite/sqlite/src/prepare.c b/ext/pdo_sqlite/sqlite/src/prepare.c
index 6e2bee34c..8804ee0cc 100644
--- a/ext/pdo_sqlite/sqlite/src/prepare.c
+++ b/ext/pdo_sqlite/sqlite/src/prepare.c
@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
-** $Id: prepare.c,v 1.1.2.2.2.3 2007/04/09 16:35:11 iliaa Exp $
+** $Id: prepare.c,v 1.1.2.2.2.4 2007/05/16 21:04:46 iliaa Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -537,13 +537,15 @@ int sqlite3Prepare(
if( sqlite3SafetyOff(db) ){
rc = SQLITE_MISUSE;
}
- if( rc==SQLITE_OK ){
- if( saveSqlFlag ){
- sqlite3VdbeSetSql(sParse.pVdbe, zSql, sParse.zTail - zSql);
- }
- *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
- }else if( sParse.pVdbe ){
+
+ if( saveSqlFlag ){
+ sqlite3VdbeSetSql(sParse.pVdbe, zSql, sParse.zTail - zSql);
+ }
+ if( rc!=SQLITE_OK || sqlite3MallocFailed() ){
sqlite3_finalize((sqlite3_stmt*)sParse.pVdbe);
+ assert(!(*ppStmt));
+ }else{
+ *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
}
if( zErrMsg ){
diff --git a/ext/pdo_sqlite/sqlite/src/test1.c b/ext/pdo_sqlite/sqlite/src/test1.c
index 7448de0e6..a277f8355 100644
--- a/ext/pdo_sqlite/sqlite/src/test1.c
+++ b/ext/pdo_sqlite/sqlite/src/test1.c
@@ -580,6 +580,7 @@ static void hex8Func(sqlite3_context *p, int argc, sqlite3_value **argv){
zBuf[i*2] = 0;
sqlite3_result_text(p, (char*)zBuf, -1, SQLITE_TRANSIENT);
}
+#ifndef SQLITE_OMIT_UTF16
static void hex16Func(sqlite3_context *p, int argc, sqlite3_value **argv){
const unsigned short int *z;
int i;
@@ -591,6 +592,7 @@ static void hex16Func(sqlite3_context *p, int argc, sqlite3_value **argv){
zBuf[i*4] = 0;
sqlite3_result_text(p, (char*)zBuf, -1, SQLITE_TRANSIENT);
}
+#endif
/*
** A structure into which to accumulate text.
@@ -742,10 +744,12 @@ static int test_create_function(
rc = sqlite3_create_function(db, "hex8", 1, SQLITE_ANY, 0,
hex8Func, 0, 0);
}
+#ifndef SQLITE_OMIT_UTF16
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "hex16", 1, SQLITE_ANY, 0,
hex16Func, 0, 0);
}
+#endif
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "tkt2213func", 1, SQLITE_ANY, 0,
tkt2213Function, 0, 0);
@@ -2748,6 +2752,7 @@ static int test_prepare_v2(
if( Tcl_GetIntFromObj(interp, objv[3], &bytes) ) return TCL_ERROR;
rc = sqlite3_prepare_v2(db, zSql, bytes, &pStmt, &zTail);
+ assert(rc==SQLITE_OK || pStmt==0);
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
if( zTail ){
if( bytes>=0 ){
diff --git a/ext/pdo_sqlite/sqlite/src/vdbe.c b/ext/pdo_sqlite/sqlite/src/vdbe.c
index 9bbc65a2e..19c73f6e4 100644
--- a/ext/pdo_sqlite/sqlite/src/vdbe.c
+++ b/ext/pdo_sqlite/sqlite/src/vdbe.c
@@ -2369,7 +2369,11 @@ case OP_AutoCommit: { /* no-push */
return SQLITE_BUSY;
}
}
- return SQLITE_DONE;
+ if( p->rc==SQLITE_OK ){
+ return SQLITE_DONE;
+ }else{
+ return SQLITE_ERROR;
+ }
}else{
sqlite3SetString(&p->zErrMsg,
(!i)?"cannot start a transaction within a transaction":(
diff --git a/ext/pdo_sqlite/sqlite/src/vtab.c b/ext/pdo_sqlite/sqlite/src/vtab.c
index 502120f64..2b3b2acf0 100644
--- a/ext/pdo_sqlite/sqlite/src/vtab.c
+++ b/ext/pdo_sqlite/sqlite/src/vtab.c
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to help implement virtual tables.
**
-** $Id: vtab.c,v 1.1.2.3 2007/04/18 22:53:46 iliaa Exp $
+** $Id: vtab.c,v 1.1.2.4 2007/05/16 21:04:46 iliaa Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
@@ -132,10 +132,12 @@ void sqlite3VtabBeginParse(
int iDb; /* The database the table is being created in */
Table *pTable; /* The new virtual table */
+#ifndef SQLITE_OMIT_SHARED_CACHE
if( sqlite3ThreadDataReadOnly()->useSharedData ){
sqlite3ErrorMsg(pParse, "Cannot use virtual tables in shared-cache mode");
return;
}
+#endif
sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, 0);
pTable = pParse->pNewTable;
@@ -531,16 +533,18 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab)
*/
static void callFinaliser(sqlite3 *db, int offset){
int i;
- for(i=0; i<db->nVTrans && db->aVTrans[i]; i++){
- sqlite3_vtab *pVtab = db->aVTrans[i];
- int (*x)(sqlite3_vtab *);
- x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
- if( x ) x(pVtab);
- sqlite3VtabUnlock(db, pVtab);
+ if( db->aVTrans ){
+ for(i=0; i<db->nVTrans && db->aVTrans[i]; i++){
+ sqlite3_vtab *pVtab = db->aVTrans[i];
+ int (*x)(sqlite3_vtab *);
+ x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
+ if( x ) x(pVtab);
+ sqlite3VtabUnlock(db, pVtab);
+ }
+ sqliteFree(db->aVTrans);
+ db->nVTrans = 0;
+ db->aVTrans = 0;
}
- sqliteFree(db->aVTrans);
- db->nVTrans = 0;
- db->aVTrans = 0;
}
/*
diff --git a/ext/pdo_sqlite/sqlite/src/where.c b/ext/pdo_sqlite/sqlite/src/where.c
index ac3df19d5..1da790656 100644
--- a/ext/pdo_sqlite/sqlite/src/where.c
+++ b/ext/pdo_sqlite/sqlite/src/where.c
@@ -26,11 +26,6 @@
#define BMS (sizeof(Bitmask)*8)
/*
-** Determine the number of elements in an array.
-*/
-#define ARRAYSIZE(X) (sizeof(X)/sizeof(X[0]))
-
-/*
** Trace output macros
*/
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
@@ -195,7 +190,7 @@ static void whereClauseInit(
pWC->pParse = pParse;
pWC->pMaskSet = pMaskSet;
pWC->nTerm = 0;
- pWC->nSlot = ARRAYSIZE(pWC->aStatic);
+ pWC->nSlot = ArraySize(pWC->aStatic);
pWC->a = pWC->aStatic;
}
@@ -310,7 +305,7 @@ static Bitmask getMask(ExprMaskSet *pMaskSet, int iCursor){
** array will never overflow.
*/
static void createMask(ExprMaskSet *pMaskSet, int iCursor){
- assert( pMaskSet->n < ARRAYSIZE(pMaskSet->ix) );
+ assert( pMaskSet->n < ArraySize(pMaskSet->ix) );
pMaskSet->ix[pMaskSet->n++] = iCursor;
}
diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt
index c60e11c19..40bd915e8 100644
--- a/ext/pgsql/tests/80_bug14383.phpt
+++ b/ext/pgsql/tests/80_bug14383.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #14383
+Bug #14383 (using postgres with DBA causes DBA not to be able to find any keys)
--SKIPIF--
<?php
require_once(dirname(__FILE__).'/../../dba/tests/skipif.inc');
@@ -34,4 +34,4 @@ array(3) {
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
-} \ No newline at end of file
+}
diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt
index ddb3c58a2..32e789de8 100755
--- a/ext/pgsql/tests/80_bug24499.phpt
+++ b/ext/pgsql/tests/80_bug24499.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #24499 Notice: Undefined property: stdClass::
+Bug #24499 (Notice: Undefined property: stdClass::)
--SKIPIF--
<?php
require_once('skipif.inc');
diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt
index b27d6e94f..7d5b5db89 100755
--- a/ext/pgsql/tests/80_bug27597.phpt
+++ b/ext/pgsql/tests/80_bug27597.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #27597 pg_fetch_array not returning false
+Bug #27597 (pg_fetch_array not returning false)
--SKIPIF--
<?php
require_once('skipif.inc');
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index ac0c325c7..f74b4fe07 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.164.2.33.2.37 2007/04/12 18:39:46 johannes Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.39 2007/05/29 08:44:05 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -707,11 +707,10 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry
if (fptr->common.fn_flags & ZEND_ACC_DEPRECATED) {
string_printf(str, ", deprecated");
}
-#if MBO_0
if (fptr->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function*)fptr)->module) {
string_printf(str, ":%s", ((zend_internal_function*)fptr)->module->name);
}
-#endif
+
if (scope && fptr->common.scope) {
if (fptr->common.scope != scope) {
string_printf(str, ", inherits %s", fptr->common.scope->name);
@@ -837,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) {
@@ -1741,7 +1740,6 @@ ZEND_METHOD(reflection_function, getParameters)
}
/* }}} */
-#if MBO_0
/* {{{ proto public ReflectionExtension|NULL ReflectionFunction::getExtension()
Returns NULL or the extension the function belongs to */
ZEND_METHOD(reflection_function, getExtension)
@@ -1765,9 +1763,7 @@ ZEND_METHOD(reflection_function, getExtension)
}
}
/* }}} */
-#endif
-#if MBO_0
/* {{{ proto public string|false ReflectionFunction::getExtensionName()
Returns false or the name of the extension the function belongs to */
ZEND_METHOD(reflection_function, getExtensionName)
@@ -1791,7 +1787,6 @@ ZEND_METHOD(reflection_function, getExtensionName)
}
}
/* }}} */
-#endif
/* {{{ proto public static mixed ReflectionParameter::export(mixed function, mixed parameter [, bool return]) throws ReflectionException
Exports a reflection object. Returns the output if TRUE is specified for return, printing it otherwise. */
@@ -1956,7 +1951,6 @@ ZEND_METHOD(reflection_parameter, getName)
}
/* }}} */
-#if MBO_0
/* {{{ proto public ReflectionFunction ReflectionParameter::getDeclaringFunction()
Returns the ReflectionFunction for the function of this parameter */
ZEND_METHOD(reflection_parameter, getDeclaringFunction)
@@ -1974,7 +1968,6 @@ ZEND_METHOD(reflection_parameter, getDeclaringFunction)
}
}
/* }}} */
-#endif
/* {{{ proto public ReflectionClass|NULL ReflectionParameter::getDeclaringClass()
Returns in which class this parameter is defined (not the typehint of the parameter) */
@@ -2089,7 +2082,6 @@ ZEND_METHOD(reflection_parameter, isPassedByReference)
}
/* }}} */
-#if MBO_0
/* {{{ proto public bool ReflectionParameter::getPosition()
Returns whether this parameter is an optional parameter */
ZEND_METHOD(reflection_parameter, getPosition)
@@ -2103,7 +2095,6 @@ ZEND_METHOD(reflection_parameter, getPosition)
RETVAL_LONG(param->offset);
}
/* }}} */
-#endif
/* {{{ proto public bool ReflectionParameter::isOptional()
Returns whether this parameter is an optional parameter */
@@ -4458,10 +4449,8 @@ static zend_function_entry reflection_function_abstract_functions[] = {
ZEND_ME(reflection_function, getParameters, NULL, 0)
ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
-#if MBO_0
ZEND_ME(reflection_function, getExtension, NULL, 0)
ZEND_ME(reflection_function, getExtensionName, NULL, 0)
-#endif
ZEND_ME(reflection_function, isDeprecated, NULL, 0)
{NULL, NULL, NULL}
};
@@ -4735,16 +4724,12 @@ static zend_function_entry reflection_parameter_functions[] = {
ZEND_ME(reflection_parameter, __toString, NULL, 0)
ZEND_ME(reflection_parameter, getName, NULL, 0)
ZEND_ME(reflection_parameter, isPassedByReference, NULL, 0)
-#if MBO_0
ZEND_ME(reflection_parameter, getDeclaringFunction, NULL, 0)
-#endif
ZEND_ME(reflection_parameter, getDeclaringClass, NULL, 0)
ZEND_ME(reflection_parameter, getClass, NULL, 0)
ZEND_ME(reflection_parameter, isArray, NULL, 0)
ZEND_ME(reflection_parameter, allowsNull, NULL, 0)
-#if MBO_0
ZEND_ME(reflection_parameter, getPosition, NULL, 0)
-#endif
ZEND_ME(reflection_parameter, isOptional, NULL, 0)
ZEND_ME(reflection_parameter, isDefaultValueAvailable, NULL, 0)
ZEND_ME(reflection_parameter, getDefaultValue, NULL, 0)
@@ -4893,7 +4878,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.37 2007/04/12 18:39:46 johannes Exp $");
+ php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.39 2007/05/29 08:44:05 helly Exp $");
php_info_print_table_end();
} /* }}} */
diff --git a/ext/session/session.c b/ext/session/session.c
index 2b4524687..b2a4ac7d5 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c,v 1.417.2.8.2.33 2007/04/04 19:52:19 tony2001 Exp $ */
+/* $Id: session.c,v 1.417.2.8.2.34 2007/05/16 01:18:14 stas Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1283,8 +1283,11 @@ PHPAPI void php_session_start(TSRMLS_D)
char *q;
p += lensess + 1;
- if ((q = strpbrk(p, "/?\\")))
+ if ((q = strpbrk(p, "/?\\"))) {
PS(id) = estrndup(p, q - p);
+ PS(send_cookie) = 0;
+ }
+
}
/* check whether the current request was referred to by
diff --git a/ext/session/tests/007.phpt b/ext/session/tests/007.phpt
index 7ed74ea47..ae3c232eb 100644
--- a/ext/session/tests/007.phpt
+++ b/ext/session/tests/007.phpt
@@ -10,6 +10,7 @@ register_globals=1
session.bug_compat_42=1
session.serialize_handler=php
session.save_handler=files
+precision=14
--FILE--
<?php
error_reporting(E_ALL);
diff --git a/ext/session/tests/008-php4.2.3.phpt b/ext/session/tests/008-php4.2.3.phpt
index 537858a36..b6485b3b4 100644
--- a/ext/session/tests/008-php4.2.3.phpt
+++ b/ext/session/tests/008-php4.2.3.phpt
@@ -18,6 +18,7 @@ display_errors=1
error_reporting=2039;
session.serialize_handler=php
session.save_handler=files
+precision=14
--FILE--
<?php
session_id("abtest");
diff --git a/ext/session/tests/bug31454.phpt b/ext/session/tests/bug31454.phpt
index 67f4f3b42..dd6099621 100644
--- a/ext/session/tests/bug31454.phpt
+++ b/ext/session/tests/bug31454.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #31454 (session_set_save_handler crashes PHP when supplied non-existent object ref)
+Bug #31454 (session_set_save_handler crashes PHP when supplied non-existent object ref)
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
diff --git a/ext/session/tests/bug36459.phpt b/ext/session/tests/bug36459.phpt
index 26ff8684f..0a2f95e7e 100644
--- a/ext/session/tests/bug36459.phpt
+++ b/ext/session/tests/bug36459.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
+Bug #31454 (Incorrect adding PHPSESSID to links, which contains \r\n)
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
diff --git a/ext/session/tests/bug38377.phpt b/ext/session/tests/bug38377.phpt
index 514e45963..bd33bddbd 100644
--- a/ext/session/tests/bug38377.phpt
+++ b/ext/session/tests/bug38377.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #38377 (session_destroy() gives warning after session_regenerate_id())
+Bug #38377 (session_destroy() gives warning after session_regenerate_id())
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
diff --git a/ext/simplexml/tests/bug37565.phpt b/ext/simplexml/tests/bug37565.phpt
index e04f9577f..019fc7169 100755
--- a/ext/simplexml/tests/bug37565.phpt
+++ b/ext/simplexml/tests/bug37565.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #37565 Using reflection::export with simplexml causing a crash
+Bug #37565 (Using reflection::export with simplexml causing a crash)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index b82bf7dbe..af7a8e1f1 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.103.2.21.2.32 2007/05/02 17:24:16 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.21.2.33 2007/05/04 06:19:34 dmitry Exp $ */
#include <time.h>
@@ -1595,6 +1595,8 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
property = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(node, property);
set_xsi_nil(property);
+ } else if (Z_TYPE_P(data) == IS_NULL && model->min_occurs == 0) {
+ return 1;
} else {
property = master_to_xml(enc, data, style, node);
if (property->children && property->children->content &&
@@ -3356,8 +3358,12 @@ static int is_map(zval *array)
int i, count = zend_hash_num_elements(Z_ARRVAL_P(array));
zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
- for (i = 0;i < count;i++) {
- if (zend_hash_get_current_key_type(Z_ARRVAL_P(array)) == HASH_KEY_IS_STRING) {
+ for (i = 0; i < count; i++) {
+ char *str_index;
+ ulong num_index;
+
+ if (zend_hash_get_current_key(Z_ARRVAL_P(array), &str_index, &num_index, 0) == HASH_KEY_IS_STRING ||
+ num_index != i) {
return TRUE;
}
zend_hash_move_forward(Z_ARRVAL_P(array));
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index d41bf6997..137c49e6d 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -17,11 +17,12 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.77.2.11.2.8 2007/02/24 02:17:26 helly Exp $ */
+/* $Id: php_http.c,v 1.77.2.11.2.10 2007/05/10 21:52:10 tony2001 Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
#include "ext/standard/md5.h"
+#include "ext/standard/php_rand.h"
static char *get_http_header_value(char *headers, char *type);
static int get_http_body(php_stream *socketd, int close, char *headers, char **response, int *out_size TSRMLS_DC);
@@ -469,10 +470,9 @@ try_again:
char HA1[33], HA2[33], response[33], cnonce[33], nc[9];
PHP_MD5_CTX md5ctx;
unsigned char hash[16];
- unsigned int ctx;
PHP_MD5Init(&md5ctx);
- snprintf(cnonce, sizeof(cnonce), "%d", php_rand_r(&ctx));
+ snprintf(cnonce, sizeof(cnonce), "%ld", php_rand(TSRMLS_C));
PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, strlen(cnonce));
PHP_MD5Final(hash, &md5ctx);
make_digest(cnonce, hash);
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index e2d830c44..ba53cdc6e 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_sdl.c,v 1.88.2.12.2.7 2007/02/23 20:40:55 stas Exp $ */
+/* $Id: php_sdl.c,v 1.88.2.12.2.9 2007/05/21 13:13:50 dmitry Exp $ */
#include "php_soap.h"
#include "ext/libxml/php_libxml.h"
@@ -654,6 +654,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
for (i = 0; i < n; i++) {
xmlNodePtr *tmp, service;
xmlNodePtr trav, port;
+ int has_soap_port = 0;
zend_hash_get_current_data(&ctx.services, (void **)&tmp);
service = *tmp;
@@ -716,8 +717,15 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
trav2 = trav2->next;
}
if (!address) {
- soap_error0(E_ERROR, "Parsing WSDL: No address associated with <port>");
+ if (has_soap_port || trav->next || i < n-1) {
+ efree(tmpbinding);
+ trav = trav->next;
+ continue;
+ } else {
+ soap_error0(E_ERROR, "Parsing WSDL: No address associated with <port>");
+ }
}
+ has_soap_port = 1;
location = get_attribute(address->properties, "location");
if (!location) {
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 1b26a8df3..5b5b3e80e 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.156.2.28.2.23 2007/05/02 08:22:13 dmitry Exp $ */
+/* $Id: soap.c,v 1.156.2.28.2.25 2007/05/27 17:46:46 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -140,8 +140,6 @@ static void soap_error_handler(int error_num, const char *error_filename, const
SOAP_GLOBAL(soap_version) = _old_soap_version;
#endif
-#define HTTP_RAW_POST_DATA "HTTP_RAW_POST_DATA"
-
#define ZERO_PARAM() \
if (ZEND_NUM_ARGS() != 0) \
WRONG_PARAM_COUNT;
@@ -316,11 +314,11 @@ ZEND_BEGIN_ARG_INFO(__call_args, 0)
ZEND_ARG_PASS_INFO(0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(__soap_call_args, 0, 0, 2)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(1)
+ ZEND_ARG_INFO(0, function_name)
+ ZEND_ARG_INFO(0, arguments)
+ ZEND_ARG_INFO(0, options)
+ ZEND_ARG_INFO(0, input_headers)
+ ZEND_ARG_INFO(1, output_headers)
ZEND_END_ARG_INFO()
#else
unsigned char __call_args[] = { 2, BYREF_NONE, BYREF_NONE };
@@ -1403,7 +1401,7 @@ PHP_METHOD(SoapServer, handle)
sdlPtr old_sdl = NULL;
soapServicePtr service;
xmlDocPtr doc_request=NULL, doc_return;
- zval function_name, **params, **raw_post, *soap_obj, retval;
+ zval function_name, **params, *soap_obj, retval;
char *fn_name, cont_len[30];
int num_params = 0, size, i, call_status = 0;
xmlChar *buf;
@@ -1478,8 +1476,9 @@ PHP_METHOD(SoapServer, handle)
}
if (ZEND_NUM_ARGS() == 0) {
- if (zend_hash_find(&EG(symbol_table), HTTP_RAW_POST_DATA, sizeof(HTTP_RAW_POST_DATA), (void **) &raw_post)!=FAILURE
- && ((*raw_post)->type==IS_STRING)) {
+ if (SG(request_info).raw_post_data) {
+ char *post_data = SG(request_info).raw_post_data;
+ int post_data_length = SG(request_info).raw_post_data_length;
zval **server_vars, **encoding;
zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
@@ -1497,13 +1496,13 @@ PHP_METHOD(SoapServer, handle)
zend_hash_exists(EG(function_table), "gzinflate", sizeof("gzinflate"))) {
ZVAL_STRING(&func, "gzinflate", 0);
params[0] = &param;
- ZVAL_STRINGL(params[0], Z_STRVAL_PP(raw_post)+10, Z_STRLEN_PP(raw_post)-10, 0);
+ ZVAL_STRINGL(params[0], post_data+10, post_data_length-10, 0);
INIT_PZVAL(params[0]);
} else if (strcmp(Z_STRVAL_PP(encoding),"deflate") == 0 &&
zend_hash_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress"))) {
ZVAL_STRING(&func, "gzuncompress", 0);
params[0] = &param;
- ZVAL_STRINGL(params[0], Z_STRVAL_PP(raw_post), Z_STRLEN_PP(raw_post), 0);
+ ZVAL_STRINGL(params[0], post_data, post_data_length, 0);
INIT_PZVAL(params[0]);
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR,"Request is compressed with unknown compression '%s'",Z_STRVAL_PP(encoding));
@@ -1516,16 +1515,9 @@ PHP_METHOD(SoapServer, handle)
php_error_docref(NULL TSRMLS_CC, E_ERROR,"Can't uncompress compressed request");
}
} else {
- doc_request = soap_xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
+ doc_request = soap_xmlParseMemory(post_data, post_data_length);
}
} else {
- if (SG(request_info).request_method &&
- strcmp(SG(request_info).request_method, "POST") == 0) {
- if (!zend_ini_long("always_populate_raw_post_data", sizeof("always_populate_raw_post_data"), 0)) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "PHP-SOAP requires 'always_populate_raw_post_data' to be on please check your php.ini file");
- }
- }
- soap_server_fault("Server", "Bad Request. Can't find HTTP_RAW_POST_DATA", NULL, NULL, NULL TSRMLS_CC);
return;
}
} else {
diff --git a/ext/soap/tests/any.phpt b/ext/soap/tests/any.phpt
index 054319fe3..3805f3f3a 100755
--- a/ext/soap/tests/any.phpt
+++ b/ext/soap/tests/any.phpt
@@ -2,6 +2,8 @@
SOAP handling of <any>
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPComplexType {
diff --git a/ext/soap/tests/bugs/bug28751.phpt b/ext/soap/tests/bugs/bug28751.phpt
index e850b7f75..1f382f39f 100644
--- a/ext/soap/tests/bugs/bug28751.phpt
+++ b/ext/soap/tests/bugs/bug28751.phpt
@@ -29,7 +29,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/bugs/bug29839.phpt b/ext/soap/tests/bugs/bug29839.phpt
index fb75b8be2..f14866954 100644
--- a/ext/soap/tests/bugs/bug29839.phpt
+++ b/ext/soap/tests/bugs/bug29839.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #29839 incorrect convert (xml:lang to lang)
+Bug #29839 (incorrect convert (xml:lang to lang))
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
@@ -38,4 +38,4 @@ echo "ok\n";
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri"><SOAP-ENV:Body><string xml:lang="en"><ns1:value>hello</ns1:value></string></SOAP-ENV:Body></SOAP-ENV:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri"><SOAP-ENV:Body><string xml:lang="en"><ns1:value>hello</ns1:value></string></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok \ No newline at end of file
+ok
diff --git a/ext/soap/tests/bugs/bug30106.phpt b/ext/soap/tests/bugs/bug30106.phpt
index a17aa1768..1745f5698 100644
--- a/ext/soap/tests/bugs/bug30106.phpt
+++ b/ext/soap/tests/bugs/bug30106.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #30106 SOAP cannot not parse 'ref' element. Causes Uncaught SoapFault exception.
+Bug #30106 (SOAP cannot not parse 'ref' element. Causes Uncaught SoapFault exception)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug30799.phpt b/ext/soap/tests/bugs/bug30799.phpt
index 3e902bfb2..c478c7372 100644
--- a/ext/soap/tests/bugs/bug30799.phpt
+++ b/ext/soap/tests/bugs/bug30799.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #30799 SoapServer doesn't handle private or protected properties
+Bug #30799 (SoapServer doesn't handle private or protected properties)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug30928.phpt b/ext/soap/tests/bugs/bug30928.phpt
index 2a013aed5..a4873af1c 100644
--- a/ext/soap/tests/bugs/bug30928.phpt
+++ b/ext/soap/tests/bugs/bug30928.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #30928 When Using WSDL, SoapServer doesn't handle private or protected properties
+Bug #30928 (When Using WSDL, SoapServer doesn't handle private or protected properties)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug30994.phpt b/ext/soap/tests/bugs/bug30994.phpt
index 0b9f3a281..4d0d933d1 100644
--- a/ext/soap/tests/bugs/bug30994.phpt
+++ b/ext/soap/tests/bugs/bug30994.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #30994 SOAP server unable to handle request with references
+Bug #30994 (SOAP server unable to handle request with references)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
@@ -40,7 +40,7 @@ function bassCall() {
$x = new SoapServer(NULL, array("uri"=>"http://spock/kunta/kunta"));
$x->addFunction("bassCall");
-$x->handle();
+$x->handle($HTTP_RAW_POST_DATA);
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt
index 4103d05f3..b10f4ecc4 100644
--- a/ext/soap/tests/bugs/bug31422.phpt
+++ b/ext/soap/tests/bugs/bug31422.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31422 No Error-Logging on SoapServer-Side
+Bug #31422 (No Error-Logging on SoapServer-Side)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
@@ -32,7 +32,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECTF--
diff --git a/ext/soap/tests/bugs/bug31695.phpt b/ext/soap/tests/bugs/bug31695.phpt
index 8277ce623..0779e3db4 100644
--- a/ext/soap/tests/bugs/bug31695.phpt
+++ b/ext/soap/tests/bugs/bug31695.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31695 Cannot redefine endpoint when using WSDL
+Bug #31695 (Cannot redefine endpoint when using WSDL)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt
index 7901d6e0b..a0f8a4c48 100644
--- a/ext/soap/tests/bugs/bug31755.phpt
+++ b/ext/soap/tests/bugs/bug31755.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31422 No Error-Logging on SoapServer-Side
+Bug #31422 (No Error-Logging on SoapServer-Side)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug32776.phpt b/ext/soap/tests/bugs/bug32776.phpt
index fd6dcdf42..6736fb4be 100644
--- a/ext/soap/tests/bugs/bug32776.phpt
+++ b/ext/soap/tests/bugs/bug32776.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #32776 SOAP doesn't support one-way operations
+Bug #32776 (SOAP doesn't support one-way operations)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug34453.phpt b/ext/soap/tests/bugs/bug34453.phpt
index 60277ca72..8e2501761 100755
--- a/ext/soap/tests/bugs/bug34453.phpt
+++ b/ext/soap/tests/bugs/bug34453.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #29839 incorrect convert (xml:lang to lang)
+Bug #29839 (incorrect convert (xml:lang to lang))
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
@@ -38,4 +38,4 @@ echo "ok\n";
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri"><SOAP-ENV:Body><string xml:lang="en"><ns1:value>hello</ns1:value></string></SOAP-ENV:Body></SOAP-ENV:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri"><SOAP-ENV:Body><string xml:lang="en"><ns1:value>hello</ns1:value></string></SOAP-ENV:Body></SOAP-ENV:Envelope>
-ok \ No newline at end of file
+ok
diff --git a/ext/soap/tests/bugs/bug35142.phpt b/ext/soap/tests/bugs/bug35142.phpt
index 7ab49430c..8d366c8f3 100755
--- a/ext/soap/tests/bugs/bug35142.phpt
+++ b/ext/soap/tests/bugs/bug35142.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #35142 SOAP Client/Server Complex Object Support
+Bug #35142 (SOAP Client/Server Complex Object Support)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
diff --git a/ext/soap/tests/bugs/bug35273.phpt b/ext/soap/tests/bugs/bug35273.phpt
index 9c33d891c..cd238bad1 100755
--- a/ext/soap/tests/bugs/bug35273.phpt
+++ b/ext/soap/tests/bugs/bug35273.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #35273 Error in mapping soap - java types
+Bug #35273 (Error in mapping soap - java types)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug36226.phpt b/ext/soap/tests/bugs/bug36226.phpt
index 2d3461d61..8d3d42b89 100755
--- a/ext/soap/tests/bugs/bug36226.phpt
+++ b/ext/soap/tests/bugs/bug36226.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #36226 SOAP Inconsistent handling when passing potential arrays.
+Bug #36226 (SOAP Inconsistent handling when passing potential arrays)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
diff --git a/ext/soap/tests/bugs/bug36629.phpt b/ext/soap/tests/bugs/bug36629.phpt
index 7982cfa6b..b22345363 100755
--- a/ext/soap/tests/bugs/bug36629.phpt
+++ b/ext/soap/tests/bugs/bug36629.phpt
@@ -27,7 +27,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0" encoding="ISO-8859-1"?>
@@ -42,7 +42,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/bugs/bug39815.phpt b/ext/soap/tests/bugs/bug39815.phpt
index ced64cddf..1bc49b1f9 100755
--- a/ext/soap/tests/bugs/bug39815.phpt
+++ b/ext/soap/tests/bugs/bug39815.phpt
@@ -7,6 +7,8 @@ if (!function_exists('setlocale')) die('skip setlocale() not available');
if (!@setlocale(LC_ALL, 'sv_SE', 'sv_SE.ISO8859-1')) die('skip sv_SE locale not available');
if (!@setlocale(LC_ALL, 'en_US', 'en_US.ISO8859-1')) die('skip en_US locale not available');
?>
+--INI--
+precision=14
--FILE--
<?php
function test(){
diff --git a/ext/soap/tests/bugs/bug39832.phpt b/ext/soap/tests/bugs/bug39832.phpt
index b8510f32c..527ca897b 100755
--- a/ext/soap/tests/bugs/bug39832.phpt
+++ b/ext/soap/tests/bugs/bug39832.phpt
@@ -22,7 +22,7 @@ function Test($x) {
$x = new SoapServer(dirname(__FILE__)."/bug39832.wsdl");
$x->addFunction("Test");
-$x->handle();
+$x->handle($HTTP_RAW_POST_DATA);
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
diff --git a/ext/soap/tests/bugs/bug41004.phpt b/ext/soap/tests/bugs/bug41004.phpt
index 7359ead38..743ae9d3f 100755
--- a/ext/soap/tests/bugs/bug41004.phpt
+++ b/ext/soap/tests/bugs/bug41004.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #41004 minOccurs="0" and null class member variable
+Bug #41004 (minOccurs="0" and null class member variable)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug41337.phpt b/ext/soap/tests/bugs/bug41337.phpt
new file mode 100755
index 000000000..8f44e2781
--- /dev/null
+++ b/ext/soap/tests/bugs/bug41337.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41337 (WSDL parsing doesn't ignore non soap bindings)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ini_set("soap.wsdl_cache_enabled",0);
+$client = new SoapClient(dirname(__FILE__)."/bug41337.wsdl");
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/soap/tests/bugs/bug41337.wsdl b/ext/soap/tests/bugs/bug41337.wsdl
new file mode 100755
index 000000000..14e5dc4b4
--- /dev/null
+++ b/ext/soap/tests/bugs/bug41337.wsdl
@@ -0,0 +1,63 @@
+<?xml version="1.0" ?>
+<definitions
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:si="http://soapinterop.org/xsd"
+ xmlns:tns="http://linuxsrv.home/~dmitry/soap/test.wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
+
+ <types>
+ <xsd:schema targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
+ <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
+ <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
+ </xsd:schema>
+ </types>
+
+ <message name="AddRequest">
+ <part name="x" type="xsd:double" />
+ <part name="y" type="xsd:double" />
+ </message>
+ <message name="AddResponse">
+ <part name="result" type="xsd:double" />
+ </message>
+
+ <portType name="TestServicePortType">
+ <operation name="Add">
+ <input message="tns:AddRequest" />
+ <output message="tns:AddResponse" />
+ </operation>
+ </portType>
+
+ <binding name="TestServiceBinding2" type="tns:TestServicePortType">
+ <operation name="Add">
+ <input/>
+ <output/>
+ </operation>
+ </binding>
+
+ <binding name="TestServiceBinding" type="tns:TestServicePortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="Add">
+ <soap:operation soapAction="Add" style="rpc" />
+ <input>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+ </input>
+ <output>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+ </output>
+ </operation>
+ </binding>
+
+ <service name="TestService">
+ <port name="TestServicePort2" binding="tns:TestServiceBinding"/>
+ <port name="TestServicePort" binding="tns:TestServiceBinding">
+ <soap:address location="http://linuxsrv.home/~dmitry/soap/soap_server.php" />
+ </port>
+ </service>
+
+</definitions>
diff --git a/ext/soap/tests/bugs/bug41337_2.phpt b/ext/soap/tests/bugs/bug41337_2.phpt
new file mode 100755
index 000000000..0e4504e73
--- /dev/null
+++ b/ext/soap/tests/bugs/bug41337_2.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41337 (WSDL parsing doesn't ignore non soap bindings)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ini_set("soap.wsdl_cache_enabled",0);
+$client = new SoapClient(dirname(__FILE__)."/bug41337_2.wsdl");
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/soap/tests/bugs/bug41337_2.wsdl b/ext/soap/tests/bugs/bug41337_2.wsdl
new file mode 100755
index 000000000..46c078a0e
--- /dev/null
+++ b/ext/soap/tests/bugs/bug41337_2.wsdl
@@ -0,0 +1,36 @@
+<?xml version="1.0" ?>
+<definitions
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:si="http://soapinterop.org/xsd"
+ xmlns:tns="http://linuxsrv.home/~dmitry/soap/test.wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
+
+ <import namespace="http://linuxsrv.home/~dmitry/soap/test.wsdl"
+ location="bug41337_2_1.wsdl" />
+
+ <binding name="TestServiceBinding" type="tns:TestServicePortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="Add">
+ <soap:operation soapAction="Add" style="rpc" />
+ <input>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+ </input>
+ <output>
+ <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+ </output>
+ </operation>
+ </binding>
+
+ <service name="TestService">
+ <port name="TestServicePort" binding="tns:TestServiceBinding">
+ <soap:address location="http://linuxsrv.home/~dmitry/soap/soap_server.php" />
+ </port>
+ </service>
+
+</definitions>
diff --git a/ext/soap/tests/bugs/bug41337_2_1.wsdl b/ext/soap/tests/bugs/bug41337_2_1.wsdl
new file mode 100755
index 000000000..857dc6ccf
--- /dev/null
+++ b/ext/soap/tests/bugs/bug41337_2_1.wsdl
@@ -0,0 +1,47 @@
+<?xml version="1.0" ?>
+<definitions
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:si="http://soapinterop.org/xsd"
+ xmlns:tns="http://linuxsrv.home/~dmitry/soap/test.wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
+
+ <types>
+ <xsd:schema targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
+ <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
+ <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
+ </xsd:schema>
+ </types>
+
+ <message name="AddRequest">
+ <part name="x" type="xsd:double" />
+ <part name="y" type="xsd:double" />
+ </message>
+ <message name="AddResponse">
+ <part name="result" type="xsd:double" />
+ </message>
+
+ <portType name="TestServicePortType">
+ <operation name="Add">
+ <input message="tns:AddRequest" />
+ <output message="tns:AddResponse" />
+ </operation>
+ </portType>
+
+ <binding name="TestServiceBinding2" type="tns:TestServicePortType">
+ <operation name="Add">
+ <input/>
+ <output/>
+ </operation>
+ </binding>
+
+ <service name="TestService2">
+ <port name="TestServicePort2" binding="tns:TestServiceBinding"/>
+ </service>
+
+</definitions>
diff --git a/ext/soap/tests/bugs/bug41477.phpt b/ext/soap/tests/bugs/bug41477.phpt
new file mode 100644
index 000000000..a103e6920
--- /dev/null
+++ b/ext/soap/tests/bugs/bug41477.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #41477 (no arginfo about SoapClient::__soapCall())
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$objRfClass = new ReflectionClass('SoapClient');
+$objRfMethod = $objRfClass->getMethod('__soapCall');
+$arrParams = $objRfMethod->getParameters();
+foreach($arrParams as $objRfParam)
+{
+ var_dump($objRfParam->getName());
+}
+?>
+--EXPECT--
+string(13) "function_name"
+string(9) "arguments"
+string(7) "options"
+string(13) "input_headers"
+string(14) "output_headers"
diff --git a/ext/soap/tests/classmap001.phpt b/ext/soap/tests/classmap001.phpt
index 1908ddd1e..6ac81aae3 100644
--- a/ext/soap/tests/classmap001.phpt
+++ b/ext/soap/tests/classmap001.phpt
@@ -41,7 +41,7 @@ $options=Array(
$server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
$server->setClass("test");
-$server->handle();
+$server->handle($GLOBALS['HTTP_RAW_POST_DATA']);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_012p.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_012p.phpt
index b30abdc2d..1a8e186b4 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_012p.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_012p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 012 (php/direct): echoFloat
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_012s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_012s.phpt
index 107814bc8..c235e7323 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_012s.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_012s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 012 (soap/direct): echoFloat
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","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 aae41109c..a48ac7b23 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 012 (php/wsdl): echoFloat
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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_013p.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_013p.phpt
index 940a3ddbd..0a1b9d17a 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_013p.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_013p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 013 (php/direct): echoFloatArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_013s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_013s.phpt
index 67dbe28cc..f83e8f73e 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_013s.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_013s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 013 (soap/direct): echoFloatArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = new SoapParam(new SoapVar(array(
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 428860414..8481de447 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 013 (php/wsdl): echoFloatArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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_014p.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_014p.phpt
index 986d7e40b..59608c2a8 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_014p.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_014p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 014 (php/direct): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt
index 7e3ac0f65..191add359 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 014 (soap/direct): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = new SoapParam(new SoapVar(array(
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 a601c9fa6..104f244e3 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 014 (php/wsdl): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_015p.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_015p.phpt
index 702da37b9..d6dc55bd0 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_015p.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_015p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 015 (php/direct): echoStructArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt
index dafb53065..7a50b9bcc 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 015 (soap/direct): echoStructArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 9ffd2e5e1..51d344f24 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 base 015 (php/wsdl): echoStructArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round2/Base/round2_base.inc b/ext/soap/tests/interop/Round2/Base/round2_base.inc
index b197f5bdd..29879547d 100644
--- a/ext/soap/tests/interop/Round2/Base/round2_base.inc
+++ b/ext/soap/tests/interop/Round2/Base/round2_base.inc
@@ -76,5 +76,5 @@ class SOAP_Interop_Base {
$server = new SoapServer(dirname(__FILE__)."/round2_base.wsdl");
$server->setClass("SOAP_Interop_Base");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001p.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001p.phpt
index 756b7eb52..e3bc42f8e 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001p.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 001 (php/direct): echoStructAsSimpleTypes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001s.phpt
index e036bf4ca..b0b40f7d7 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001s.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 001 (soap/direct): echoStructAsSimpleTypes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = new SoapParam(new SoapVar(array(
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 3e74c451c..b47df6a68 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 001 (php/wsdl): echoStructAsSimpleTypes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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_002p.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002p.phpt
index e5c994394..c6f04dbcc 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002p.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 002 (php/direct): echoSimpleTypesAsStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002s.phpt
index 6ad0d5b86..744b3deaa 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002s.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 002 (soap/direct): echoSimpleTypesAsStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","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 54d2a5302..610d866be 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 002 (php/wsdl): echoSimpleTypesAsStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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_004p.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004p.phpt
index 0649e85cf..e0147b038 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004p.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 004 (php/direct): echoNestedStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = (object)array(
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt
index 48c3bda9d..c207e721a 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 004 (soap/direct): echoNestedStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = new SoapParam(new SoapVar(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 26c75fdec..4393ad9bb 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 004 (php/wsdl): echoNestedStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = (object)array(
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005p.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005p.phpt
index 6848d8592..e4a4b8ee2 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005p.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005p.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 005 (php/direct): echoNestedArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = (object)array(
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt
index e08f2602d..b734e4560 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 005 (soap/direct): echoNestedArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$param = new SoapParam(new SoapVar(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 53475102b..f38866b37 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt
@@ -2,6 +2,8 @@
SOAP Interop Round2 groupB 005 (php/wsdl): echoNestedArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 ef00e3bfd..a40f09cc4 100644
--- a/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
+++ b/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
@@ -33,5 +33,5 @@ class SOAP_Interop_GroupB {
$server = new SoapServer(dirname(__FILE__)."/round2_groupB.wsdl");
$server->setClass("SOAP_Interop_GroupB");
-$server->handle();
+$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 8718693cb..1fef6bae4 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Compound1 001 (php/wsdl): echoPerson
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class Person {
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 79830f410..6534047ad 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Compound2 001 (php/wsdl): echoEmployee
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class Person {
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 c9c217292..8529cbd73 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit 003 (php/wsdl): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
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 0c3aa1cdd..0531daf40 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Doc Lit Parameters 003 (php/wsdl): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
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 4795eb157..06e403679 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Import2 001 (php/wsdl): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 a142cf1f0..2f7721ab1 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Import3 001 (php/wsdl): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 1a670731a..29fb6f3e5 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD Import3 002 (php/wsdl): echoStructArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
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 a3c2bc049..f8d6cef1d 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
@@ -2,6 +2,8 @@
SOAP Interop Round3 GroupD RPC Encoded 003 (php/wsdl): echoStruct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPStruct {
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound1.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound1.inc
index 0525b0b51..8e2866995 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound1.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound1.inc
@@ -13,5 +13,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_compound1.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound2.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound2.inc
index 81b96cdbf..8f470bad7 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound2.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound2.inc
@@ -8,5 +8,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_compound2.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclit.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclit.inc
index 8ca0338f5..a9da5653e 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclit.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclit.inc
@@ -24,5 +24,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_doclit.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclitparams.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclitparams.inc
index 2042cfc17..6561ff135 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclitparams.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclitparams.inc
@@ -25,5 +25,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_doclitparams.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_emptysa.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_emptysa.inc
index b239c4543..ee38a1213 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_emptysa.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_emptysa.inc
@@ -10,5 +10,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_emptysa.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import1.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import1.inc
index 2e56d1897..ecde53e15 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import1.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import1.inc
@@ -10,5 +10,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_import1.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2.inc
index a0893c6b7..5957c374a 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2.inc
@@ -10,5 +10,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_import2.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import3.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import3.inc
index 398f97ecf..3a3df9791 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import3.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import3.inc
@@ -15,5 +15,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_import3.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_rpcenc.inc b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_rpcenc.inc
index 645ab3a61..e88df3312 100644
--- a/ext/soap/tests/interop/Round3/GroupD/round3_groupD_rpcenc.inc
+++ b/ext/soap/tests/interop/Round3/GroupD/round3_groupD_rpcenc.inc
@@ -24,5 +24,5 @@ class SOAP_Interop_GroupD {
$server = new SoapServer(dirname(__FILE__)."/round3_groupD_rpcenc.wsdl");
$server->setClass("SOAP_Interop_GroupD");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupE/round3_groupE_list.inc b/ext/soap/tests/interop/Round3/GroupE/round3_groupE_list.inc
index 83454c077..19a769c00 100644
--- a/ext/soap/tests/interop/Round3/GroupE/round3_groupE_list.inc
+++ b/ext/soap/tests/interop/Round3/GroupE/round3_groupE_list.inc
@@ -12,6 +12,6 @@ class SOAP_Interop_GroupE {
$server = new SoapServer(dirname(__FILE__)."/round3_groupE_list.wsdl");
$server->setClass("SOAP_Interop_GroupE");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
var_dump($d);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupF/round3_groupF_ext.inc b/ext/soap/tests/interop/Round3/GroupF/round3_groupF_ext.inc
index 44bc83bdc..e90586efd 100644
--- a/ext/soap/tests/interop/Round3/GroupF/round3_groupF_ext.inc
+++ b/ext/soap/tests/interop/Round3/GroupF/round3_groupF_ext.inc
@@ -10,5 +10,5 @@ class SOAP_Interop_GroupF {
$server = new SoapServer(dirname(__FILE__)."/round3_groupF_ext.wsdl");
$server->setClass("SOAP_Interop_GroupF");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round3/GroupF/round3_groupF_headers.inc b/ext/soap/tests/interop/Round3/GroupF/round3_groupF_headers.inc
index ee6581119..b7e67b0f5 100644
--- a/ext/soap/tests/interop/Round3/GroupF/round3_groupF_headers.inc
+++ b/ext/soap/tests/interop/Round3/GroupF/round3_groupF_headers.inc
@@ -18,5 +18,5 @@ class SOAP_Interop_GroupF {
$server = new SoapServer(dirname(__FILE__)."/round3_groupF_ext.wsdl");
$server->setClass("SOAP_Interop_GroupF");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?> \ No newline at end of file
diff --git a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimedoc.inc b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimedoc.inc
index c2a27186d..bf95d0aef 100644
--- a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimedoc.inc
+++ b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimedoc.inc
@@ -29,5 +29,5 @@ class SOAP_Interop_GroupG {
$server = new SoapServer(dirname(__FILE__)."/round4_groupG_dimedoc.wsdl");
$server->setClass("SOAP_Interop_GroupG");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimerpc.inc b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimerpc.inc
index 2f3c00aa1..9dcbed73a 100644
--- a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimerpc.inc
+++ b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimerpc.inc
@@ -29,5 +29,5 @@ class SOAP_Interop_GroupG {
$server = new SoapServer(dirname(__FILE__)."/round4_groupG_dimerpc.wsdl");
$server->setClass("SOAP_Interop_GroupG");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimedoc.inc b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimedoc.inc
index 8ed272ed1..ef9d9b8c7 100644
--- a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimedoc.inc
+++ b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimedoc.inc
@@ -21,5 +21,5 @@ class SOAP_Interop_GroupG {
$server = new SoapServer(dirname(__FILE__)."/round4_groupG_dimedoc.wsdl");
$server->setClass("SOAP_Interop_GroupG");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimerpc.inc b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimerpc.inc
index 8ed272ed1..ef9d9b8c7 100644
--- a/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimerpc.inc
+++ b/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimerpc.inc
@@ -21,5 +21,5 @@ class SOAP_Interop_GroupG {
$server = new SoapServer(dirname(__FILE__)."/round4_groupG_dimedoc.wsdl");
$server->setClass("SOAP_Interop_GroupG");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
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 fd898a1e2..25ddc3af7 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 001 (php/wsdl): echoSOAPStructFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 22275ac4f..cbb58ae72 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 002 (php/wsdl): echoBaseStructFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 3fb4e1154..621574c3d 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 003 (php/wsdl): echoExtendedStructFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 42ea0eef2..5309fab21 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 004 (php/wsdl): echoMultipleFaults1(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 34e9baf7d..24498004f 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 005 (php/wsdl): echoMultipleFaults1(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 db21c2e51..fd799b666 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex Doc Lit 006 (php/wsdl): echoMultipleFaults1(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 b8a550410..29998414f 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 001 (php/wsdl): echoSOAPStructFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 e8d555246..a91410586 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 002 (php/wsdl): echoBaseStructFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 c0212a558..baf1f13db 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 003 (php/wsdl): echoExtendedStructFault
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 9d1eb61cd..eb0fc3e73 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 004 (php/wsdl): echoMultipleFaults1(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 9ca53bbd7..45c89a654 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 005 (php/wsdl): echoMultipleFaults1(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 61d9a6b7c..b7e3debaa 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 006 (php/wsdl): echoMultipleFaults1(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 d76711dd2..7b74828d4 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 007 (php/wsdl): echoMultipleFaults2(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 e409ef7b7..6dda13aaa 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 008 (php/wsdl): echoMultipleFaults2(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 1c9ccafa4..1b512166c 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 009 (php/wsdl): echoMultipleFaults2(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 f0acdbdc0..7f8ebbe2e 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Complex RPC Enc 010 (php/wsdl): echoMultipleFaults2(4)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class BaseStruct {
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 00530b56c..1d2068ada 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 004 (php/wsdl): echoMultipleFaults1(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 ac77defb8..9179233f2 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 005 (php/wsdl): echoMultipleFaults1(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 5246dad51..7d85cafd8 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 006 (php/wsdl): echoMultipleFaults1(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 acf66959c..023f4d595 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 007 (php/wsdl): echoMultipleFaults1(4)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 27c9623db..b34ed31a8 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 008 (php/wsdl): echoMultipleFaults2(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 783e52047..f184f51c7 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 009 (php/wsdl): echoMultipleFaults2(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 8d05a088d..dc8416c5b 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 010 (php/wsdl): echoMultipleFaults2(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 0af808b48..0992c3574 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple Doc Lit 011 (php/wsdl): echoMultipleFaults2(4)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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_004w.phpt b/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt
index b8907d562..abe697f27 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 004 (php/wsdl): echoMultipleFaults1(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 5822e7a72..b4da77e7a 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 005 (php/wsdl): echoMultipleFaults1(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 ee75cbdfe..f49d6fdef 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 006 (php/wsdl): echoMultipleFaults1(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 704257f7e..8decba9bf 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 007 (php/wsdl): echoMultipleFaults1(4)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 e85a6480e..7b743bddf 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 008 (php/wsdl): echoMultipleFaults2(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 999cd2892..792542a63 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 009 (php/wsdl): echoMultipleFaults2(2)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 ae7ffa76f..784648cda 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 010 (php/wsdl): echoMultipleFaults2(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 7278d6758..892638022 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupH Simple RPC Enc 011 (php/wsdl): echoMultipleFaults2(4)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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/round4_groupH_complex_doclit.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc
index 1c31aa3da..a27f96e27 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc
@@ -34,5 +34,5 @@ class SOAP_Interop_GroupH {
$server = new SoapServer(dirname(__FILE__)."/round4_groupH_complex_doclit.wsdl");
$server->setClass("SOAP_Interop_GroupH");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc
index 6dec18647..52165ba56 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc
@@ -34,5 +34,5 @@ class SOAP_Interop_GroupH {
$server = new SoapServer(dirname(__FILE__)."/round4_groupH_complex_rpcenc.wsdl");
$server->setClass("SOAP_Interop_GroupH");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc
index 6a04cfd2d..e0e35f182 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc
@@ -52,5 +52,5 @@ class SOAP_Interop_GroupH {
$server = new SoapServer(dirname(__FILE__)."/round4_groupH_simple_doclit.wsdl");
$server->setClass("SOAP_Interop_GroupH");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc
index 0b85a34f9..d39f06096 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc
@@ -52,5 +52,5 @@ class SOAP_Interop_GroupH {
$server = new SoapServer(dirname(__FILE__)."/round4_groupH_simple_rpcenc.wsdl");
$server->setClass("SOAP_Interop_GroupH");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_soapfault.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_soapfault.inc
index cf6c3741c..a92484e1d 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_soapfault.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_soapfault.inc
@@ -18,5 +18,5 @@ class SOAP_Interop_GroupH {
$server = new SoapServer(dirname(__FILE__)."/round4_groupH_soapfault.wsdl");
$server->setClass("SOAP_Interop_GroupH");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
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 705e2a976..d12ecd4d0 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 003 (php/wsdl): echoFloat
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 4f7c0f9d7..f8e65cf00 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 008 (php/wsdl): echoComplexType
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 25fa95287..7388a874c 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 009 (php/wsdl): echoComplexType(minOccur=0)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPComplexType {
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 1362a310e..f0d3c8712 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 011 (php/wsdl): echoFloatMultiOccurs
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 052333a27..97e816419 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 014 (php/wsdl): echoComplexTypeMultiOccurs(1)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 ac7de377b..87542911d 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 015 (php/wsdl): echoComplexTypeMultiOccurs(nil)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPComplexType {
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 3673be2a6..5c605bcc8 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 019 (php/wsdl): echoComplexTypeAsSimpleTypes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 4ba0fda7d..3faaaf111 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 020 (php/wsdl): echoComplexTypeAsSimpleTypes(minOccurs=0)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 23c9598eb..98da2702d 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 021 (php/wsdl): echoSimpleTypesAsComplexType
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 bbe48d21c..4f294c54e 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 022 (php/wsdl): echoSimpleTypesAsComplexType(minOccurs=0)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 97fcb02b3..0d6832eec 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 023 (php/wsdl): echoNestedComplexType
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 94f178724..faf8041c0 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 024 (php/wsdl): echoNestedComplexType(minOccurs=0)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 37c67014d..a9813aa7b 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 025 (php/wsdl): echoNestedMultiOccurs
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPMultiOccursComplexType {
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 22366b437..723870dd8 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 028 (php/wsdl): echoAnyType
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
class SOAPComplexType {
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 2a366fdaa..5068b5f3a 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 032 (php/wsdl): echoVoidSoapHeader(3)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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 846d2a0e2..dc03cda72 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 033 (php/wsdl): echoVoidSoapHeader(4)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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_035w.phpt b/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt
index 183783d01..19c0e23f9 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
@@ -2,6 +2,8 @@
SOAP Interop Round4 GroupI XSD 035 (php/wsdl): echoVoidSoapHeader(6)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--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/interop/Round4/GroupI/round4_groupI_xsd.inc b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc
index 0c50f199e..74ca5775f 100644
--- a/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc
+++ b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc
@@ -194,5 +194,5 @@ class SOAP_Interop_GroupI {
$server = new SoapServer(dirname(__FILE__)."/round4_groupI_xsd.wsdl");
$server->setClass("SOAP_Interop_GroupI");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
?>
diff --git a/ext/soap/tests/schema/schema004.phpt b/ext/soap/tests/schema/schema004.phpt
index b851f7605..93ed1d17f 100644
--- a/ext/soap/tests/schema/schema004.phpt
+++ b/ext/soap/tests/schema/schema004.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 4: simpleType/restriction (reference to undefined type)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
@@ -17,4 +19,4 @@ echo "ok";
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test><testParam xsi:type="ns1:testType">123.5</testParam></ns1:test></SOAP-ENV:Body></SOAP-ENV:Envelope>
string(5) "123.5"
-ok \ No newline at end of file
+ok
diff --git a/ext/soap/tests/schema/schema014.phpt b/ext/soap/tests/schema/schema014.phpt
index 0ffff86e6..3dab5f350 100644
--- a/ext/soap/tests/schema/schema014.phpt
+++ b/ext/soap/tests/schema/schema014.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 14: simpleType/union
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/schema016.phpt b/ext/soap/tests/schema/schema016.phpt
index 462fc7140..11e9436bc 100644
--- a/ext/soap/tests/schema/schema016.phpt
+++ b/ext/soap/tests/schema/schema016.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 16: simpleType/union (inline type)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/schema017.phpt b/ext/soap/tests/schema/schema017.phpt
index e7674cfc4..6689c363e 100644
--- a/ext/soap/tests/schema/schema017.phpt
+++ b/ext/soap/tests/schema/schema017.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 17: union with list
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/schema020.phpt b/ext/soap/tests/schema/schema020.phpt
index 3ceb3de62..344757a32 100644
--- a/ext/soap/tests/schema/schema020.phpt
+++ b/ext/soap/tests/schema/schema020.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 20: union with list
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/schema022.phpt b/ext/soap/tests/schema/schema022.phpt
index fd598f624..a8f5bb9ca 100644
--- a/ext/soap/tests/schema/schema022.phpt
+++ b/ext/soap/tests/schema/schema022.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 22: list of unions
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/schema054.phpt b/ext/soap/tests/schema/schema054.phpt
index b1ff74e41..5adf2f588 100644
--- a/ext/soap/tests/schema/schema054.phpt
+++ b/ext/soap/tests/schema/schema054.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 54: Apache Map
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/schema055.phpt b/ext/soap/tests/schema/schema055.phpt
index f6ead2f13..14dbdb7c1 100644
--- a/ext/soap/tests/schema/schema055.phpt
+++ b/ext/soap/tests/schema/schema055.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 55: Apache Map (extension)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/schema063.phpt b/ext/soap/tests/schema/schema063.phpt
index dd60422a2..7fda578d9 100644
--- a/ext/soap/tests/schema/schema063.phpt
+++ b/ext/soap/tests/schema/schema063.phpt
@@ -2,6 +2,8 @@
SOAP XML Schema 63: standard unsignedLong type
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
include "test_schema.inc";
diff --git a/ext/soap/tests/schema/test_schema.inc b/ext/soap/tests/schema/test_schema.inc
index 06e139b40..8c7d9d034 100644
--- a/ext/soap/tests/schema/test_schema.inc
+++ b/ext/soap/tests/schema/test_schema.inc
@@ -66,7 +66,7 @@ EOF;
if ($style == "rpc") {
$HTTP_RAW_POST_DATA = $req;
ob_start();
- $y->handle();
+ $y->handle($HTTP_RAW_POST_DATA);
ob_end_clean();
echo $req;
var_dump($val);
diff --git a/ext/soap/tests/server001.phpt b/ext/soap/tests/server001.phpt
index 582759f06..649e01365 100644
--- a/ext/soap/tests/server001.phpt
+++ b/ext/soap/tests/server001.phpt
@@ -24,7 +24,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server002.phpt b/ext/soap/tests/server002.phpt
index 8416f4fb0..d0a53b8cc 100644
--- a/ext/soap/tests/server002.phpt
+++ b/ext/soap/tests/server002.phpt
@@ -28,7 +28,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server003.phpt b/ext/soap/tests/server003.phpt
index d4a15e0d6..a808c6f3e 100644
--- a/ext/soap/tests/server003.phpt
+++ b/ext/soap/tests/server003.phpt
@@ -23,7 +23,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server004.phpt b/ext/soap/tests/server004.phpt
index 5bfef4fcd..5d98d3f5e 100644
--- a/ext/soap/tests/server004.phpt
+++ b/ext/soap/tests/server004.phpt
@@ -31,7 +31,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server005.phpt b/ext/soap/tests/server005.phpt
index 4aae3b2d9..9536771be 100644
--- a/ext/soap/tests/server005.phpt
+++ b/ext/soap/tests/server005.phpt
@@ -27,7 +27,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server006.phpt b/ext/soap/tests/server006.phpt
index f382d9f2f..da328ebfe 100644
--- a/ext/soap/tests/server006.phpt
+++ b/ext/soap/tests/server006.phpt
@@ -33,7 +33,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server009.phpt b/ext/soap/tests/server009.phpt
index 0a7b30f40..0a3412715 100644
--- a/ext/soap/tests/server009.phpt
+++ b/ext/soap/tests/server009.phpt
@@ -37,7 +37,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
ob_clean();
$HTTP_RAW_POST_DATA = <<<EOF
@@ -55,7 +55,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
ob_end_flush();
echo "ok\n";
diff --git a/ext/soap/tests/server010.phpt b/ext/soap/tests/server010.phpt
index 76cc1e694..bac16d290 100644
--- a/ext/soap/tests/server010.phpt
+++ b/ext/soap/tests/server010.phpt
@@ -33,7 +33,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
ob_clean();
$HTTP_RAW_POST_DATA = <<<EOF
@@ -51,7 +51,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
ob_end_flush();
echo "ok\n";
?>
diff --git a/ext/soap/tests/server013.phpt b/ext/soap/tests/server013.phpt
index 4bb94c79c..68c480111 100644
--- a/ext/soap/tests/server013.phpt
+++ b/ext/soap/tests/server013.phpt
@@ -35,7 +35,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server014.phpt b/ext/soap/tests/server014.phpt
index 737526487..fcb62a542 100644
--- a/ext/soap/tests/server014.phpt
+++ b/ext/soap/tests/server014.phpt
@@ -29,7 +29,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server016.phpt b/ext/soap/tests/server016.phpt
index 77bce9fb3..8934f46af 100644
--- a/ext/soap/tests/server016.phpt
+++ b/ext/soap/tests/server016.phpt
@@ -26,7 +26,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server017.phpt b/ext/soap/tests/server017.phpt
index cc4af5e70..3ff0acb4e 100644
--- a/ext/soap/tests/server017.phpt
+++ b/ext/soap/tests/server017.phpt
@@ -25,7 +25,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server018.phpt b/ext/soap/tests/server018.phpt
index 22c37a09b..b033ed9c5 100644
--- a/ext/soap/tests/server018.phpt
+++ b/ext/soap/tests/server018.phpt
@@ -25,7 +25,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server019.phpt b/ext/soap/tests/server019.phpt
index 4ad9c5ee8..defdac5b9 100644
--- a/ext/soap/tests/server019.phpt
+++ b/ext/soap/tests/server019.phpt
@@ -1,20 +1,14 @@
--TEST--
SOAP Server 19: compressed request (gzip)
--SKIPIF--
-<?php require_once('skipif.inc');
- if (!extension_loaded('zlib')) die('skip zlib extension not available');
+<?php
+ if (php_sapi_name()=='cli') echo 'skip';
+ require_once('skipif.inc');
+ if (!extension_loaded('zlib')) die('skip zlib extension not available');
?>
---FILE--
-<?php
-function test() {
- return "Hello World";
-}
-
-$server = new soapserver(null,array('uri'=>"http://testuri.org"));
-$server->addfunction("test");
-
-$HTTP_RAW_POST_DATA = gzencode(<<<EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
+--INI--
+precision=14
+--POST--
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
@@ -25,9 +19,16 @@ $HTTP_RAW_POST_DATA = gzencode(<<<EOF
<ns1:test xmlns:ns1="http://testuri.org" />
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-EOF
-, 9, FORCE_GZIP);
-$_SERVER['HTTP_CONTENT_ENCODING'] = "gzip";
+--GZIP_POST--
+1
+--FILE--
+<?php
+function test() {
+ return "Hello World";
+}
+
+$server = new soapserver(null,array('uri'=>"http://testuri.org"));
+$server->addfunction("test");
$server->handle();
echo "ok\n";
?>
diff --git a/ext/soap/tests/server020.phpt b/ext/soap/tests/server020.phpt
index bacbc5784..1bd58931e 100644
--- a/ext/soap/tests/server020.phpt
+++ b/ext/soap/tests/server020.phpt
@@ -1,19 +1,14 @@
--TEST--
SOAP Server 20: compressed request (deflate)
--SKIPIF--
-<?php require_once('skipif.inc');
- if (!extension_loaded('zlib')) die('skip zlib extension not available');
+<?php
+ if (php_sapi_name()=='cli') echo 'skip';
+ require_once('skipif.inc');
+ if (!extension_loaded('zlib')) die('skip zlib extension not available');
?>
---FILE--
-<?php
-function test() {
- return "Hello World";
-}
-
-$server = new soapserver(null,array('uri'=>"http://testuri.org"));
-$server->addfunction("test");
-
-$HTTP_RAW_POST_DATA = gzcompress(<<<EOF
+--INI--
+precision=14
+--POST--
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
@@ -25,9 +20,16 @@ $HTTP_RAW_POST_DATA = gzcompress(<<<EOF
<ns1:test xmlns:ns1="http://testuri.org" />
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-EOF
-, 9);
-$_SERVER['HTTP_CONTENT_ENCODING'] = "deflate";
+--DEFLATE_POST--
+1
+--FILE--
+<?php
+function test() {
+ return "Hello World";
+}
+
+$server = new soapserver(null,array('uri'=>"http://testuri.org"));
+$server->addfunction("test");
$server->handle();
echo "ok\n";
?>
diff --git a/ext/soap/tests/server021.phpt b/ext/soap/tests/server021.phpt
index 787e959fb..d9913060b 100644
--- a/ext/soap/tests/server021.phpt
+++ b/ext/soap/tests/server021.phpt
@@ -31,7 +31,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server022.phpt b/ext/soap/tests/server022.phpt
index 90b06d5a1..ff79a1518 100755
--- a/ext/soap/tests/server022.phpt
+++ b/ext/soap/tests/server022.phpt
@@ -32,7 +32,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server023.phpt b/ext/soap/tests/server023.phpt
index c227204d3..5614599f3 100755
--- a/ext/soap/tests/server023.phpt
+++ b/ext/soap/tests/server023.phpt
@@ -28,7 +28,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server024.phpt b/ext/soap/tests/server024.phpt
index 0ddd9cec3..7db30621d 100755
--- a/ext/soap/tests/server024.phpt
+++ b/ext/soap/tests/server024.phpt
@@ -40,7 +40,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server025.phpt b/ext/soap/tests/server025.phpt
index eb5d647eb..975ad0065 100755
--- a/ext/soap/tests/server025.phpt
+++ b/ext/soap/tests/server025.phpt
@@ -37,7 +37,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server026.phpt b/ext/soap/tests/server026.phpt
index a473a8540..720ade86c 100755
--- a/ext/soap/tests/server026.phpt
+++ b/ext/soap/tests/server026.phpt
@@ -28,7 +28,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server028.phpt b/ext/soap/tests/server028.phpt
index 17194b9e3..4bea8ebd7 100755
--- a/ext/soap/tests/server028.phpt
+++ b/ext/soap/tests/server028.phpt
@@ -32,7 +32,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
</SOAP-ENV:Envelope>
EOF;
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/server029.phpt b/ext/soap/tests/server029.phpt
new file mode 100644
index 000000000..26db9fd9c
--- /dev/null
+++ b/ext/soap/tests/server029.phpt
@@ -0,0 +1,55 @@
+--TEST--
+SOAP Server 29-CGI: new/addfunction/handle
+--POST--
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<SOAP-ENV:Envelope
+ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:si="http://soapinterop.org/xsd">
+ <SOAP-ENV:Body>
+ <ns1:test xmlns:ns1="http://testuri.org" />
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+--SKIPIF--
+<?php
+ if (php_sapi_name()=='cli') echo 'skip';
+ require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+echo "INPUT: \n";
+echo file_get_contents("php://input") . "\n";
+echo "\n\n-----------\n\n";
+
+function test() {
+ return "Hello World";
+}
+
+$server = new soapserver(null,array('uri'=>"http://testuri.org"));
+$server->addfunction("test");
+$server->handle();
+echo "ok\n";
+?>
+--EXPECT--
+INPUT:
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<SOAP-ENV:Envelope
+ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:si="http://soapinterop.org/xsd">
+ <SOAP-ENV:Body>
+ <ns1:test xmlns:ns1="http://testuri.org" />
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+
+
+-----------
+
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
+ok \ No newline at end of file
diff --git a/ext/soap/tests/soap12/T42.phpt b/ext/soap/tests/soap12/T42.phpt
index c9cca6d30..87e0a77f4 100644
--- a/ext/soap/tests/soap12/T42.phpt
+++ b/ext/soap/tests/soap12/T42.phpt
@@ -2,6 +2,8 @@
SOAP 1.2: T42 echoStructArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$HTTP_RAW_POST_DATA = <<<EOF
diff --git a/ext/soap/tests/soap12/T47.phpt b/ext/soap/tests/soap12/T47.phpt
index f53a5b59f..852dec0a2 100644
--- a/ext/soap/tests/soap12/T47.phpt
+++ b/ext/soap/tests/soap12/T47.phpt
@@ -2,6 +2,8 @@
SOAP 1.2: T47 echoFloatArray
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+--INI--
+precision=14
--FILE--
<?php
$HTTP_RAW_POST_DATA = <<<EOF
diff --git a/ext/soap/tests/soap12/soap12-test.inc b/ext/soap/tests/soap12/soap12-test.inc
index 864398d46..576fb2e42 100644
--- a/ext/soap/tests/soap12/soap12-test.inc
+++ b/ext/soap/tests/soap12/soap12-test.inc
@@ -125,6 +125,6 @@ class Soap12test {
$server = new soapserver(dirname(__FILE__)."/soap12-test.wsdl", array('soap_version'=>SOAP_1_2,'actor'=>"http://example.org/ts-tests/C"));
$server->setClass("Soap12test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
diff --git a/ext/soap/tests/typemap001.phpt b/ext/soap/tests/typemap001.phpt
index d76170a74..c3b5b8444 100755
--- a/ext/soap/tests/typemap001.phpt
+++ b/ext/soap/tests/typemap001.phpt
@@ -51,7 +51,7 @@ $options=Array(
$server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
$server->setClass("test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/typemap002.phpt b/ext/soap/tests/typemap002.phpt
index ee80c5981..478e1ee4e 100755
--- a/ext/soap/tests/typemap002.phpt
+++ b/ext/soap/tests/typemap002.phpt
@@ -47,7 +47,7 @@ $options=Array(
$server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
$server->setClass("test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/typemap005.phpt b/ext/soap/tests/typemap005.phpt
index b016519a7..6e3001d0b 100755
--- a/ext/soap/tests/typemap005.phpt
+++ b/ext/soap/tests/typemap005.phpt
@@ -52,7 +52,7 @@ $options=Array(
$server = new SoapServer(NULL,$options);
$server->setClass("test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/typemap006.phpt b/ext/soap/tests/typemap006.phpt
index 1e3609a8b..7b1fc4df2 100755
--- a/ext/soap/tests/typemap006.phpt
+++ b/ext/soap/tests/typemap006.phpt
@@ -48,7 +48,7 @@ $options=Array(
$server = new SoapServer(NULL,$options);
$server->setClass("test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/typemap009.phpt b/ext/soap/tests/typemap009.phpt
index 337aea65c..208fb43db 100755
--- a/ext/soap/tests/typemap009.phpt
+++ b/ext/soap/tests/typemap009.phpt
@@ -47,7 +47,7 @@ $options=Array(
$server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
$server->setClass("test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/typemap010.phpt b/ext/soap/tests/typemap010.phpt
index 44d2746bd..b6ec26803 100755
--- a/ext/soap/tests/typemap010.phpt
+++ b/ext/soap/tests/typemap010.phpt
@@ -47,7 +47,7 @@ $options=Array(
$server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
$server->setClass("test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/soap/tests/typemap013.phpt b/ext/soap/tests/typemap013.phpt
index 99003c8dc..9ad02cb5e 100755
--- a/ext/soap/tests/typemap013.phpt
+++ b/ext/soap/tests/typemap013.phpt
@@ -47,7 +47,7 @@ $options=Array(
$server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
$server->setClass("test");
-$server->handle();
+$server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECT--
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index 17cab348f..b89c9ebd3 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -22,7 +22,7 @@
#ifndef PHP_SOCKETS_H
#define PHP_SOCKETS_H
-/* $Id: php_sockets.h,v 1.36.2.1.2.2 2007/01/10 15:25:07 bjori Exp $ */
+/* $Id: php_sockets.h,v 1.36.2.1.2.3 2007/05/19 17:58:22 iliaa Exp $ */
#if HAVE_SOCKETS
@@ -41,7 +41,6 @@ extern zend_module_entry sockets_module_entry;
PHP_MINIT_FUNCTION(sockets);
PHP_MINFO_FUNCTION(sockets);
-PHP_RINIT_FUNCTION(sockets);
PHP_RSHUTDOWN_FUNCTION(sockets);
PHP_FUNCTION(socket_select);
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 20fecb8b1..fe2d50706 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.171.2.9.2.8 2007/02/25 22:59:32 tony2001 Exp $ */
+/* $Id: sockets.c,v 1.171.2.9.2.9 2007/05/19 17:58:22 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -158,7 +158,7 @@ zend_module_entry sockets_module_entry = {
sockets_functions,
PHP_MINIT(sockets),
NULL,
- PHP_RINIT(sockets),
+ NULL,
PHP_RSHUTDOWN(sockets),
PHP_MINFO(sockets),
NO_VERSION_YET,
@@ -515,13 +515,6 @@ PHP_MINFO_FUNCTION(sockets)
}
/* }}} */
-/* {{{ PHP_RINIT_FUNCTION */
-PHP_RINIT_FUNCTION(sockets)
-{
- return SUCCESS;
-}
-/* }}} */
-
/* {{{ PHP_RSHUTDOWN_FUNCTION */
PHP_RSHUTDOWN_FUNCTION(sockets)
{
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 5de79d47d..3f1ed7995 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_spl.c,v 1.52.2.28.2.15 2007/04/06 16:00:08 helly Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17 2007/05/19 18:40:27 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -45,6 +45,8 @@ ZEND_GET_MODULE(spl)
ZEND_DECLARE_MODULE_GLOBALS(spl)
+#define SPL_DEFAULT_FILE_EXTENSIONS ".inc,.php"
+
/* {{{ spl_functions_none
*/
zend_function_entry spl_functions_none[] = {
@@ -271,7 +273,11 @@ PHP_FUNCTION(spl_autoload)
RETURN_FALSE;
}
- copy = pos1 = estrndup(file_exts, file_exts_len);
+ if (file_exts == NULL) { /* autoload_extensions is not intialzed, set to defaults */
+ copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS)-1);
+ } else {
+ copy = pos1 = estrndup(file_exts, file_exts_len);
+ }
lc_name = zend_str_tolower_dup(class_name, class_name_len);
while(pos1 && *pos1 && !EG(exception)) {
EG(return_value_ptr_ptr) = original_return_value;
@@ -328,7 +334,11 @@ PHP_FUNCTION(spl_autoload_extensions)
SPL_G(autoload_extensions_len) = file_exts_len;
}
- RETURN_STRINGL(SPL_G(autoload_extensions), SPL_G(autoload_extensions_len), 1);
+ if (SPL_G(autoload_extensions) == NULL) {
+ RETURN_STRINGL(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1, 1);
+ } else {
+ RETURN_STRINGL(SPL_G(autoload_extensions), SPL_G(autoload_extensions_len), 1);
+ }
} /* }}} */
typedef struct {
@@ -717,8 +727,8 @@ PHP_MINIT_FUNCTION(spl)
PHP_RINIT_FUNCTION(spl) /* {{{ */
{
- SPL_G(autoload_extensions) = estrndup(".inc,.php", sizeof(".inc,.php")-1);
- SPL_G(autoload_extensions_len) = sizeof(".inc,.php")-1;
+ SPL_G(autoload_extensions) = NULL;
+ SPL_G(autoload_extensions_len) = 0;
SPL_G(autoload_functions) = NULL;
return SUCCESS;
} /* }}} */
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 8534d313b..6426e2d8a 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.73.2.30.2.27 2007/03/04 14:01:06 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.28 2007/05/11 00:15:25 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1426,6 +1426,10 @@ SPL_METHOD(RegexIterator, accept)
}
}
+ if (intern->u.regex.flags & REGIT_INVERTED) {
+ RETVAL_BOOL(Z_LVAL_P(return_value));
+ }
+
if (use_copy) {
efree(subject);
}
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index 7c5031241..26c21693d 100755
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.h,v 1.18.2.7.2.11 2007/02/08 22:17:40 helly Exp $ */
+/* $Id: spl_iterators.h,v 1.18.2.7.2.12 2007/05/11 00:15:25 helly Exp $ */
#ifndef SPL_ITERATORS_H
#define SPL_ITERATORS_H
@@ -94,6 +94,7 @@ enum {
enum {
/* public */
REGIT_USE_KEY = 0x00000001,
+ REGIT_INVERTED = 0x00000002,
};
typedef enum {
diff --git a/ext/spl/tests/bug33136.phpt b/ext/spl/tests/bug33136.phpt
index 13b058307..2f3155f27 100755
--- a/ext/spl/tests/bug33136.phpt
+++ b/ext/spl/tests/bug33136.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #33136 method offsetSet in class extended from ArrayObject crash PHP
+Bug #33136 (method offsetSet in class extended from ArrayObject crash PHP)
--SKIPIF--
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
diff --git a/ext/spl/tests/bug36287.phpt b/ext/spl/tests/bug36287.phpt
index 29ae0e2c9..03e695e2a 100755
--- a/ext/spl/tests/bug36287.phpt
+++ b/ext/spl/tests/bug36287.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #36287
+Bug #36287 (Segfault with SplFileInfo conversion)
--SKIPIF--
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
diff --git a/ext/sqlite/php_sqlite.h b/ext/sqlite/php_sqlite.h
index 5d3dea1ac..a2288aa77 100644
--- a/ext/sqlite/php_sqlite.h
+++ b/ext/sqlite/php_sqlite.h
@@ -17,7 +17,7 @@
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
- $Id: php_sqlite.h,v 1.32.2.2.2.1 2007/01/01 09:36:07 sebastian Exp $
+ $Id: php_sqlite.h,v 1.32.2.2.2.2 2007/05/19 17:58:22 iliaa Exp $
*/
#ifndef PHP_SQLITE_H
@@ -38,7 +38,6 @@ extern zend_module_entry sqlite_module_entry;
PHP_MINIT_FUNCTION(sqlite);
PHP_MSHUTDOWN_FUNCTION(sqlite);
-PHP_RINIT_FUNCTION(sqlite);
PHP_RSHUTDOWN_FUNCTION(sqlite);
PHP_MINFO_FUNCTION(sqlite);
diff --git a/ext/sqlite/sess_sqlite.c b/ext/sqlite/sess_sqlite.c
index 807e5c2fe..a4f652214 100644
--- a/ext/sqlite/sess_sqlite.c
+++ b/ext/sqlite/sess_sqlite.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sess_sqlite.c,v 1.18.2.1.2.1 2007/01/01 09:36:07 sebastian Exp $ */
+/* $Id: sess_sqlite.c,v 1.18.2.1.2.2 2007/05/05 15:36:15 iliaa Exp $ */
#include "php.h"
@@ -110,9 +110,13 @@ PS_READ_FUNC(sqlite)
case SQLITE_ROW:
if (rowdata[0] != NULL) {
*vallen = strlen(rowdata[0]);
- *val = emalloc(*vallen);
- *vallen = sqlite_decode_binary(rowdata[0], *val);
- (*val)[*vallen] = '\0';
+ if (*vallen) {
+ *val = emalloc(*vallen);
+ *vallen = sqlite_decode_binary(rowdata[0], *val);
+ (*val)[*vallen] = '\0';
+ } else {
+ *val = STR_EMPTY_ALLOC();
+ }
}
break;
default:
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 51736e9b2..184fd23fb 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -17,7 +17,7 @@
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
- $Id: sqlite.c,v 1.166.2.13.2.7 2007/03/06 02:17:13 stas Exp $
+ $Id: sqlite.c,v 1.166.2.13.2.9 2007/05/19 17:58:22 iliaa Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -73,7 +73,7 @@ extern int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *o
extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
#define php_sqlite_encode_binary(in, n, out) sqlite_encode_binary((const unsigned char *)in, n, (unsigned char *)out)
-#define php_sqlite_decode_binary(in, out) sqlite_decode_binary((const unsigned char *)in, (unsigned char *)out)
+#define php_sqlite_decode_binary(in, out) in && *in ? sqlite_decode_binary((const unsigned char *)in, (unsigned char *)out) : 0
static int sqlite_count_elements(zval *object, long *count TSRMLS_DC);
@@ -295,7 +295,7 @@ zend_module_entry sqlite_module_entry = {
sqlite_functions,
PHP_MINIT(sqlite),
PHP_MSHUTDOWN(sqlite),
- PHP_RINIT(sqlite),
+ NULL,
PHP_RSHUTDOWN(sqlite),
PHP_MINFO(sqlite),
#if ZEND_MODULE_API_NO >= 20010901
@@ -1124,16 +1124,11 @@ PHP_MSHUTDOWN_FUNCTION(sqlite)
return SUCCESS;
}
-PHP_RINIT_FUNCTION(sqlite)
-{
- return SUCCESS;
-}
-
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.7 2007/03/06 02:17:13 stas Exp $");
+ 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, "SQLite Library", sqlite_libversion());
php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding());
php_info_print_table_end();
diff --git a/ext/standard/Makefile.frag b/ext/standard/Makefile.frag
index 1d7661750..4e9496218 100644
--- a/ext/standard/Makefile.frag
+++ b/ext/standard/Makefile.frag
@@ -7,4 +7,4 @@ $(srcdir)/url_scanner_ex.c: $(srcdir)/url_scanner_ex.re
$(builddir)/info.lo: $(builddir)/../../main/build-defs.h
-$(builddir)/basic_functions.lo: Zend/zend_language_parser.h
+$(builddir)/basic_functions.lo: $(top_srcdir)/Zend/zend_language_parser.h
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 085ef0364..02e5429af 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.725.2.31.2.49 2007/04/17 20:34:14 tony2001 Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.53 2007/05/22 15:38:27 bjori Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1665,6 +1665,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1)
ZEND_ARG_INFO(0, string)
ZEND_ARG_INFO(0, quote_style)
ZEND_ARG_INFO(0, charset)
+ ZEND_ARG_INFO(0, double_encode)
ZEND_END_ARG_INFO()
static
@@ -1685,6 +1686,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlentities, 0, 0, 1)
ZEND_ARG_INFO(0, string)
ZEND_ARG_INFO(0, quote_style)
ZEND_ARG_INFO(0, charset)
+ ZEND_ARG_INFO(0, double_encode)
ZEND_END_ARG_INFO()
static
@@ -4130,8 +4132,6 @@ PHP_RINIT_FUNCTION(basic)
#endif
BG(user_shutdown_function_names) = NULL;
- PHP_RINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU);
-
PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU);
#ifdef HAVE_SYSLOG_H
PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
@@ -4186,9 +4186,11 @@ PHP_RSHUTDOWN_FUNCTION(basic)
*/
PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+#ifdef PHP_WIN32
#ifdef HAVE_SYSLOG_H
PHP_RSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
#endif
+#endif
PHP_RSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
PHP_RSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
PHP_RSHUTDOWN(streams)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
@@ -5447,6 +5449,9 @@ PHP_FUNCTION(highlight_file)
php_get_highlight_struct(&syntax_highlighter_ini);
if (highlight_file(filename, &syntax_highlighter_ini TSRMLS_CC) == FAILURE) {
+ if (i) {
+ php_end_ob_buffer (1, 0 TSRMLS_CC);
+ }
RETURN_FALSE;
}
@@ -5480,6 +5485,8 @@ PHP_FUNCTION(php_strip_whitespace)
file_handle.opened_path = NULL;
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) {
+ zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
+ php_end_ob_buffer(1, 0 TSRMLS_CC);
RETURN_EMPTY_STRING();
}
@@ -5522,6 +5529,10 @@ PHP_FUNCTION(highlight_string)
if (highlight_string(*expr, &syntax_highlighter_ini, hicompiled_string_description TSRMLS_CC) == FAILURE) {
efree(hicompiled_string_description);
+ EG(error_reporting) = old_error_reporting;
+ if (i) {
+ php_end_ob_buffer (1, 0 TSRMLS_CC);
+ }
RETURN_FALSE;
}
efree(hicompiled_string_description);
@@ -6252,51 +6263,25 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h
prefix = va_arg(args, char *);
prefix_len = va_arg(args, uint);
- if (!prefix_len) {
- if (!hash_key->nKeyLength) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard.");
- return 0;
- } else if (!strcmp(hash_key->arKey, "GLOBALS")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted GLOBALS variable overwrite.");
- return 0;
- } else if (*hash_key->arKey == '_' &&
- (
- !strcmp(hash_key->arKey, "_GET") ||
- !strcmp(hash_key->arKey, "_POST") ||
- !strcmp(hash_key->arKey, "_COOKIE") ||
- !strcmp(hash_key->arKey, "_ENV") ||
- !strcmp(hash_key->arKey, "_SERVER") ||
- !strcmp(hash_key->arKey, "_SESSION") ||
- !strcmp(hash_key->arKey, "_FILES") ||
- !strcmp(hash_key->arKey, "_REQUEST")
- )
- ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted super-global (%s) variable overwrite.", hash_key->arKey);
- return 0;
- } else if (*hash_key->arKey == 'H' &&
- (
- !strcmp(hash_key->arKey, "HTTP_POST_VARS") ||
- !strcmp(hash_key->arKey, "HTTP_GET_VARS") ||
- !strcmp(hash_key->arKey, "HTTP_COOKIE_VARS") ||
- !strcmp(hash_key->arKey, "HTTP_ENV_VARS") ||
- !strcmp(hash_key->arKey, "HTTP_SERVER_VARS") ||
- !strcmp(hash_key->arKey, "HTTP_RAW_POST_DATA") ||
- !strcmp(hash_key->arKey, "HTTP_POST_FILES")
- )
- ) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted long input array (%s) overwrite.", hash_key->arKey);
- return 0;
- }
+ if (!prefix_len && !hash_key->nKeyLength) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard.");
+ return 0;
}
if (hash_key->nKeyLength) {
new_key_len = prefix_len + hash_key->nKeyLength;
- new_key = (char *) emalloc(new_key_len);
+ new_key = (char *) emalloc(new_key_len); /* +1 comes from nKeyLength */
memcpy(new_key, prefix, prefix_len);
memcpy(new_key+prefix_len, hash_key->arKey, hash_key->nKeyLength);
} else {
new_key_len = spprintf(&new_key, 0, "%s%ld", prefix, hash_key->h);
+ new_key_len++;
+ }
+
+ if (php_varname_check(new_key, new_key_len, 0 TSRMLS_CC) == FAILURE) {
+ efree(new_key);
+ return 0;
}
zend_delete_global_variable(new_key, new_key_len-1 TSRMLS_CC);
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index e6e392d4e..3a91f3730 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.h,v 1.139.2.4.2.4 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: basic_functions.h,v 1.139.2.4.2.5 2007/05/28 12:19:41 bjori Exp $ */
#ifndef BASIC_FUNCTIONS_H
#define BASIC_FUNCTIONS_H
@@ -45,7 +45,6 @@ PHP_RSHUTDOWN_FUNCTION(basic);
PHP_MINFO_FUNCTION(basic);
PHP_FUNCTION(constant);
-PHP_FUNCTION(toggle_short_open_tag);
PHP_FUNCTION(sleep);
PHP_FUNCTION(usleep);
#if HAVE_NANOSLEEP
diff --git a/ext/standard/credits.c b/ext/standard/credits.c
index d1a9d6716..cef6c76dd 100644
--- a/ext/standard/credits.c
+++ b/ext/standard/credits.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: credits.c,v 1.36.2.4.2.3 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: credits.c,v 1.36.2.4.2.4 2007/05/22 15:44:11 bjori Exp $ */
#include "php.h"
#include "info.h"
@@ -97,6 +97,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC)
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("Editor", "Philip Olson");
CREDIT_LINE("User Note Maintainers", "Mehdi Achour, Friedhelm Betz, Vincent Gevers, Aidan Lister, Nuno Lopes, Tom Sommer");
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/dns.c b/ext/standard/dns.c
index 7cb16bc0a..d72029371 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dns.c,v 1.70.2.7.2.2 2007/02/24 02:17:27 helly Exp $ */
+/* $Id: dns.c,v 1.70.2.7.2.4 2007/05/14 11:33:34 tony2001 Exp $ */
/* {{{ includes */
#include "php.h"
@@ -264,6 +264,11 @@ PHP_FUNCTION(dns_check_record)
}
type = T_MX;
convert_to_string_ex(arg1);
+
+ if (Z_STRLEN_PP(arg1) == 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host cannot be empty");
+ RETURN_FALSE;
+ }
break;
case 2:
@@ -273,6 +278,11 @@ PHP_FUNCTION(dns_check_record)
convert_to_string_ex(arg1);
convert_to_string_ex(arg2);
+ if (Z_STRLEN_PP(arg1) == 0 || Z_STRLEN_PP(arg2) == 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host and type cannot be empty");
+ RETURN_FALSE;
+ }
+
if (!strcasecmp("A", Z_STRVAL_PP(arg2))) type = T_A;
else if (!strcasecmp("NS", Z_STRVAL_PP(arg2))) type = DNS_T_NS;
else if (!strcasecmp("MX", Z_STRVAL_PP(arg2))) type = DNS_T_MX;
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 92eb8e1ca..16989e0f1 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.409.2.6.2.17 2007/02/23 16:22:20 tony2001 Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.20 2007/05/27 17:33:39 iliaa Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -536,6 +536,11 @@ PHP_FUNCTION(file_get_contents)
return;
}
+ if (ZEND_NUM_ARGS() == 5 && maxlen < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater than or equal to zero");
+ RETURN_FALSE;
+ }
+
context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(filename, "rb",
@@ -2366,6 +2371,14 @@ PHP_FUNCTION(realpath)
convert_to_string_ex(path);
if (VCWD_REALPATH(Z_STRVAL_PP(path), resolved_path_buff)) {
+ if (PG(safe_mode) && (!php_checkuid(resolved_path_buff, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ RETURN_FALSE;
+ }
+
+ if (php_check_open_basedir(resolved_path_buff TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+
#ifdef ZTS
if (VCWD_ACCESS(resolved_path_buff, F_OK)) {
RETURN_FALSE;
diff --git a/ext/standard/html.c b/ext/standard/html.c
index ef54f62ca..3b4919354 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.c,v 1.111.2.2.2.9 2007/02/27 03:28:16 iliaa Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.14 2007/05/27 15:57:11 nlopess Exp $ */
/*
* HTML entity resources:
@@ -1078,12 +1078,15 @@ empty_source:
}
/* }}} */
-
+PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC)
+{
+ return php_escape_html_entities_ex(old, oldlen, newlen, all, quote_style, hint_charset, 1 TSRMLS_CC);
+}
/* {{{ php_escape_html_entities
*/
-PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC)
+PHPAPI char *php_escape_html_entities_ex(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset, zend_bool double_encode TSRMLS_DC)
{
int i, j, maxlen, len;
char *replaced;
@@ -1145,8 +1148,34 @@ PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newle
int is_basic = 0;
if (this_char == '&') {
- memcpy(replaced + len, "&amp;", sizeof("&amp;") - 1);
- len += sizeof("&amp;") - 1;
+ if (double_encode) {
+encode_amp:
+ memcpy(replaced + len, "&amp;", sizeof("&amp;") - 1);
+ len += sizeof("&amp;") - 1;
+ } else {
+ char *e = memchr(old + i, ';', oldlen - i);
+ char *s = old + i;
+
+ if (!e || (e - s) > 10) { /* minor optimization to avoid "entities" over 10 chars in length */
+ goto encode_amp;
+ } else {
+ if (*s == '#') { /* numeric entities */
+ s++;
+ while (s < e) {
+ if (!isdigit(*s++)) {
+ goto encode_amp;
+ }
+ }
+ } else { /* text entities */
+ while (s < e) {
+ if (!isalnum(*s++)) {
+ goto encode_amp;
+ }
+ }
+ }
+ replaced[len++] = '&';
+ }
+ }
is_basic = 1;
} else {
for (j = 0; basic_entities[j].charcode != 0; j++) {
@@ -1193,12 +1222,13 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
int len;
long quote_style = ENT_COMPAT;
char *replaced;
+ zend_bool double_encode = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &quote_style, &hint_charset, &hint_charset_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &quote_style, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) {
return;
}
- replaced = php_escape_html_entities(str, str_len, &len, all, quote_style, hint_charset TSRMLS_CC);
+ replaced = php_escape_html_entities_ex(str, str_len, &len, all, quote_style, hint_charset, double_encode TSRMLS_CC);
RETVAL_STRINGL(replaced, len, 0);
}
/* }}} */
@@ -1218,7 +1248,7 @@ void register_html_constants(INIT_FUNC_ARGS)
}
/* }}} */
-/* {{{ proto string htmlspecialchars(string string [, int quote_style][, string charset])
+/* {{{ proto string htmlspecialchars(string string [, int quote_style[, string charset[, bool double_encode]]])
Convert special characters to HTML entities */
PHP_FUNCTION(htmlspecialchars)
{
@@ -1315,7 +1345,7 @@ PHP_FUNCTION(html_entity_decode)
/* }}} */
-/* {{{ proto string htmlentities(string string [, int quote_style][, string charset])
+/* {{{ proto string htmlentities(string string [, int quote_style[, string charset[, bool double_encode]]])
Convert all applicable characters to HTML entities */
PHP_FUNCTION(htmlentities)
{
diff --git a/ext/standard/html.h b/ext/standard/html.h
index 1c113eb7d..b7ef2823c 100644
--- a/ext/standard/html.h
+++ b/ext/standard/html.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.h,v 1.20.2.1.2.2 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: html.h,v 1.20.2.1.2.3 2007/05/22 12:37:00 iliaa Exp $ */
#ifndef HTML_H
#define HTML_H
@@ -38,6 +38,7 @@ PHP_FUNCTION(html_entity_decode);
PHP_FUNCTION(get_html_translation_table);
PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC);
+PHPAPI char *php_escape_html_entities_ex(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset, zend_bool double_encode TSRMLS_DC);
PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC);
#endif /* HTML_H */
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 2d4233540..dc94fe25c 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: image.c,v 1.114.2.2.2.4 2007/02/24 02:17:27 helly Exp $ */
+/* $Id: image.c,v 1.114.2.2.2.5 2007/05/08 18:38:20 iliaa Exp $ */
#include "php.h"
#include <stdio.h>
@@ -1185,7 +1185,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
if ( !filetype) filetype = tmp;
if((php_stream_read(stream, filetype, 3)) != 3) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!");
return IMAGE_FILETYPE_UNKNOWN;
}
@@ -1196,7 +1196,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
return IMAGE_FILETYPE_JPEG;
} else if (!memcmp(filetype, php_sig_png, 3)) {
if (php_stream_read(stream, filetype+3, 5) != 5) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!");
return IMAGE_FILETYPE_UNKNOWN;
}
if (!memcmp(filetype, php_sig_png, 8)) {
@@ -1218,7 +1218,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
}
if (php_stream_read(stream, filetype+3, 1) != 1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!");
return IMAGE_FILETYPE_UNKNOWN;
}
/* BYTES READ: 4 */
@@ -1233,7 +1233,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
}
if (php_stream_read(stream, filetype+4, 8) != 8) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Read error!");
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Read error!");
return IMAGE_FILETYPE_UNKNOWN;
}
/* BYTES READ: 12 */
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index 487e9095c..8939779df 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iptc.c,v 1.50.2.2.2.4 2007/02/12 20:40:11 tony2001 Exp $ */
+/* $Id: iptc.c,v 1.50.2.2.2.5 2007/05/10 12:23:25 tony2001 Exp $ */
/*
* Functions to parse & compse IPTC data.
@@ -212,16 +212,16 @@ PHP_FUNCTION(iptcembed)
if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xFF) {
fclose(fp);
- if (poi) {
- efree(poi);
+ if (spoolbuf) {
+ efree(spoolbuf);
}
RETURN_FALSE;
}
if (php_iptc_get1(fp, spool, poi?&poi:0 TSRMLS_CC) != 0xD8) {
fclose(fp);
- if (poi) {
- efree(poi);
+ if (spoolbuf) {
+ efree(spoolbuf);
}
RETURN_FALSE;
}
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index d0d0121da..958a2c364 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: lcg.c,v 1.41.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: lcg.c,v 1.41.2.1.2.2 2007/05/17 06:38:13 rasmus Exp $ */
#include "php.h"
#include "php_lcg.h"
@@ -106,14 +106,6 @@ PHP_MINIT_FUNCTION(lcg)
return SUCCESS;
}
-PHP_RINIT_FUNCTION(lcg)
-{
- if (!LCG(seeded)) {
- lcg_seed(TSRMLS_C);
- }
- return SUCCESS;
-}
-
/* {{{ proto float lcg_value()
Returns a value from the combined linear congruential generator */
PHP_FUNCTION(lcg_value)
diff --git a/ext/standard/math.c b/ext/standard/math.c
index b93600edf..0d16ad2ff 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.131.2.2.2.5 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: math.c,v 1.131.2.2.2.6 2007/05/23 15:01:00 iliaa Exp $ */
#include "php.h"
#include "php_math.h"
@@ -880,9 +880,7 @@ PHP_FUNCTION(decbin)
convert_to_long_ex(arg);
result = _php_math_longtobase(*arg, 2);
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRLEN_P(return_value) = strlen(result);
- Z_STRVAL_P(return_value) = result;
+ RETURN_STRING(result, 0);
}
/* }}} */
@@ -900,9 +898,7 @@ PHP_FUNCTION(decoct)
convert_to_long_ex(arg);
result = _php_math_longtobase(*arg, 8);
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRLEN_P(return_value) = strlen(result);
- Z_STRVAL_P(return_value) = result;
+ RETURN_STRING(result, 0);
}
/* }}} */
@@ -920,9 +916,7 @@ PHP_FUNCTION(dechex)
convert_to_long_ex(arg);
result = _php_math_longtobase(*arg, 16);
- Z_TYPE_P(return_value) = IS_STRING;
- Z_STRLEN_P(return_value) = strlen(result);
- Z_STRVAL_P(return_value) = result;
+ RETURN_STRING(result, 0);
}
/* }}} */
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 2217b264f..7bc85bcf0 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.c,v 1.39.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: md5.c,v 1.39.2.1.2.4 2007/05/27 15:29:38 nlopess Exp $ */
/*
* md5.c - Copyright 1997 Lachlan Roche
@@ -28,14 +28,19 @@
PHPAPI void make_digest(char *md5str, unsigned char *digest)
{
+ make_digest_ex(md5str, digest, 16);
+}
+
+PHPAPI void make_digest_ex(char *md5str, unsigned char *digest, int len)
+{
+ static const char hexits[17] = "0123456789abcdef";
int i;
- for (i = 0; i < 16; i++) {
- sprintf(md5str, "%02x", digest[i]);
- md5str += 2;
+ for (i = 0; i < len; i++) {
+ md5str[i * 2] = hexits[digest[i] >> 4];
+ md5str[(i * 2) + 1] = hexits[digest[i] & 0x0F];
}
-
- *md5str = '\0';
+ md5str[len * 2] = '\0';
}
/* {{{ proto string md5(string str, [ bool raw_output])
@@ -60,7 +65,7 @@ PHP_NAMED_FUNCTION(php_if_md5)
if (raw_output) {
RETURN_STRINGL(digest, 16, 1);
} else {
- make_digest(md5str, digest);
+ make_digest_ex(md5str, digest, 16);
RETVAL_STRING(md5str, 1);
}
@@ -107,7 +112,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file)
if (raw_output) {
RETURN_STRINGL(digest, 16, 1);
} else {
- make_digest(md5str, digest);
+ make_digest_ex(md5str, digest, 16);
RETVAL_STRING(md5str, 1);
}
}
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
index f9d273ad2..548b8743b 100644
--- a/ext/standard/md5.h
+++ b/ext/standard/md5.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.h,v 1.17.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: md5.h,v 1.17.2.1.2.2 2007/05/19 20:30:35 iliaa Exp $ */
#ifndef MD5_H
#define MD5_H
@@ -55,6 +55,7 @@ typedef struct {
} PHP_MD5_CTX;
PHPAPI void make_digest(char *md5str, unsigned char *digest);
+PHPAPI void make_digest_ex(char *md5str, unsigned char *digest, int len);
PHPAPI void PHP_MD5Init(PHP_MD5_CTX *);
PHPAPI void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
PHPAPI void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
index 3106a2b07..bf83de826 100644
--- a/ext/standard/php_ext_syslog.h
+++ b/ext/standard/php_ext_syslog.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ext_syslog.h,v 1.12.2.2.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_ext_syslog.h,v 1.12.2.2.2.2 2007/05/17 06:38:13 rasmus Exp $ */
#ifndef PHP_EXT_SYSLOG_H
#define PHP_EXT_SYSLOG_H
@@ -27,7 +27,9 @@
PHP_MINIT_FUNCTION(syslog);
PHP_RINIT_FUNCTION(syslog);
+#ifdef PHP_WIN32
PHP_RSHUTDOWN_FUNCTION(syslog);
+#endif
PHP_MSHUTDOWN_FUNCTION(syslog);
PHP_FUNCTION(openlog);
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
index 0d9f7af4a..9e04442e5 100644
--- a/ext/standard/php_lcg.h
+++ b/ext/standard/php_lcg.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_lcg.h,v 1.21.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_lcg.h,v 1.21.2.1.2.2 2007/05/18 11:36:55 rasmus Exp $ */
#ifndef PHP_LCG_H
#define PHP_LCG_H
@@ -33,7 +33,6 @@ PHPAPI double php_combined_lcg(TSRMLS_D);
PHP_FUNCTION(lcg_value);
PHP_MINIT_FUNCTION(lcg);
-PHP_RINIT_FUNCTION(lcg);
#ifdef ZTS
#define LCG(v) TSRMG(lcg_globals_id, php_lcg_globals *, v)
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
index 329375d17..0c9693049 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_var.h,v 1.30.2.1.2.5 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_var.h,v 1.30.2.1.2.6 2007/05/22 14:34:22 tony2001 Exp $ */
#ifndef PHP_VAR_H
#define PHP_VAR_H
@@ -67,4 +67,48 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hash);
PHPAPI zend_class_entry *php_create_empty_class(char *class_name, int len);
+static inline int php_varname_check(char *name, int name_len, zend_bool silent TSRMLS_DC) /* {{{ */
+{
+ if (name_len == sizeof("GLOBALS") && !memcmp(name, "GLOBALS", sizeof("GLOBALS"))) {
+ if (!silent) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted GLOBALS variable overwrite");
+ }
+ return FAILURE;
+ } else if (name[0] == '_' &&
+ (
+ (name_len == sizeof("_GET") && !memcmp(name, "_GET", sizeof("_GET"))) ||
+ (name_len == sizeof("_POST") && !memcmp(name, "_POST", sizeof("_POST"))) ||
+ (name_len == sizeof("_COOKIE") && !memcmp(name, "_COOKIE", sizeof("_COOKIE"))) ||
+ (name_len == sizeof("_ENV") && !memcmp(name, "_ENV", sizeof("_ENV"))) ||
+ (name_len == sizeof("_SERVER") && !memcmp(name, "_SERVER", sizeof("_SERVER"))) ||
+ (name_len == sizeof("_SESSION") && !memcmp(name, "_SESSION", sizeof("_SESSION"))) ||
+ (name_len == sizeof("_FILES") && !memcmp(name, "_FILES", sizeof("_FILES"))) ||
+ (name_len == sizeof("_REQUEST") && !memcmp(name, "_REQUEST", sizeof("_REQUEST")))
+ )
+ ) {
+ if (!silent) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted super-global (%s) variable overwrite", name);
+ }
+ return FAILURE;
+ } else if (name[0] == 'H' &&
+ (
+ (name_len == sizeof("HTTP_POST_VARS") && !memcmp(name, "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"))) ||
+ (name_len == sizeof("HTTP_GET_VARS") && !memcmp(name, "HTTP_GET_VARS", sizeof("HTTP_GET_VARS"))) ||
+ (name_len == sizeof("HTTP_COOKIE_VARS") && !memcmp(name, "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS"))) ||
+ (name_len == sizeof("HTTP_ENV_VARS") && !memcmp(name, "HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS"))) ||
+ (name_len == sizeof("HTTP_SERVER_VARS") && !memcmp(name, "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"))) ||
+ (name_len == sizeof("HTTP_SESSION_VARS") && !memcmp(name, "HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"))) ||
+ (name_len == sizeof("HTTP_RAW_POST_DATA") && !memcmp(name, "HTTP_RAW_POST_DATA", sizeof("HTTP_RAW_POST_DATA"))) ||
+ (name_len == sizeof("HTTP_POST_FILES") && !memcmp(name, "HTTP_POST_FILES", sizeof("HTTP_POST_FILES")))
+ )
+ ) {
+ if (!silent) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted long input array (%s) overwrite", name);
+ }
+ return FAILURE;
+ }
+ return SUCCESS;
+}
+/* }}} */
+
#endif /* PHP_VAR_H */
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index ff327b292..9db3afe76 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -16,24 +16,18 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sha1.c,v 1.13.2.1.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: sha1.c,v 1.13.2.1.2.3 2007/05/27 14:50:09 sniper Exp $ */
#include "php.h"
/* This code is heavily based on the PHP md5 implementation */
#include "sha1.h"
+#include "md5.h"
PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest)
{
- int i;
-
- for (i = 0; i < 20; i++) {
- sprintf(sha1str, "%02x", digest[i]);
- sha1str += 2;
- }
-
- *sha1str = '\0';
+ make_digest_ex(sha1str, digest, 20);
}
/* {{{ proto string sha1(string str [, bool raw_output])
@@ -58,7 +52,7 @@ PHP_FUNCTION(sha1)
if (raw_output) {
RETURN_STRINGL(digest, 20, 1);
} else {
- make_sha1_digest(sha1str, digest);
+ make_digest_ex(sha1str, digest, 20);
RETVAL_STRING(sha1str, 1);
}
@@ -107,7 +101,7 @@ PHP_FUNCTION(sha1_file)
if (raw_output) {
RETURN_STRINGL(digest, 20, 1);
} else {
- make_sha1_digest(sha1str, digest);
+ make_digest_ex(sha1str, digest, 20);
RETVAL_STRING(sha1str, 1);
}
}
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 56543ac60..2dea06bfa 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.14.2.54 2007/03/26 10:25:41 tony2001 Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.58 2007/05/30 00:33:13 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -1856,7 +1856,7 @@ PHP_FUNCTION(strripos)
e = haystack + haystack_len - 1;
} else {
p = haystack;
- if (-offset > haystack_len) {
+ if (-offset > haystack_len || -offset < 0) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string");
RETURN_FALSE;
} else {
@@ -1889,7 +1889,7 @@ PHP_FUNCTION(strripos)
p = haystack_dup + offset;
e = haystack_dup + haystack_len - needle_len;
} else {
- if (-offset > haystack_len) {
+ if (-offset > haystack_len || -offset < 0) {
efree(needle_dup);
efree(haystack_dup);
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string");
@@ -1956,11 +1956,18 @@ static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int c
char *p, *q;
int chunks; /* complete chunks! */
int restlen;
+ int out_len;
chunks = srclen / chunklen;
restlen = srclen - chunks * chunklen; /* srclen % chunklen */
- dest = safe_emalloc((srclen + (chunks + 1) * endlen + 1), sizeof(char), 0);
+ out_len = (srclen + (chunks + 1) * endlen + 1);
+
+ if (out_len > INT_MAX || out_len <= 0) {
+ return NULL;
+ }
+
+ dest = safe_emalloc(out_len, sizeof(char), 0);
for (p = src, q = dest; p < (src + srclen - chunklen + 1); ) {
memcpy(q, p, chunklen);
@@ -3016,7 +3023,8 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
php_charmask(what, wlength, flags TSRMLS_CC);
- for (source = str, end = source + length, target = new_str; (c = *source) || (source < end); source++) {
+ for (source = str, end = source + length, target = new_str; source < end; source++) {
+ c = *source;
if (flags[(unsigned char)c]) {
if ((unsigned char) c < 32 || (unsigned char) c > 126) {
*target++ = '\\';
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index 93c1e31b5..a3a2391a6 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: syslog.c,v 1.49.2.3.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: syslog.c,v 1.49.2.3.2.2 2007/05/17 06:38:13 rasmus Exp $ */
#include "php.h"
@@ -114,13 +114,13 @@ PHP_RINIT_FUNCTION(syslog)
}
+#ifdef PHP_WIN32
PHP_RSHUTDOWN_FUNCTION(syslog)
{
-#ifdef PHP_WIN32
closelog();
-#endif
return SUCCESS;
}
+#endif
PHP_MSHUTDOWN_FUNCTION(syslog)
{
diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt
index cdf731827..626c96166 100644
--- a/ext/standard/tests/array/005.phpt
+++ b/ext/standard/tests/array/005.phpt
@@ -1,46 +1,291 @@
--TEST--
-Test array_shift behaviour
+Test array_shift() function
--FILE--
<?php
+/* Prototype: mixed array_shift( array &array );
+ * Description: Shifts the first value of the array off and returns it.
+ */
array_shift($GLOBALS);
-$a = array("foo", "bar", "fubar");
-$b = array("3" => "foo", "4" => "bar", "5" => "fubar");
-$c = array("a" => "foo", "b" => "bar", "c" => "fubar");
+$empty_array = array();
+$number = 5;
+$str = "abc";
-/* simple array */
-echo array_shift($a), "\n";
-var_dump($a);
-/* numerical assoc indices */
-echo array_shift($b), "\n";
-var_dump($b);
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
-/* assoc indices */
-echo array_shift($c), "\n";
-var_dump($c);
+/* Testing Error Conditions */
+echo "\n*** Testing Error Conditions ***\n";
+/* Zero argument */
+var_dump( array_shift() );
+
+/* Scalar argument */
+var_dump( array_shift($number) );
+
+/* String argument */
+var_dump( array_shift($str) );
+
+/* Invalid Number of arguments */
+var_dump( array_shift($mixed_array[1],$mixed_array[2]) );
+
+/* Empty Array as argument */
+var_dump( array_shift($empty_array) );
+
+/* Loop to test normal functionality with different arrays inputs */
+echo "\n*** Testing with various array inputs ***\n";
+
+$counter = 1;
+foreach( $mixed_array as $sub_array ) {
+ echo "\n-- Input Array for Iteration $counter is -- \n";
+ print_r( $sub_array );
+ echo "\nOutput after shift is :\n";
+ var_dump( array_shift($sub_array) );
+ $counter++;
+}
+
+/*Checking for internal array pointer beint reset when shift is called */
+
+echo"\n*** Checking for internal array pointer being reset when shift is called ***\n";
+
+echo "\nCurrent Element is : ";
+var_dump( current($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nshifted Element is : ";
+var_dump( array_shift($mixed_array[1]) );
+
+echo "\nCurrent Element after shift operation is: ";
+var_dump( current($mixed_array[1]) );
+
+echo"Done";
?>
---EXPECT--
-foo
-array(2) {
- [0]=>
- string(3) "bar"
- [1]=>
- string(5) "fubar"
-}
-foo
-array(2) {
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for array_shift() in %s line %d
+NULL
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_shift() in %s on line %d
+NULL
+NULL
+
+*** Testing with various array inputs ***
+
+-- Input Array for Iteration 1 is --
+Array
+(
+)
+
+Output after shift is :
+NULL
+
+-- Input Array for Iteration 2 is --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+)
+
+Output after shift is :
+int(1)
+
+-- Input Array for Iteration 3 is --
+Array
+(
+ [0] => One
+ [1] => _Two
+ [2] => Three
+ [3] => Four
+ [4] => Five
+)
+
+Output after shift is :
+string(3) "One"
+
+-- Input Array for Iteration 4 is --
+Array
+(
+ [0] => 6
+ [1] => six
+ [2] => 7
+ [3] => seven
+ [4] => 8
+ [5] => eight
+ [6] => 9
+ [7] => nine
+)
+
+Output after shift is :
+int(6)
+
+-- Input Array for Iteration 5 is --
+Array
+(
+ [a] => aaa
+ [A] => AAA
+ [c] => ccc
+ [d] => ddd
+ [e] => eee
+)
+
+Output after shift is :
+string(3) "aaa"
+
+-- Input Array for Iteration 6 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => three
+ [4] => four
+ [5] => five
+)
+
+Output after shift is :
+string(3) "one"
+
+-- Input Array for Iteration 7 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => 7
+ [4] => four
+ [5] => five
+)
+
+Output after shift is :
+string(3) "one"
+
+-- Input Array for Iteration 8 is --
+Array
+(
+ [f] => fff
+ [1] => one
+ [4] => 6
+ [] => 3
+ [2] => float
+ [F] => FFF
+ [blank] =>
+ [3] => 3.7
+ [5] => Five
+ [6] => 8.6
+ [4name] => jonny
+ [a] =>
+)
+
+Output after shift is :
+string(3) "fff"
+
+-- Input Array for Iteration 9 is --
+Array
+(
+ [0] => 12
+ [1] => name
+ [2] => age
+ [3] => 45
+)
+
+Output after shift is :
+int(12)
+
+-- Input Array for Iteration 10 is --
+Array
+(
+ [0] => Array
+ (
+ [0] => oNe
+ [1] => tWo
+ [2] => 4
+ )
+
+ [1] => Array
+ (
+ [0] => 10
+ [1] => 20
+ [2] => 30
+ [3] => 40
+ [4] => 50
+ )
+
+ [2] => Array
+ (
+ )
+
+)
+
+Output after shift is :
+array(3) {
[0]=>
- string(3) "bar"
+ string(3) "oNe"
[1]=>
- string(5) "fubar"
-}
-foo
-array(2) {
- ["b"]=>
- string(3) "bar"
- ["c"]=>
- string(5) "fubar"
+ string(3) "tWo"
+ [2]=>
+ int(4)
}
+
+-- Input Array for Iteration 11 is --
+Array
+(
+ [one] => 2
+ [three] => 3
+ [0] => 3
+ [1] => 4
+ [3] => 33
+ [4] => 44
+ [5] => 57
+ [6] => 6
+ [5.4] => 554
+ [5.7] => 557
+)
+
+Output after shift is :
+int(2)
+
+*** Checking for internal array pointer being reset when shift is called ***
+
+Current Element is : int(1)
+
+Next Element is : int(2)
+
+Next Element is : int(3)
+
+shifted Element is : int(1)
+
+Current Element after shift operation is: int(2)
+Done
diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt
new file mode 100644
index 000000000..399a1d5aa
--- /dev/null
+++ b/ext/standard/tests/array/009.phpt
@@ -0,0 +1,714 @@
+--TEST--
+Test key(), current(), next() & reset() functions
+--FILE--
+<?php
+/* Prototype & Usage:
+ mixed key ( array &$array ) -> returns the index element of the current array position
+ mixed current ( array &$array ) -> returns the current element in the array
+ mixed next ( array &$array ) -> similar to current() but advances the internal pointer to next element
+ mixed reset ( array &$array ) -> Reset the internal pointer to first element
+*/
+
+$basic_arrays = array (
+ array(0), // array with element as 0
+ array(1), // array with single element
+ array(1,2, 3, -1, -2, -3), // array of integers
+ array(1.1, 2.2, 3.3, -1.1, -2.2, -3.3), // array of floats
+ array('a', 'b', 'c', "ab", "ac", "ad"), // string array
+ array("a" => "apple", "b" => "book", "c" => "cook"), // associative array
+ array('d' => 'drink', 'p' => 'port', 's' => 'set'), // another associative array
+ array(1 => 'One', 2 => 'two', 3 => "three") // associative array with key as integers
+);
+
+$varient_arrays = array (
+ array(), // empty array
+ array(""), // array with null string
+ array(NULL),// array with NULL
+ array(null),// array with null
+ array(NULL, true, null, "", 1), // mixed array
+ array(-1.5 => "test", -2 => "rest", 2.5 => "two",
+ "" => "string", 0 => "zero", "" => "" ) // mixed array
+);
+
+echo "*** Testing basic operations ***\n";
+$loop_count = 1;
+foreach ($basic_arrays as $sub_array ) {
+ echo "-- Iteration $loop_count --\n";
+ $loop_count++;
+ $c = count ($sub_array);
+ $c++; // increment by one to create the situation of accessing beyond array size
+ while ( $c ) {
+ var_dump( current($sub_array)); // current element
+ var_dump( key($sub_array) ); // key of the current element
+ var_dump( next($sub_array) ); // move to next element
+ $c --;
+ }
+ var_dump( reset($sub_array) ); // reset the internal pointer to first element
+ var_dump( key($sub_array) ); // access the array after reset
+ var_dump( $sub_array ); // dump the array to see that its intact
+
+ echo "\n";
+}
+
+echo "\n*** Testing possible variations ***\n";
+$loop_count = 1;
+foreach ($varient_arrays as $sub_array ) {
+ echo "-- Iteration $loop_count --\n";
+ $loop_count++;
+ $c = count ($sub_array);
+ $c++; // increment by one to create the situation of accessing beyond array size
+ while ( $c ) {
+ var_dump( current($sub_array)); // current element
+ var_dump( key($sub_array) ); // key of the current element
+ var_dump( next($sub_array) ); // move to next element
+ $c --;
+ }
+ var_dump( reset($sub_array) ); // reset the internal pointer to first element
+ var_dump( key($sub_array) ); // access the array after reset
+ var_dump( $sub_array ); // dump the array to see that its intact
+ echo "\n";
+}
+
+/*test these functions on array which is already unset */
+echo "\n-- Testing variation: when array is unset --\n";
+$unset_array = array (1);
+unset($unset_array);
+
+var_dump( current($unset_array) );
+var_dump( key($unset_array) );
+var_dump( next($unset_array) );
+var_dump( reset($unset_array) );
+
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument, expected 1 argument
+var_dump( key() );
+var_dump( current() );
+var_dump( reset() );
+var_dump( next() );
+
+// args more than expected, expected 1 argument
+$temp_array = array(1);
+var_dump( key($temp_array, $temp_array) );
+var_dump( current($temp_array, $temp_array) );
+var_dump( reset($temp_array, $temp_array) );
+var_dump( next($temp_array, $temp_array) );
+
+// invalid args type, valid arguement: array
+$int_var = 1;
+$float_var = 1.5;
+$string = "string";
+var_dump( key($int_var) );
+var_dump( key($float_var) );
+var_dump( key($string) );
+
+var_dump( current($int_var) );
+var_dump( current($float_var) );
+var_dump( current($string) );
+
+var_dump( next($int_var) );
+var_dump( next($float_var) );
+var_dump( next($string) );
+
+var_dump( reset($int_var) );
+var_dump( reset($float_var) );
+var_dump( reset($string) );
+
+echo "\n*** Testing operation on Objects ***\n";
+// class having members of different scope
+class test_class
+{
+ private $private_var = "private_var";
+ public $public_var = "public_var";
+ protected $protected_var = "protected_var";
+ private $var1 = 10;
+ public $var2 = 30;
+ protected $var3 = 40;
+ var $integer = 3092;
+
+ private function private_fun() {
+ echo "private_fun() called\n";
+ }
+
+ protected function protected_fun() {
+ echo "protected_fun() called\n";
+ }
+
+ public function public_fun() {
+ echo "public_fun() called\n";
+ }
+}
+// class with no member variables
+class zero_member_var_class
+{
+ public function fun() {
+ echo "fun() called\n";
+ }
+}
+// class with no members
+class zero_member_class
+{
+ // no members
+}
+
+//create object of all classes defined above
+$test_class_obj = new test_class();
+$zero_member_var_class_obj = new zero_member_var_class();
+$zero_member_class_obj = new zero_member_class();
+
+$object_array = array (
+ $test_class_obj,
+ $zero_member_var_class_obj,
+ $zero_member_class_obj
+);
+
+/* loop to use function key(), current(), next() and reset()
+ on different class objects */
+$loop_count = 1;
+foreach( $object_array as $object ) {
+ echo "--- Outerloop Iteration $loop_count ---\n";
+
+ /* dump the object before performing operation on it */
+ echo "Object before performing operations ...\n";
+ var_dump($object) ;
+
+ /* loop to feach all the key/value pair from the object*/
+ $inner_loop_count = 1;
+ do {
+ echo "-- Innerloop iteration $inner_loop_count of Outerloop Iteration $loop_count --\n";
+ $inner_loop_count ++;
+
+ // print the key/value pair of the current value
+ echo "current => "; var_dump( current($object) ); // key & value pair
+ echo "key => "; var_dump( key($object) ); // key
+
+ $next_pair = next($object);
+ echo "next => "; var_dump($next_pair);
+
+ } while( FALSE != $next_pair );
+
+ $loop_count++;
+
+ /* reset the object */
+ echo "reset => "; var_dump( reset($object) );
+ echo "current => "; var_dump( current($object) ); // first variable in object
+
+ echo "\nObject after performing operations ...\n";
+ var_dump($object) ; // no change expected
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing basic operations ***
+-- Iteration 1 --
+int(0)
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+int(0)
+int(0)
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 2 --
+int(1)
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+int(1)
+int(0)
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- Iteration 3 --
+int(1)
+int(0)
+int(2)
+int(2)
+int(1)
+int(3)
+int(3)
+int(2)
+int(-1)
+int(-1)
+int(3)
+int(-2)
+int(-2)
+int(4)
+int(-3)
+int(-3)
+int(5)
+bool(false)
+bool(false)
+NULL
+bool(false)
+int(1)
+int(0)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(-1)
+ [4]=>
+ int(-2)
+ [5]=>
+ int(-3)
+}
+
+-- Iteration 4 --
+float(1.1)
+int(0)
+float(2.2)
+float(2.2)
+int(1)
+float(3.3)
+float(3.3)
+int(2)
+float(-1.1)
+float(-1.1)
+int(3)
+float(-2.2)
+float(-2.2)
+int(4)
+float(-3.3)
+float(-3.3)
+int(5)
+bool(false)
+bool(false)
+NULL
+bool(false)
+float(1.1)
+int(0)
+array(6) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+ [2]=>
+ float(3.3)
+ [3]=>
+ float(-1.1)
+ [4]=>
+ float(-2.2)
+ [5]=>
+ float(-3.3)
+}
+
+-- Iteration 5 --
+string(1) "a"
+int(0)
+string(1) "b"
+string(1) "b"
+int(1)
+string(1) "c"
+string(1) "c"
+int(2)
+string(2) "ab"
+string(2) "ab"
+int(3)
+string(2) "ac"
+string(2) "ac"
+int(4)
+string(2) "ad"
+string(2) "ad"
+int(5)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(1) "a"
+int(0)
+array(6) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(2) "ab"
+ [4]=>
+ string(2) "ac"
+ [5]=>
+ string(2) "ad"
+}
+
+-- Iteration 6 --
+string(5) "apple"
+string(1) "a"
+string(4) "book"
+string(4) "book"
+string(1) "b"
+string(4) "cook"
+string(4) "cook"
+string(1) "c"
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(5) "apple"
+string(1) "a"
+array(3) {
+ ["a"]=>
+ string(5) "apple"
+ ["b"]=>
+ string(4) "book"
+ ["c"]=>
+ string(4) "cook"
+}
+
+-- Iteration 7 --
+string(5) "drink"
+string(1) "d"
+string(4) "port"
+string(4) "port"
+string(1) "p"
+string(3) "set"
+string(3) "set"
+string(1) "s"
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(5) "drink"
+string(1) "d"
+array(3) {
+ ["d"]=>
+ string(5) "drink"
+ ["p"]=>
+ string(4) "port"
+ ["s"]=>
+ string(3) "set"
+}
+
+-- Iteration 8 --
+string(3) "One"
+int(1)
+string(3) "two"
+string(3) "two"
+int(2)
+string(5) "three"
+string(5) "three"
+int(3)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(3) "One"
+int(1)
+array(3) {
+ [1]=>
+ string(3) "One"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+}
+
+
+*** Testing possible variations ***
+-- Iteration 1 --
+bool(false)
+NULL
+bool(false)
+bool(false)
+NULL
+array(0) {
+}
+
+-- Iteration 2 --
+string(0) ""
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(0) ""
+int(0)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 3 --
+NULL
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+NULL
+int(0)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 4 --
+NULL
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+NULL
+int(0)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 5 --
+NULL
+int(0)
+bool(true)
+bool(true)
+int(1)
+NULL
+NULL
+int(2)
+string(0) ""
+string(0) ""
+int(3)
+int(1)
+int(1)
+int(4)
+bool(false)
+bool(false)
+NULL
+bool(false)
+NULL
+int(0)
+array(5) {
+ [0]=>
+ NULL
+ [1]=>
+ bool(true)
+ [2]=>
+ NULL
+ [3]=>
+ string(0) ""
+ [4]=>
+ int(1)
+}
+
+-- Iteration 6 --
+string(4) "test"
+int(-1)
+string(4) "rest"
+string(4) "rest"
+int(-2)
+string(3) "two"
+string(3) "two"
+int(2)
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "zero"
+string(4) "zero"
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(4) "test"
+int(-1)
+array(5) {
+ [-1]=>
+ string(4) "test"
+ [-2]=>
+ string(4) "rest"
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+ [0]=>
+ string(4) "zero"
+}
+
+
+-- Testing variation: when array is unset --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for key() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for current() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for reset() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for next() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for key() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for current() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for reset() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for next() in %s on line %d
+NULL
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+*** Testing operation on Objects ***
+--- Outerloop Iteration 1 ---
+Object before performing operations ...
+object(test_class)#1 (7) {
+ ["private_var:private"]=>
+ string(11) "private_var"
+ ["public_var"]=>
+ string(10) "public_var"
+ ["protected_var:protected"]=>
+ string(13) "protected_var"
+ ["var1:private"]=>
+ int(10)
+ ["var2"]=>
+ int(30)
+ ["var3:protected"]=>
+ int(40)
+ ["integer"]=>
+ int(3092)
+}
+-- Innerloop iteration 1 of Outerloop Iteration 1 --
+current => string(11) "private_var"
+key => string(23) "
+next => string(10) "public_var"
+-- Innerloop iteration 2 of Outerloop Iteration 1 --
+current => string(10) "public_var"
+key => string(10) "public_var"
+next => string(13) "protected_var"
+-- Innerloop iteration 3 of Outerloop Iteration 1 --
+current => string(13) "protected_var"
+key => string(16) "
+next => int(10)
+-- Innerloop iteration 4 of Outerloop Iteration 1 --
+current => int(10)
+key => string(16) "
+next => int(30)
+-- Innerloop iteration 5 of Outerloop Iteration 1 --
+current => int(30)
+key => string(4) "var2"
+next => int(40)
+-- Innerloop iteration 6 of Outerloop Iteration 1 --
+current => int(40)
+key => string(7) "
+next => int(3092)
+-- Innerloop iteration 7 of Outerloop Iteration 1 --
+current => int(3092)
+key => string(7) "integer"
+next => bool(false)
+reset => string(11) "private_var"
+current => string(11) "private_var"
+
+Object after performing operations ...
+object(test_class)#1 (7) {
+ ["private_var:private"]=>
+ string(11) "private_var"
+ ["public_var"]=>
+ string(10) "public_var"
+ ["protected_var:protected"]=>
+ string(13) "protected_var"
+ ["var1:private"]=>
+ int(10)
+ ["var2"]=>
+ int(30)
+ ["var3:protected"]=>
+ int(40)
+ ["integer"]=>
+ int(3092)
+}
+--- Outerloop Iteration 2 ---
+Object before performing operations ...
+object(zero_member_var_class)#2 (0) {
+}
+-- Innerloop iteration 1 of Outerloop Iteration 2 --
+current => bool(false)
+key => NULL
+next => bool(false)
+reset => bool(false)
+current => bool(false)
+
+Object after performing operations ...
+object(zero_member_var_class)#2 (0) {
+}
+--- Outerloop Iteration 3 ---
+Object before performing operations ...
+object(zero_member_class)#3 (0) {
+}
+-- Innerloop iteration 1 of Outerloop Iteration 3 --
+current => bool(false)
+key => NULL
+next => bool(false)
+reset => bool(false)
+current => bool(false)
+
+Object after performing operations ...
+object(zero_member_class)#3 (0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_change_key_case.phpt b/ext/standard/tests/array/array_change_key_case.phpt
index 0cd1d8203..8e785a84d 100644
--- a/ext/standard/tests/array/array_change_key_case.phpt
+++ b/ext/standard/tests/array/array_change_key_case.phpt
@@ -1,56 +1,92 @@
--TEST--
-array_change_key_case()
+Test array_change_key_case() function
--FILE--
<?php
+/* Prototype: array array_change_key_case ( array $input [, int $case] )
+ Description: Changes the keys in the input array to be all lowercase
+ or uppercase. The change depends on the last optional case parameter.
+ You can pass two constants there, CASE_UPPER and CASE_LOWER(default).
+ The function will leave number indices as is.
+*/
$arrays = array (
- array (),
- array (0),
- array (1),
- array (-1),
- array (0, 2, 3, 4, 5),
- array (1, 2, 3, 4, 5),
- array ("" => 1),
- array ("a" => 1),
- array ("Z" => 1),
- array ("one" => 1),
- array ("ONE" => 1),
- array ("OnE" => 1),
- array ("oNe" => 1),
- array ("one" => 1, "two" => 2),
- array ("ONE" => 1, "two" => 2),
- array ("OnE" => 1, "two" => 2),
- array ("oNe" => 1, "two" => 2),
- array ("one" => 1, "TWO" => 2),
- array ("ONE" => 1, "TWO" => 2),
- array ("OnE" => 1, "TWO" => 2),
- array ("oNe" => 1, "TWO" => 2),
- array ("one" => 1, "TwO" => 2),
- array ("ONE" => 1, "TwO" => 2),
- array ("OnE" => 1, "TwO" => 2),
- array ("oNe" => 1, "TwO" => 2),
- array ("one" => 1, "tWo" => 2),
- array ("ONE" => 1, "tWo" => 2),
- array ("OnE" => 1, "tWo" => 2),
- array ("oNe" => 1, "tWo" => 2),
- array ("one" => 1, 2),
- array ("ONE" => 1, 2),
- array ("OnE" => 1, 2),
- array ("oNe" => 1, 2),
- array ("ONE" => 1, "TWO" => 2, "THREE" => 3, "FOUR" => "four"),
- array ("one" => 1, "two" => 2, "three" => 3, "four" => "FOUR"),
- array ("ONE" => 1, "TWO" => 2, "three" => 3, "four" => "FOUR"),
- array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four")
+ array (),
+ array (0),
+ array (1),
+ array (-1),
+ array (0, 2, 3, 4, 5),
+ array (1, 2, 3, 4, 5),
+ array ("" => 1),
+ array ("a" => 1),
+ array ("Z" => 1),
+ array ("one" => 1),
+ array ("ONE" => 1),
+ array ("OnE" => 1),
+ array ("oNe" => 1),
+ array ("one" => 1, "two" => 2),
+ array ("ONE" => 1, "two" => 2),
+ array ("OnE" => 1, "two" => 2),
+ array ("oNe" => 1, "two" => 2),
+ array ("one" => 1, "TWO" => 2),
+ array ("ONE" => 1, "TWO" => 2),
+ array ("OnE" => 1, "TWO" => 2),
+ array ("oNe" => 1, "TWO" => 2),
+ array ("one" => 1, "TwO" => 2),
+ array ("ONE" => 1, "TwO" => 2),
+ array ("OnE" => 1, "TwO" => 2),
+ array ("oNe" => 1, "TwO" => 2),
+ array ("one" => 1, "tWo" => 2),
+ array ("ONE" => 1, "tWo" => 2),
+ array ("OnE" => 1, "tWo" => 2),
+ array ("oNe" => 1, "tWo" => 2),
+ array ("one" => 1, 2),
+ array ("ONE" => 1, 2),
+ array ("OnE" => 1, 2),
+ array ("oNe" => 1, 2),
+ array ("ONE" => 1, "TWO" => 2, "THREE" => 3, "FOUR" => "four"),
+ array ("one" => 1, "two" => 2, "three" => 3, "four" => "FOUR"),
+ array ("ONE" => 1, "TWO" => 2, "three" => 3, "four" => "FOUR"),
+ array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four")
);
+echo "*** Testing basic operations ***\n";
+$loop_counter = 1;
foreach ($arrays as $item) {
+ echo "** Iteration $loop_counter **\n"; $loop_counter++;
var_dump(array_change_key_case($item));
var_dump(array_change_key_case($item, CASE_UPPER));
var_dump(array_change_key_case($item, CASE_LOWER));
echo "\n";
}
+
+echo "\n*** Testing possible variations ***\n";
+$int_var = -19;
+$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
+
+/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
+var_dump(array_change_key_case($item, "CASE_UPPER"));
+var_dump(array_change_key_case($item, 5));
+
+/* when keys are different in terms of only case */
+/* should return one value key pair with key being in lowercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) );
+
+/* should return one value key pair with key being in uppercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) );
+
+echo "\n*** Testing error conditions ***\n";
+/* generate different failure conditions */
+var_dump( array_change_key_case($int_var) ); // args less than expected
+var_dump( array_change_key_case($int_var, CASE_UPPER) ); // invalid first argument
+var_dump( array_change_key_case() ); // Zero argument
+var_dump( array_change_key_case($item, $item["one"], "CASE_UPPER") ); // more than expected numbers
+
echo "end\n";
?>
---EXPECT--
+--EXPECTF--
+*** Testing basic operations ***
+** Iteration 1 **
array(0) {
}
array(0) {
@@ -58,6 +94,7 @@ array(0) {
array(0) {
}
+** Iteration 2 **
array(1) {
[0]=>
int(0)
@@ -71,6 +108,7 @@ array(1) {
int(0)
}
+** Iteration 3 **
array(1) {
[0]=>
int(1)
@@ -84,6 +122,7 @@ array(1) {
int(1)
}
+** Iteration 4 **
array(1) {
[0]=>
int(-1)
@@ -97,6 +136,7 @@ array(1) {
int(-1)
}
+** Iteration 5 **
array(5) {
[0]=>
int(0)
@@ -134,6 +174,7 @@ array(5) {
int(5)
}
+** Iteration 6 **
array(5) {
[0]=>
int(1)
@@ -171,6 +212,7 @@ array(5) {
int(5)
}
+** Iteration 7 **
array(1) {
[""]=>
int(1)
@@ -184,6 +226,7 @@ array(1) {
int(1)
}
+** Iteration 8 **
array(1) {
["a"]=>
int(1)
@@ -197,6 +240,7 @@ array(1) {
int(1)
}
+** Iteration 9 **
array(1) {
["z"]=>
int(1)
@@ -210,6 +254,7 @@ array(1) {
int(1)
}
+** Iteration 10 **
array(1) {
["one"]=>
int(1)
@@ -223,6 +268,7 @@ array(1) {
int(1)
}
+** Iteration 11 **
array(1) {
["one"]=>
int(1)
@@ -236,6 +282,7 @@ array(1) {
int(1)
}
+** Iteration 12 **
array(1) {
["one"]=>
int(1)
@@ -249,6 +296,7 @@ array(1) {
int(1)
}
+** Iteration 13 **
array(1) {
["one"]=>
int(1)
@@ -262,6 +310,7 @@ array(1) {
int(1)
}
+** Iteration 14 **
array(2) {
["one"]=>
int(1)
@@ -281,6 +330,7 @@ array(2) {
int(2)
}
+** Iteration 15 **
array(2) {
["one"]=>
int(1)
@@ -300,6 +350,7 @@ array(2) {
int(2)
}
+** Iteration 16 **
array(2) {
["one"]=>
int(1)
@@ -319,6 +370,7 @@ array(2) {
int(2)
}
+** Iteration 17 **
array(2) {
["one"]=>
int(1)
@@ -338,6 +390,7 @@ array(2) {
int(2)
}
+** Iteration 18 **
array(2) {
["one"]=>
int(1)
@@ -357,6 +410,7 @@ array(2) {
int(2)
}
+** Iteration 19 **
array(2) {
["one"]=>
int(1)
@@ -376,6 +430,7 @@ array(2) {
int(2)
}
+** Iteration 20 **
array(2) {
["one"]=>
int(1)
@@ -395,6 +450,7 @@ array(2) {
int(2)
}
+** Iteration 21 **
array(2) {
["one"]=>
int(1)
@@ -414,6 +470,7 @@ array(2) {
int(2)
}
+** Iteration 22 **
array(2) {
["one"]=>
int(1)
@@ -433,6 +490,7 @@ array(2) {
int(2)
}
+** Iteration 23 **
array(2) {
["one"]=>
int(1)
@@ -452,6 +510,7 @@ array(2) {
int(2)
}
+** Iteration 24 **
array(2) {
["one"]=>
int(1)
@@ -471,6 +530,7 @@ array(2) {
int(2)
}
+** Iteration 25 **
array(2) {
["one"]=>
int(1)
@@ -490,6 +550,7 @@ array(2) {
int(2)
}
+** Iteration 26 **
array(2) {
["one"]=>
int(1)
@@ -509,6 +570,7 @@ array(2) {
int(2)
}
+** Iteration 27 **
array(2) {
["one"]=>
int(1)
@@ -528,6 +590,7 @@ array(2) {
int(2)
}
+** Iteration 28 **
array(2) {
["one"]=>
int(1)
@@ -547,6 +610,7 @@ array(2) {
int(2)
}
+** Iteration 29 **
array(2) {
["one"]=>
int(1)
@@ -566,6 +630,7 @@ array(2) {
int(2)
}
+** Iteration 30 **
array(2) {
["one"]=>
int(1)
@@ -585,6 +650,7 @@ array(2) {
int(2)
}
+** Iteration 31 **
array(2) {
["one"]=>
int(1)
@@ -604,6 +670,7 @@ array(2) {
int(2)
}
+** Iteration 32 **
array(2) {
["one"]=>
int(1)
@@ -623,6 +690,7 @@ array(2) {
int(2)
}
+** Iteration 33 **
array(2) {
["one"]=>
int(1)
@@ -642,6 +710,7 @@ array(2) {
int(2)
}
+** Iteration 34 **
array(4) {
["one"]=>
int(1)
@@ -673,6 +742,7 @@ array(4) {
string(4) "four"
}
+** Iteration 35 **
array(4) {
["one"]=>
int(1)
@@ -704,6 +774,7 @@ array(4) {
string(4) "FOUR"
}
+** Iteration 36 **
array(4) {
["one"]=>
int(1)
@@ -735,6 +806,7 @@ array(4) {
string(4) "FOUR"
}
+** Iteration 37 **
array(4) {
["one"]=>
int(1)
@@ -766,4 +838,56 @@ array(4) {
string(4) "four"
}
+
+*** Testing possible variations ***
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ ["four"]=>
+ string(4) "four"
+}
+array(4) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+ ["FOUR"]=>
+ string(4) "four"
+}
+array(1) {
+ ["one"]=>
+ int(4)
+}
+array(1) {
+ ["one"]=>
+ int(5)
+}
+array(1) {
+ ["ONE"]=>
+ int(3)
+}
+array(1) {
+ ["ONE"]=>
+ int(2)
+}
+
+*** Testing error conditions ***
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for array_change_key_case() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_change_key_case() in %s on line %d
+NULL
end
diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt
index 65c38234c..b4d51680e 100755
--- a/ext/standard/tests/array/array_fill_keys.phpt
+++ b/ext/standard/tests/array/array_fill_keys.phpt
@@ -1,5 +1,7 @@
--TEST--
basic array_fill_keys test
+--INI--
+precision=14
--FILE--
<?php
var_dump(array_fill_keys('test', 1));
diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt
index e7b6c0677..0d0b66301 100644
--- a/ext/standard/tests/array/array_key_exists.phpt
+++ b/ext/standard/tests/array/array_key_exists.phpt
@@ -1,24 +1,254 @@
--TEST--
-array_key_exists() tests
+Test array_key_exists() function
--FILE--
<?php
+/* Prototype:
+ * bool array_key_exists ( mixed $key, array $search );
+ * Description:
+ * Returns TRUE if the given key is set in the array.
+ * key can be any value possible for an array index.
+ * Also also works on objects.
+ */
-var_dump(array_key_exists());
-var_dump(array_key_exists(array(), array()));
-var_dump(array_key_exists("", ""));
-var_dump(array_key_exists("", array()));
-var_dump(array_key_exists(1, array()));
+echo "*** Testing basic functionalities ***\n";
+/* Arrays with regular values */
+$search_arrays = array(
+ array(1,2,3,4),
+ array('a','b','c'),
+ array('abc', 'bcd', 'dcf'),
+ array("test", "rest", "enjoy"),
+ array("Name" => "Jack", "Loc" => "Mars", "Id" => "MS123"),
+ array('Red' => 'Rose', 'I' => 'You'),
+ array(0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => "Three" ),
+ array(0.1 => 'Zero', 1.1 => 'One', 2.2 => 'Two', 3.3 => "Three" )
+ );
+/* keys to search in $search_arrays. $keys[0]
+ is the key to be searched in $search_arrays[0] and so on */
+$keys = array( 1, 'a', 2, 4, "Name", "Red", 0, 3 );
-var_dump(array_key_exists(1, array(1,2,3)));
-var_dump(array_key_exists("a", array(3,2,1,"a"=>1)));
-var_dump(array_key_exists("a", array(3,2,1)));
-var_dump(array_key_exists(NULL, array(5,6,7,""=>"value", 3,2,1)));
-var_dump(array_key_exists(NULL, array(5,6,7,3,2,1)));
-var_dump(array_key_exists(false, array(5,6,7,""=>"value", 3,2,1)));
+$key_counter = 0;
+foreach ($search_arrays as $search_array) {
+ $key = $keys[ $key_counter++ ];
+ echo "-- Iteration $key_counter --\n";
+ var_dump( array_key_exists($key, $search_array) );
+}
+echo "\n*** Testing possible variations ***\n";
+// use different keys on each sub array of $search_arrays
+$key_variations = array ("", NULL, null, " ", '', "test", 1);
+$key_counter = 0;
+$key_count = count ( $key_variations );
+echo "\n** Variation loop 1 **\n";
+$out_loop_count = 0;
+foreach ($search_arrays as $search_array) {
+ $key_counter = 0;
+ $out_loop_count ++; echo "-- Iteration $out_loop_count --\n";
+ while ( $key_counter < $key_count ) {
+ $key = $key_variations[ $key_counter++ ];
+ var_dump( array_key_exists($key, $search_array) );
+ }
+}
+// arrays with variation in elements
+$search_arrays_v = array (
+ array(),
+ array(NULL),
+ array(array(), 1, 2),
+ array(1,2,3, "" => "value", NULL => "value", true => "value" ),
+ array( array(2,4,5), array ("a","b","d") )
+ );
+// search for $key_variations in each sub array of $search_arrays_v
+echo "\n** Variation loop 2 **\n";
+$out_loop_count = 0;
+foreach ($search_arrays_v as $search_array) {
+ $key_counter = 0;
+ $out_loop_count ++; echo "-- Iteration $out_loop_count --\n";
+ while ( $key_counter < $key_count ) {
+ $key = $key_variations[ $key_counter++ ];
+ var_dump( array_key_exists($key, $search_array) );
+ }
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zeor args
+var_dump( array_key_exists() );
+// first args as array
+var_dump( array_key_exists(array(), array()) );
+// second args as string
+var_dump( array_key_exists("", "") );
+// second args a integer
+var_dump( array_key_exists(1, 1) );
+// second args as NULL
+var_dump( array_key_exists(1, NULL) );
+// second args as boolean
+var_dump( array_key_exists(1, true) );
+// first args as boolean
+var_dump( array_key_exists(false, true) );
+// second args as float
+var_dump( array_key_exists(false, 17.5) );
+// args more than expected
+var_dump( array_key_exists(1, array(), array()) );
+// first argument as floating point value
+var_dump( array_key_exists(17.5, array(1,23) ) ) ;
+
+echo "\n*** Testing operation on objects ***\n";
+class key_check
+{
+ private $private_var = "Priviate var";
+ protected $protected_var = "Protected var";
+ public $public_var = "Public var";
+ public $arr = array("var" => "value", "1" => "one", ""=>"value");
+ public function print_member()
+ {
+ echo $this->$private_var."\n";
+ echo $this->$protected_var."\n";
+ echo $this->$public_var."\n";
+ }
+}
+
+$key_check_obj = new key_check; //new object
+/* array_key_exists() on an object, it should work on only public member variables */
+var_dump(array_key_exists("private_var", $key_check_obj)); // not found, private member
+var_dump(array_key_exists("protected_var", $key_check_obj)); // not found, private member
+var_dump(array_key_exists("public_var", $key_check_obj)); // found, public member
+var_dump(array_key_exists("print_member", $key_check_obj)); // not found, its a function
+var_dump(array_key_exists("arr", $key_check_obj)); //found, public member
+var_dump(array_key_exists("var", $key_check_obj->arr)); //found, key is in member array
+
+/* error condition, first arguemnt as object */
+var_dump( array_key_exists($key_check_obj, $key_check_obj) );
echo "Done\n";
?>
--EXPECTF--
+*** Testing basic functionalities ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+
+*** Testing possible variations ***
+
+** Variation loop 1 **
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+** Variation loop 2 **
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+*** Testing error conditions ***
+
Warning: Wrong parameter count for array_key_exists() in %s on line %d
NULL
@@ -27,13 +257,35 @@ bool(false)
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for array_key_exists() in %s on line %d
+NULL
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+*** Testing operation on objects ***
bool(false)
-bool(true)
-bool(true)
bool(false)
bool(true)
bool(false)
+bool(true)
+bool(true)
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
diff --git a/ext/standard/tests/array/array_keys.phpt b/ext/standard/tests/array/array_keys.phpt
new file mode 100644
index 000000000..07bb3446b
--- /dev/null
+++ b/ext/standard/tests/array/array_keys.phpt
@@ -0,0 +1,466 @@
+--TEST--
+Test array_keys() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/*
+Prototype: array array_keys( array $input [, mixed $search_value [,
+ bool $strict]]);
+Description: Return all the keys of an array
+*/
+
+echo "*** Testing array_keys() on basic array operation ***\n";
+$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd",
+ array(1,2,3));
+var_dump(array_keys($basic_arr));
+
+echo "\n*** Testing array_keys() on various arrays ***";
+$arrays = array(
+ array(),
+ array(0),
+ array( array() ),
+ array("Hello" => "World"),
+ array("" => ""),
+ array(1,2,3, "d" => array(4,6, "d")),
+ array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
+ array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
+ array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
+ array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
+ array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
+ array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
+);
+
+$i = 0;
+/* loop through to test array_keys() with different arrays */
+foreach ($arrays as $array) {
+ echo "\n-- Iteration $i --\n";
+ var_dump(array_keys($array));
+ $i++;
+}
+
+echo "\n*** Testing array_keys() on all the types other than arrays ***";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ echo "\n-- Loose type checking --\n";
+ var_dump(array_keys($types_arr, $value));
+ echo "\n-- strict type checking --\n";
+ var_dump(array_keys($types_arr, $value, TRUE));
+}
+
+echo "\n*** Testing array_keys() with resource type ***\n";
+$resource1 = fopen( __FILE__, "r");
+$resource2 = opendir( "." );
+
+/* creating an array with resource types as elements */
+$arr_resource = array($resource1, $resource2);
+
+var_dump(array_keys($arr_resource, $resource1)); // loose type checking
+var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
+var_dump(array_keys($arr_resource, $resource2)); // loose type checking
+var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "\n*** Testing error conditions ***";
+var_dump(array_keys(100));
+var_dump(array_keys("string"));
+var_dump(array_keys(new stdclass)); // object
+var_dump(array_keys()); // Zero arguments
+var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
+var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
+
+echo "Done\n";
+
+--CLEAN--
+/* Closing the resource handles */
+fclose( $resource1 );
+closedir( $resource2 );
+?>
+--EXPECTF--
+*** Testing array_keys() on basic array operation ***
+array(5) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ int(2)
+ [3]=>
+ int(-23)
+ [4]=>
+ int(3)
+}
+
+*** Testing array_keys() on various arrays ***
+-- Iteration 0 --
+array(0) {
+}
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(5) "Hello"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(5) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "a"
+ [3]=>
+ int(3)
+ [4]=>
+ int(5)
+}
+
+-- Iteration 9 --
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ string(0) ""
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(2) "ab"
+ [2]=>
+ string(2) "cd"
+}
+
+-- Iteration 11 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(0) ""
+}
+
+*** Testing array_keys() on all the types other than arrays ***
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(-1)
+ [2]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "php"
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(2)
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(3)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+*** Testing array_keys() with resource type ***
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Testing array_keys() on range of values ***
+array(4) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(-2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(0)
+}
+
+*** Testing array_keys() on an array created on the fly ***
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(0) {
+}
+
+*** Testing error conditions ***
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Illegal offset type in %s on line %d
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_64bit.phpt b/ext/standard/tests/array/array_keys_64bit.phpt
new file mode 100644
index 000000000..3ffba0b4a
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_64bit.phpt
@@ -0,0 +1,472 @@
+--TEST--
+Test array_keys() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/*
+Prototype: array array_keys( array $input [, mixed $search_value [,
+ bool $strict]]);
+Description: Return all the keys of an array
+*/
+
+echo "*** Testing array_keys() on basic array operation ***\n";
+$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd",
+ array(1,2,3));
+var_dump(array_keys($basic_arr));
+
+echo "\n*** Testing array_keys() on various arrays ***";
+$arrays = array(
+ array(),
+ array(0),
+ array( array() ),
+ array("Hello" => "World"),
+ array("" => ""),
+ array(1,2,3, "d" => array(4,6, "d")),
+ array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
+ array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
+ array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
+ array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
+ array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
+ array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
+);
+
+$i = 0;
+/* loop through to test array_keys() with different arrays */
+foreach ($arrays as $array) {
+ echo "\n-- Iteration $i --\n";
+ var_dump(array_keys($array));
+ $i++;
+}
+
+echo "\n*** Testing array_keys() on all the types other than arrays ***";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ echo "\n-- Loose type checking --\n";
+ var_dump(array_keys($types_arr, $value));
+ echo "\n-- strict type checking --\n";
+ var_dump(array_keys($types_arr, $value, TRUE));
+}
+
+echo "\n*** Testing array_keys() with resource type ***\n";
+$resource1 = fopen( __FILE__, "r");
+$resource2 = opendir( "." );
+
+/* creating an array with resource types as elements */
+$arr_resource = array($resource1, $resource2);
+
+var_dump(array_keys($arr_resource, $resource1)); // loose type checking
+var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
+var_dump(array_keys($arr_resource, $resource2)); // loose type checking
+var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "\n*** Testing error conditions ***";
+var_dump(array_keys(100));
+var_dump(array_keys("string"));
+var_dump(array_keys(new stdclass)); // object
+var_dump(array_keys()); // Zero arguments
+var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
+var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
+
+echo "Done\n";
+
+--CLEAN--
+/* Closing the resource handles */
+fclose( $resource1 );
+closedir( $resource2 );
+?>
+--EXPECTF--
+*** Testing array_keys() on basic array operation ***
+array(5) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ int(2)
+ [3]=>
+ int(-23)
+ [4]=>
+ int(3)
+}
+
+*** Testing array_keys() on various arrays ***
+-- Iteration 0 --
+array(0) {
+}
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(5) "Hello"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(5) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "a"
+ [3]=>
+ int(3)
+ [4]=>
+ int(5)
+}
+
+-- Iteration 9 --
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ string(0) ""
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(2) "ab"
+ [2]=>
+ string(2) "cd"
+}
+
+-- Iteration 11 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(0) ""
+}
+
+*** Testing array_keys() on all the types other than arrays ***
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(-1)
+ [2]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "php"
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(2)
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(3)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+*** Testing array_keys() with resource type ***
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Testing array_keys() on range of values ***
+array(6) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(-2147483648)
+ [4]=>
+ int(-2147483649)
+ [5]=>
+ int(0)
+}
+
+*** Testing array_keys() on an array created on the fly ***
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(0) {
+}
+
+*** Testing error conditions ***
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Illegal offset type in %s on line %d
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_map.phpt b/ext/standard/tests/array/array_map.phpt
new file mode 100644
index 000000000..78815e083
--- /dev/null
+++ b/ext/standard/tests/array/array_map.phpt
@@ -0,0 +1,423 @@
+--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_pop.phpt b/ext/standard/tests/array/array_pop.phpt
new file mode 100644
index 000000000..544be2211
--- /dev/null
+++ b/ext/standard/tests/array/array_pop.phpt
@@ -0,0 +1,286 @@
+--TEST--
+Test array_pop() function
+--FILE--
+<?php
+
+/* Prototype: mixed array_pop( array &array );
+ * Description: Pops and returns the last value of the array.
+ */
+
+array_pop($GLOBALS);
+
+$empty_array = array();
+$number = 5;
+$str = "abc";
+
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+/* Testing Error Conditions */
+echo "\n*** Testing Error Conditions ***\n";
+
+/* Zero argument */
+var_dump( array_pop() );
+
+/* Scalar argument */
+var_dump( array_pop($number) );
+
+/* String argument */
+var_dump( array_pop($str) );
+
+/* Invalid Number of arguments */
+var_dump( array_pop($mixed_array[1],$mixed_array[2]) );
+
+/* Empty Array as argument */
+var_dump( array_pop($empty_array) );
+
+/* Loop to test normal functionality with different arrays inputs */
+echo "\n*** Normal testing with various array inputs ***\n";
+
+$counter = 1;
+foreach( $mixed_array as $sub_array )
+{
+ echo "\n-- Input Array for Iteration $counter is --\n";
+ print_r( $sub_array );
+ echo "\nOutput after Pop is :\n";
+ var_dump( array_pop($sub_array) );
+ $counter++;
+}
+
+echo"\n*** Checking for internal array pointer being reset when pop is called ***\n";
+
+echo "\nCurrent Element is : ";
+var_dump( current($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nPOPed Element is : ";
+var_dump( array_pop($mixed_array[1]) );
+
+echo "\nCurrent Element after POP operation is: ";
+var_dump( current($mixed_array[1]) );
+
+echo"\nDone";
+?>
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for array_pop() in %s on line %d
+NULL
+
+Warning: array_pop(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pop(): The argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_pop() in %s on line %d
+NULL
+NULL
+
+*** Normal testing with various array inputs ***
+
+-- Input Array for Iteration 1 is --
+Array
+(
+)
+
+Output after Pop is :
+NULL
+
+-- Input Array for Iteration 2 is --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+)
+
+Output after Pop is :
+int(9)
+
+-- Input Array for Iteration 3 is --
+Array
+(
+ [0] => One
+ [1] => _Two
+ [2] => Three
+ [3] => Four
+ [4] => Five
+)
+
+Output after Pop is :
+string(4) "Five"
+
+-- Input Array for Iteration 4 is --
+Array
+(
+ [0] => 6
+ [1] => six
+ [2] => 7
+ [3] => seven
+ [4] => 8
+ [5] => eight
+ [6] => 9
+ [7] => nine
+)
+
+Output after Pop is :
+string(4) "nine"
+
+-- Input Array for Iteration 5 is --
+Array
+(
+ [a] => aaa
+ [A] => AAA
+ [c] => ccc
+ [d] => ddd
+ [e] => eee
+)
+
+Output after Pop is :
+string(3) "eee"
+
+-- Input Array for Iteration 6 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => three
+ [4] => four
+ [5] => five
+)
+
+Output after Pop is :
+string(4) "five"
+
+-- Input Array for Iteration 7 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => 7
+ [4] => four
+ [5] => five
+)
+
+Output after Pop is :
+string(4) "five"
+
+-- Input Array for Iteration 8 is --
+Array
+(
+ [f] => fff
+ [1] => one
+ [4] => 6
+ [] => 3
+ [2] => float
+ [F] => FFF
+ [blank] =>
+ [3] => 3.7
+ [5] => Five
+ [6] => 8.6
+ [4name] => jonny
+ [a] =>
+)
+
+Output after Pop is :
+NULL
+
+-- Input Array for Iteration 9 is --
+Array
+(
+ [0] => 12
+ [1] => name
+ [2] => age
+ [3] => 45
+)
+
+Output after Pop is :
+string(2) "45"
+
+-- Input Array for Iteration 10 is --
+Array
+(
+ [0] => Array
+ (
+ [0] => oNe
+ [1] => tWo
+ [2] => 4
+ )
+
+ [1] => Array
+ (
+ [0] => 10
+ [1] => 20
+ [2] => 30
+ [3] => 40
+ [4] => 50
+ )
+
+ [2] => Array
+ (
+ )
+
+)
+
+Output after Pop is :
+array(0) {
+}
+
+-- Input Array for Iteration 11 is --
+Array
+(
+ [one] => 2
+ [three] => 3
+ [0] => 3
+ [1] => 4
+ [3] => 33
+ [4] => 44
+ [5] => 57
+ [6] => 6
+ [5.4] => 554
+ [5.7] => 557
+)
+
+Output after Pop is :
+int(557)
+
+*** Checking for internal array pointer being reset when pop is called ***
+
+Current Element is : int(1)
+
+Next Element is : int(2)
+
+Next Element is : int(3)
+
+POPed Element is : int(9)
+
+Current Element after POP operation is: int(1)
+
+Done
diff --git a/ext/standard/tests/array/array_search.phpt b/ext/standard/tests/array/array_search.phpt
index e95fda128..f6712eee9 100644
--- a/ext/standard/tests/array/array_search.phpt
+++ b/ext/standard/tests/array/array_search.phpt
@@ -1,7 +1,13 @@
--TEST--
-search_array and in_array (including bug 13567)
+Test array_search() and in_array() functions (including bug 13567)
--FILE--
<?php
+/* Prototype: bool in_array ( mixed $needle, array $haystack [, bool $strict] );
+ Description: Checks if a value exists in an array
+ Searches haystack for needle and returns TRUE if found in array, FALSE otherwise.
+ If the third parameter strict is set to TRUE then the in_array() function
+ will also check the types of the needle in the haystack.
+*/
$arr1 = array('a','b','c');
$arr2 = array();
@@ -9,6 +15,7 @@ $arr3 = array('c','key'=>'d');
$arr4 = array("a\0b"=>'e','key'=>'d', 'f');
$tests = <<<TESTS
+FALSE === in_array(123, \$arr2)
FALSE === in_array(123, \$arr1)
FALSE === array_search(123, \$arr1)
TRUE === in_array('a', \$arr1)
@@ -19,5 +26,862 @@ TESTS;
include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
---EXPECT--
+/* checking for STRICT option in in_array() */
+echo "\n*** Testing STRICT option of in_array() on arrays ***\n";
+$arrays = array (
+ array(0),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
+ array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9),
+ array(TRUE, FALSE),
+ array("", array()),
+ array("abcd\x00abcd\x00abcd"),
+ array("abcd\tabcd\nabcd\rabcd\0abcdefghij")
+);
+
+$array_compare = array (
+ 4,
+ "4",
+ 4.00,
+ "b",
+ "5",
+ -2,
+ -2.0,
+ -2.98989,
+ "-.9",
+ "True",
+ "",
+ array(),
+ NULL,
+ "ab",
+ "abcd",
+ 0.0,
+ -0,
+ "abcd\x00abcd\x00abcd"
+);
+/* loop to check if elements in $array_compare exist in $arrays
+ using in_array() */
+$counter = 1;
+foreach($arrays as $array) {
+ foreach($array_compare as $compare) {
+ echo "-- Iteration $counter --\n";
+ //strict option OFF
+ var_dump(in_array($compare,$array));
+ //strict option ON
+ var_dump(in_array($compare,$array,TRUE));
+ //strict option OFF
+ var_dump(in_array($compare,$array,FALSE));
+ $counter++;
+ }
+}
+
+/* checking loose and strict TYPE comparisons in in_array() */
+echo "\n*** Testing loose and strict TYPE comparison of in_array() ***\n";
+$misc_array = array (
+ 'a',
+ 'key' =>'d',
+ 3,
+ ".001" =>-67,
+ "-.051" =>"k",
+ 0.091 =>"-.08",
+ "e" =>"5",
+ "y" =>NULL,
+ NULL =>"",
+ 0,
+ TRUE,
+ FALSE,
+ -27.39999999999,
+ " ",
+ "abcd\x00abcd\x00\abcd\x00abcdefghij",
+ "abcd\nabcd\tabcd\rabcd\0abcd"
+);
+$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
+/* loop to do loose and strict type check of elements in
+ $array_type on elements in $misc_array using in_array();
+ checking PHP type comparison tables
+*/
+$counter = 1;
+foreach($array_type as $type) {
+ echo "-- Iteration $counter --\n";
+ //loose type checking
+ var_dump( in_array($type,$misc_array ) );
+ //strict type checking
+ var_dump( in_array($type,$misc_array,true) );
+ //loose type checking
+ var_dump( in_array($type,$misc_array,false) );
+ $counter++;
+}
+
+/* checking for sub-arrays with in_array() */
+echo "\n*** Testing sub-arrays with in_array() ***\n";
+$sub_array = array (
+ "one",
+ array(1, 2 => "two", "three" => 3),
+ 4 => "four",
+ "five" => 5,
+ array('', 'i')
+);
+var_dump( in_array("four", $sub_array) );
+//checking for element in a sub-array
+var_dump( in_array(3, $sub_array[1]) );
+var_dump( in_array(array('','i'), $sub_array) );
+
+/* checking for objects in in_array() */
+echo "\n*** Testing objects with in_array() ***\n";
+class in_array_check {
+ public $array_var = array(1=>"one", "two"=>2, 3=>3);
+ public function foo() {
+ echo "Public function\n";
+ }
+}
+
+$in_array_obj = new in_array_check(); //creating new object
+//error: as wrong datatype for second argument
+var_dump( in_array("array_var", $in_array_obj) );
+//error: as wrong datatype for second argument
+var_dump( in_array("foo", $in_array_obj) );
+//element found as "one" exists in array $array_var
+var_dump( in_array("one", $in_array_obj->array_var) );
+
+/* checking for Resources */
+echo "\n*** Testing resource type with in_array() ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array for comparision.
+$resources = array($file_handle, $dir_handle);
+
+// search for resouce type in the resource array
+var_dump( in_array($file_handle, $resources, true) );
+//checking for (int) type resource
+var_dump( in_array((int)$dir_handle, $resources, true) );
+
+/* Miscellenous input check */
+echo "\n*** Testing miscelleneos inputs with in_array() ***\n";
+//matching "Good" in array(0,"hello"), result:true in loose type check
+var_dump( in_array("Good", array(0,"hello")) );
+//false in strict mode
+var_dump( in_array("Good", array(0,"hello"), TRUE) );
+
+//matching integer 0 in array("this"), result:true in loose type check
+var_dump( in_array(0, array("this")) );
+// false in strict mode
+var_dump( in_array(0, array("this")),TRUE );
+
+//matching string "this" in array(0), result:true in loose type check
+var_dump( in_array("this", array(0)) );
+// false in stric mode
+var_dump( in_array("this", array(0), TRUE) );
+
+//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
+var_dump( in_array(FALSE,
+ array("a"=> TRUE, "b"=> TRUE,
+ array("c"=> TRUE, "d"=>TRUE)
+ )
+ )
+ );
+
+//matching string having integer in beginning, result:true in loose type check
+var_dump( in_array('123abc', array(123)) );
+var_dump( in_array('123abc', array(123), TRUE) ); // false in strict mode
+
+echo "\n*** Testing error conditions of in_array() ***\n";
+/* zero argument */
+var_dump( in_array() );
+
+/* unexpected no.of arguments in in_array() */
+$var = array("mon", "tues", "wed", "thurs");
+var_dump( in_array(1, $var, 0, "test") );
+var_dump( in_array("test") );
+
+/* unexpected second argument in in_array() */
+$var="test";
+var_dump( in_array("test", $var) );
+var_dump( in_array(1, 123) );
+
+/* closing resource handles */
+fclose($file_handle);
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
OK
+*** Testing STRICT option of in_array() on arrays ***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 9 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 10 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 12 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 13 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 24 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 25 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 26 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 27 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 28 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 29 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 31 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 32 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 33 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 34 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 35 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 36 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 37 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 38 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 39 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 40 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 41 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 42 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 43 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 44 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 45 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 46 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 47 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 48 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 49 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 50 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 51 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 52 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 53 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 54 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 55 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 56 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 57 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 58 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 59 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 60 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 61 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 62 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 63 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 64 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 65 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 66 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 67 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 68 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 69 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 70 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 71 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 72 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 73 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 74 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 75 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 76 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 77 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 78 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 79 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 80 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 81 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 82 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 83 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 84 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 85 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 86 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 87 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 88 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 89 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 90 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 91 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 92 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 93 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 94 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 95 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 96 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 97 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 98 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 99 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 100 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 101 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 102 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 103 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 104 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 105 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 106 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 107 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 108 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 109 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 110 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 111 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 112 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 113 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 114 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 115 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 116 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 117 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 118 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 119 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 120 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 121 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 122 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 123 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 124 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 125 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 126 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 127 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 128 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 129 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 130 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 131 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 132 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 133 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 134 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 135 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 136 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 137 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 138 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 139 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 140 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 141 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 142 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 143 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 144 --
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing loose and strict TYPE comparison of in_array() ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 7 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing sub-arrays with in_array() ***
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing objects with in_array() ***
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+bool(true)
+
+*** Testing resource type with in_array() ***
+bool(true)
+bool(false)
+
+*** Testing miscelleneos inputs with in_array() ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+
+*** Testing error conditions of in_array() ***
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt
index 42e252ac8..0aeb5a85a 100644
--- a/ext/standard/tests/array/array_values.phpt
+++ b/ext/standard/tests/array/array_values.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_values_64bit.phpt b/ext/standard/tests/array/array_values_64bit.phpt
new file mode 100644
index 000000000..a04880001
--- /dev/null
+++ b/ext/standard/tests/array/array_values_64bit.phpt
Binary files differ
diff --git a/ext/standard/tests/array/bug28974.phpt b/ext/standard/tests/array/bug28974.phpt
index fb272e1d7..a2bd86f6d 100644
--- a/ext/standard/tests/array/bug28974.phpt
+++ b/ext/standard/tests/array/bug28974.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #28974 array_(p)slice() treats large lengths incorrectly - overflow
+Bug #28974 (array_(p)slice() treats large lengths incorrectly - overflow)
--FILE--
<?php
$a = $b = $c = array(0,1,2,3,4,5);
diff --git a/ext/standard/tests/array/bug29253.phpt b/ext/standard/tests/array/bug29253.phpt
index b2202a104..749b0aa9f 100755
--- a/ext/standard/tests/array/bug29253.phpt
+++ b/ext/standard/tests/array/bug29253.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #29253 array_diff with $GLOBALS argument fails
+Bug #29253 (array_diff with $GLOBALS argument fails)
--FILE--
<?php
$zz = $GLOBALS;
diff --git a/ext/standard/tests/array/bug33940.phpt b/ext/standard/tests/array/bug33940.phpt
index f1aba87bd..3dd45f39b 100755
--- a/ext/standard/tests/array/bug33940.phpt
+++ b/ext/standard/tests/array/bug33940.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #33940 array_map() fails to pass by reference when called recursively
+Bug #33940 (array_map() fails to pass by reference when called recursively)
--INI--
error_reporting=4095
allow_call_time_pass_reference=1
diff --git a/ext/standard/tests/array/bug34982.phpt b/ext/standard/tests/array/bug34982.phpt
index bcfed5938..90240965f 100755
--- a/ext/standard/tests/array/bug34982.phpt
+++ b/ext/standard/tests/array/bug34982.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #34982 array_walk_recursive() modifies elements outside function scope
+Bug #34982 (array_walk_recursive() modifies elements outside function scope)
--FILE--
<?php
$ar = array(
diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt
new file mode 100644
index 000000000..1953a0439
--- /dev/null
+++ b/ext/standard/tests/array/each.phpt
Binary files differ
diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt
new file mode 100644
index 000000000..da9422395
--- /dev/null
+++ b/ext/standard/tests/array/end.phpt
@@ -0,0 +1,238 @@
+--TEST--
+Test end() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: mixed end ( array &$array );
+ Description: Advances internal pointer of array to last element, and returns its value.
+*/
+
+$arrays = array (
+ array( 0 ),
+ range(1, 100 ),
+ range('a', 'z', 2 ),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ),
+ array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ),
+ array(1.0005, 2.000000, -3.000000, -4.9999999 ),
+ array(true, false),
+ array("PHP", "Web2.0", "SOA"),
+ array(1, array() ),
+ array(1, 2, "" ),
+ array(" "),
+ array(2147483647, 2147483648, -2147483647, -2147483648 ),
+ array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ),
+ array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 )
+);
+/* loop through $arrays to print the last element of each sub-array */
+echo "*** Testing end() on different arrays ***\n";
+$counter = 1;
+foreach ($arrays as $sub_array){
+ echo "-- Iteration $counter --\n";
+ var_dump( end($sub_array) );
+ /* ensure that internal pointer is moved to last element */
+ var_dump( current($sub_array) );
+ $counter++;
+}
+
+/* checking for end() on sub-arrays */
+echo "\n*** Testing end() with sub-arrays ***\n";
+$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") );
+var_dump( end($test_array) );
+var_dump( end($test_array[1]) );
+
+/* checking working of end() when array elements are deleted */
+echo "\n*** Testing end() when array elements are deleted ***\n";
+$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008");
+
+// remove first element from array
+echo "\n-- Remove first element from array --\n";
+unset($array_test[0]);
+var_dump( end($array_test) );
+
+// remove last element from array, rewind and check end()
+echo "\n-- Remove last element from array --\n";
+unset($array_test['-.008']);
+var_dump( end($array_test) );
+reset( $array_test );
+var_dump( end($array_test) );
+
+// remove any element !first, !last, rewind and check end()
+echo "\n-- Remove any element from array apart from first and last element --\n";
+unset($array_test[7]);
+var_dump( end($array_test) );
+var_dump( reset($array_test) );
+var_dump( end($array_test) );
+
+/* Checking on OBJECTS type */
+echo "\n*** Testing end() on objects ***\n";
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+class foo1
+{
+ function __toString() {
+ return "Object1";
+ }
+}
+
+$object1 = new foo(); //new object created
+$object2 = new foo1();
+
+$array_object = array();
+$array_object[0] = &$object1;
+$array_object[1] = &$object2;
+var_dump( end($array_object) );
+var_dump($array_object);
+
+/* Checking on RESOURCE type */
+echo "\n*** Testing end() on resource type ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array
+$resources = array($file_handle, $dir_handle);
+var_dump( end($resources) );
+var_dump( current($resources) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for unexpected number of arguments */
+var_dump( end() );
+var_dump( end($array[0], $array[0]) );
+
+/* checking for unexpected type of arguments */
+$var=1;
+$var1="string";
+var_dump( end($var) );
+var_dump( end($var1) );
+
+/* checking null array */
+$null_array = array();
+var_dump( end($null_array) );
+
+echo "Done\n";
+
+?>
+
+--CLEAN--
+/* cleaning resource handles */
+fclose( $file_handle ); //file resource handle deleted
+closedir( $dir_handle ); //dir resource handle deleted
+
+--EXPECTF--
+*** Testing end() on different arrays ***
+-- Iteration 1 --
+int(0)
+int(0)
+-- Iteration 2 --
+int(100)
+int(100)
+-- Iteration 3 --
+string(1) "y"
+string(1) "y"
+-- Iteration 4 --
+NULL
+NULL
+-- Iteration 5 --
+int(5)
+int(5)
+-- Iteration 6 --
+float(-0.9)
+float(-0.9)
+-- Iteration 7 --
+float(-4.9999999)
+float(-4.9999999)
+-- Iteration 8 --
+bool(false)
+bool(false)
+-- Iteration 9 --
+string(3) "SOA"
+string(3) "SOA"
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 11 --
+string(0) ""
+string(0) ""
+-- Iteration 12 --
+string(1) " "
+string(1) " "
+-- Iteration 13 --
+float(-2147483648)
+float(-2147483648)
+-- Iteration 14 --
+float(-2147483648)
+float(-2147483648)
+-- Iteration 15 --
+float(2)
+float(2)
+
+*** Testing end() with sub-arrays ***
+array(3) {
+ [1]=>
+ string(3) "one"
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(1) "f"
+}
+string(1) "f"
+
+*** Testing end() when array elements are deleted ***
+
+-- Remove first element from array --
+string(7) "neg.008"
+
+-- Remove last element from array --
+int(-4)
+int(-4)
+
+-- Remove any element from array apart from first and last element --
+int(-4)
+string(1) "b"
+int(-4)
+
+*** Testing end() on objects ***
+object(foo1)#%d (0) {
+}
+array(2) {
+ [0]=>
+ &object(foo)#%d (0) {
+ }
+ [1]=>
+ &object(foo1)#%d (0) {
+ }
+}
+
+*** Testing end() on resource type ***
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt
new file mode 100644
index 000000000..94fff0c1c
--- /dev/null
+++ b/ext/standard/tests/array/end_64bit.phpt
@@ -0,0 +1,238 @@
+--TEST--
+Test end() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: mixed end ( array &$array );
+ Description: Advances internal pointer of array to last element, and returns its value.
+*/
+
+$arrays = array (
+ array( 0 ),
+ range(1, 100 ),
+ range('a', 'z', 2 ),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ),
+ array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ),
+ array(1.0005, 2.000000, -3.000000, -4.9999999 ),
+ array(true, false),
+ array("PHP", "Web2.0", "SOA"),
+ array(1, array() ),
+ array(1, 2, "" ),
+ array(" "),
+ array(2147483647, 2147483648, -2147483647, -2147483648 ),
+ array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ),
+ array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 )
+);
+/* loop through $arrays to print the last element of each sub-array */
+echo "*** Testing end() on different arrays ***\n";
+$counter = 1;
+foreach ($arrays as $sub_array){
+ echo "-- Iteration $counter --\n";
+ var_dump( end($sub_array) );
+ /* ensure that internal pointer is moved to last element */
+ var_dump( current($sub_array) );
+ $counter++;
+}
+
+/* checking for end() on sub-arrays */
+echo "\n*** Testing end() with sub-arrays ***\n";
+$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") );
+var_dump( end($test_array) );
+var_dump( end($test_array[1]) );
+
+/* checking working of end() when array elements are deleted */
+echo "\n*** Testing end() when array elements are deleted ***\n";
+$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008");
+
+// remove first element from array
+echo "\n-- Remove first element from array --\n";
+unset($array_test[0]);
+var_dump( end($array_test) );
+
+// remove last element from array, rewind and check end()
+echo "\n-- Remove last element from array --\n";
+unset($array_test['-.008']);
+var_dump( end($array_test) );
+reset( $array_test );
+var_dump( end($array_test) );
+
+// remove any element !first, !last, rewind and check end()
+echo "\n-- Remove any element from array apart from first and last element --\n";
+unset($array_test[7]);
+var_dump( end($array_test) );
+var_dump( reset($array_test) );
+var_dump( end($array_test) );
+
+/* Checking on OBJECTS type */
+echo "\n*** Testing end() on objects ***\n";
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+class foo1
+{
+ function __toString() {
+ return "Object1";
+ }
+}
+
+$object1 = new foo(); //new object created
+$object2 = new foo1();
+
+$array_object = array();
+$array_object[0] = &$object1;
+$array_object[1] = &$object2;
+var_dump( end($array_object) );
+var_dump($array_object);
+
+/* Checking on RESOURCE type */
+echo "\n*** Testing end() on resource type ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array
+$resources = array($file_handle, $dir_handle);
+var_dump( end($resources) );
+var_dump( current($resources) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for unexpected number of arguments */
+var_dump( end() );
+var_dump( end($array[0], $array[0]) );
+
+/* checking for unexpected type of arguments */
+$var=1;
+$var1="string";
+var_dump( end($var) );
+var_dump( end($var1) );
+
+/* checking null array */
+$null_array = array();
+var_dump( end($null_array) );
+
+echo "Done\n";
+
+?>
+
+--CLEAN--
+/* cleaning resource handles */
+fclose( $file_handle ); //file resource handle deleted
+closedir( $dir_handle ); //dir resource handle deleted
+
+--EXPECTF--
+*** Testing end() on different arrays ***
+-- Iteration 1 --
+int(0)
+int(0)
+-- Iteration 2 --
+int(100)
+int(100)
+-- Iteration 3 --
+string(1) "y"
+string(1) "y"
+-- Iteration 4 --
+NULL
+NULL
+-- Iteration 5 --
+int(5)
+int(5)
+-- Iteration 6 --
+float(-0.9)
+float(-0.9)
+-- Iteration 7 --
+float(-4.9999999)
+float(-4.9999999)
+-- Iteration 8 --
+bool(false)
+bool(false)
+-- Iteration 9 --
+string(3) "SOA"
+string(3) "SOA"
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 11 --
+string(0) ""
+string(0) ""
+-- Iteration 12 --
+string(1) " "
+string(1) " "
+-- Iteration 13 --
+int(-2147483648)
+int(-2147483648)
+-- Iteration 14 --
+int(-2147483648)
+int(-2147483648)
+-- Iteration 15 --
+float(2)
+float(2)
+
+*** Testing end() with sub-arrays ***
+array(3) {
+ [1]=>
+ string(3) "one"
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(1) "f"
+}
+string(1) "f"
+
+*** Testing end() when array elements are deleted ***
+
+-- Remove first element from array --
+string(7) "neg.008"
+
+-- Remove last element from array --
+int(-4)
+int(-4)
+
+-- Remove any element from array apart from first and last element --
+int(-4)
+string(1) "b"
+int(-4)
+
+*** Testing end() on objects ***
+object(foo1)#2 (0) {
+}
+array(2) {
+ [0]=>
+ &object(foo)#1 (0) {
+ }
+ [1]=>
+ &object(foo1)#2 (0) {
+ }
+}
+
+*** Testing end() on resource type ***
+resource(6) of type (stream)
+resource(6) of type (stream)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/array/extract.phpt b/ext/standard/tests/array/extract.phpt
new file mode 100644
index 000000000..d9b37c859
--- /dev/null
+++ b/ext/standard/tests/array/extract.phpt
@@ -0,0 +1,276 @@
+--TEST--
+Test extract() function
+--FILE--
+<?php
+/* Prototype: int extract( array var_array[, int extract_type[, string prefix]] )
+ * Description: Import variables into the current symbol table from an array
+ */
+
+/* various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+$val = 4;
+$str = "John";
+
+/* Extracting Global Variables */
+extract($GLOBALS, EXTR_REFS);
+
+/* Testing Error Conditions */
+echo "*** Testing Error Conditions ***\n";
+
+/* Zero Arguments */
+var_dump( extract() );
+
+/* Invalid second argument ( only 0-6 is valid) */
+var_dump( extract($mixed_array[7], -1 . "wddr") );
+var_dump( extract($mixed_array[7], 7 , "wddr") );
+
+/* scalar argument */
+var_dump( extract($val) );
+
+/* string argument */
+var_dump( extract($str) );
+
+/* More than valid number of arguments i.e. 3 args */
+var_dump( extract($mixed_array[7], EXTR_SKIP, "aa", "ee") );
+
+/* Two Arguments, second as prefix but without prefix string as third argument */
+var_dump( extract($mixed_array[7],EXTR_PREFIX_IF_EXISTS) );
+
+$counter = 0;
+
+foreach ( $mixed_array as $sub_array ) {
+ echo "\n-- Iteration $counter --\n";
+ $counter++;
+
+ var_dump ( extract($sub_array)); /* Single Argument */
+
+ /* variations of two arguments */
+ var_dump ( extract($sub_array, EXTR_OVERWRITE));
+ var_dump ( extract($sub_array, EXTR_SKIP));
+ var_dump ( extract($sub_array, EXTR_IF_EXISTS));
+
+ /* variations of three arguments with use of various extract types*/
+ var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix
+ var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb"));
+}
+
+
+/* EXTR_REFS as second Argument */
+$a = array ('foo' => 'aaa');
+var_dump ( extract($a, EXTR_REFS));
+$b = $a;
+$b['foo'] = 'bbb';
+var_dump ( extract($a, EXTR_REFS));
+
+/* EXTR_PREFIX_ALL called twice with same prefix string */
+echo "\n*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***\n";
+var_dump ( extract($mixed_array[5], EXTR_PREFIX_ALL, "same"));
+var_dump ( extract($mixed_array[7], EXTR_PREFIX_ALL, "same"));
+var_dump ( extract($mixed_array[7], EXTR_PREFIX_ALL, "diff"));
+
+/* To show variables with numerical prefixes cannot be extracted */
+$var["i"] = 1;
+$var["j"] = 2;
+$var["k"] = 3;
+echo "\n*** Testing for Numerical prefixes ***\n";
+var_dump(extract($var));
+
+
+$var1["m"] = 1;
+$var1[2] = 2;
+$var1[] = 3;
+var_dump ( extract($var1));
+
+
+/* Using Class and objects */
+
+echo "\n*** Testing for object ***\n";
+class classA
+{
+ public $v;
+}
+
+$A = new classA();
+var_dump ( extract(get_object_vars($A),EXTR_REFS));
+
+echo "\nDone";
+?>
+
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for extract() in %s on line %d
+NULL
+
+Warning: extract(): Unknown extract type in %s on line %d
+NULL
+
+Warning: extract(): Unknown extract type in %s on line %d
+NULL
+
+Warning: extract(): First argument should be an array in %s on line %d
+NULL
+
+Warning: extract(): First argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for extract() in %s on line %d
+NULL
+
+Warning: extract(): Prefix expected to be specified in %s on line %d
+NULL
+
+-- Iteration 0 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(9)
+int(0)
+int(9)
+int(9)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(8)
+int(0)
+int(8)
+int(8)
+int(0)
+
+-- Iteration 4 --
+int(5)
+int(5)
+int(0)
+int(5)
+int(5)
+int(5)
+int(5)
+int(5)
+int(5)
+
+-- Iteration 5 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 6 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 7 --
+int(4)
+int(4)
+int(0)
+int(4)
+int(12)
+int(4)
+int(11)
+int(11)
+int(4)
+
+-- Iteration 8 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 9 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(3)
+int(0)
+int(3)
+int(3)
+int(0)
+
+-- Iteration 10 --
+int(2)
+int(2)
+int(0)
+int(2)
+int(8)
+int(2)
+int(8)
+int(8)
+int(2)
+int(1)
+int(1)
+
+*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***
+int(5)
+int(11)
+int(11)
+
+*** Testing for Numerical prefixes ***
+int(3)
+int(1)
+
+*** Testing for object ***
+int(1)
+
+Done
diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt
index 7edcab755..1495a78dc 100644
--- a/ext/standard/tests/array/max.phpt
+++ b/ext/standard/tests/array/max.phpt
@@ -1,5 +1,7 @@
--TEST--
max() tests
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt
index 70e3555f1..dfb3c9bde 100644
--- a/ext/standard/tests/array/min.phpt
+++ b/ext/standard/tests/array/min.phpt
@@ -1,5 +1,7 @@
--TEST--
min() tests
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/standard/tests/array/range.phpt b/ext/standard/tests/array/range.phpt
index 23fb985f8..3ecdeff6b 100644
--- a/ext/standard/tests/array/range.phpt
+++ b/ext/standard/tests/array/range.phpt
@@ -1,33 +1,121 @@
--TEST--
-range()
+Test range() function
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
--FILE--
<?php
- var_dump(range(1, 100));
- var_dump(range(100, 1));
-
- var_dump(range("1", "100"));
- var_dump(range("100", "1"));
-
- var_dump(range("a", "z"));
- var_dump(range("z", "a"));
- var_dump(range("q", "q"));
-
- var_dump(range(5, 5));
-
- var_dump(range(5.1, 10.1));
- var_dump(range(10.1, 5.1));
-
- var_dump(range("5.1", "10.1"));
- var_dump(range("10.1", "5.1"));
-
- var_dump(range(1, 5, 0.1));
- var_dump(range(5, 1, 0.1));
-
- var_dump(range(1, 5, "0.1"));
- var_dump(range("1", "5", 0.1));
+/* Prototype: array range ( mixed $low, mixed $high [, number $step] );
+ Description: Create an array containing a range of elements
+*/
+
+echo "*** Testing range() function on basic operations ***\n";
+
+echo "\n-- Integers as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range(1, 10) );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range(10, 1) );
+
+echo "\n-- Numeric Strings as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("1", "10") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("10", "1") );
+
+echo "\n-- Chars as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("a", "z") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("z", "a") );
+
+echo "\n-- Low and High are equal --\n";
+var_dump( range(5, 5) );
+var_dump( range("q", "q") );
+
+echo "\n-- floats as Low and High --\n";
+var_dump( range(5.1, 10.1) );
+var_dump( range(10.1, 5.1) );
+
+var_dump( range("5.1", "10.1") );
+var_dump( range("10.1", "5.1") );
+
+echo "\n-- Passing step with Low and High --\n";
+var_dump( range(1, 2, 0.1) );
+var_dump( range(2, 1, 0.1) );
+
+var_dump( range(1, 2, "0.1") );
+var_dump( range("1", "2", 0.1) );
+
+echo "\n-- Testing basic string with step --\n";
+var_dump( range("abcd", "mnop", 2) );
+
+echo "\n*** Testing range() with various low and high values ***";
+$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+
+for( $i = 0; $i < count($low_arr); $i++) {
+ for( $j = 0; $j < count($high_arr); $j++) {
+ echo "\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
+ var_dump( range( $low_arr[$i], $high_arr[$j] ) );
+ }
+}
+
+
+echo "\n*** Possible variatins with steps ***\n";
+var_dump( range( 1, 5, TRUE ) );
+var_dump( range( 1, 5, array(1, 2) ) );
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing ( (low < high) && (step = 0) ) --";
+var_dump( range(1, 2, 0) );
+var_dump( range("a", "b", 0) );
+
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
+var_dump( range(2, 1, 0) );
+var_dump( range("b", "a", 0) );
+
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
+var_dump( range(1.0, 7.0, 6.5) );
+
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
+var_dump( range(7.0, 1.0, 6.5) );
+
+echo "\n-- Testing Invalid number of arguments --";
+var_dump( range() ); // No.of args = 0
+var_dump( range(1) ); // No.of args < expected
+var_dump( range(1,2,3,4) ); // No.of args > expected
+var_dump( range(-1, -2, 2) );
+var_dump( range("a", "j", "z") );
+
+echo "\n-- Testing Invalid steps --";
+$step_arr = array( "string", NULL, FALSE, "", "\0" );
+
+foreach( $step_arr as $step ) {
+ var_dump( range( 1, 5, $step ) );
+}
+
+echo "\nDone";
?>
---EXPECT--
-array(100) {
+--EXPECTF--
+*** Testing range() function on basic operations ***
+
+-- Integers as Low and High --
+-- An array of elements from low to high --
+array(10) {
[0]=>
int(1)
[1]=>
@@ -48,390 +136,35 @@ array(100) {
int(9)
[9]=>
int(10)
- [10]=>
- int(11)
- [11]=>
- int(12)
- [12]=>
- int(13)
- [13]=>
- int(14)
- [14]=>
- int(15)
- [15]=>
- int(16)
- [16]=>
- int(17)
- [17]=>
- int(18)
- [18]=>
- int(19)
- [19]=>
- int(20)
- [20]=>
- int(21)
- [21]=>
- int(22)
- [22]=>
- int(23)
- [23]=>
- int(24)
- [24]=>
- int(25)
- [25]=>
- int(26)
- [26]=>
- int(27)
- [27]=>
- int(28)
- [28]=>
- int(29)
- [29]=>
- int(30)
- [30]=>
- int(31)
- [31]=>
- int(32)
- [32]=>
- int(33)
- [33]=>
- int(34)
- [34]=>
- int(35)
- [35]=>
- int(36)
- [36]=>
- int(37)
- [37]=>
- int(38)
- [38]=>
- int(39)
- [39]=>
- int(40)
- [40]=>
- int(41)
- [41]=>
- int(42)
- [42]=>
- int(43)
- [43]=>
- int(44)
- [44]=>
- int(45)
- [45]=>
- int(46)
- [46]=>
- int(47)
- [47]=>
- int(48)
- [48]=>
- int(49)
- [49]=>
- int(50)
- [50]=>
- int(51)
- [51]=>
- int(52)
- [52]=>
- int(53)
- [53]=>
- int(54)
- [54]=>
- int(55)
- [55]=>
- int(56)
- [56]=>
- int(57)
- [57]=>
- int(58)
- [58]=>
- int(59)
- [59]=>
- int(60)
- [60]=>
- int(61)
- [61]=>
- int(62)
- [62]=>
- int(63)
- [63]=>
- int(64)
- [64]=>
- int(65)
- [65]=>
- int(66)
- [66]=>
- int(67)
- [67]=>
- int(68)
- [68]=>
- int(69)
- [69]=>
- int(70)
- [70]=>
- int(71)
- [71]=>
- int(72)
- [72]=>
- int(73)
- [73]=>
- int(74)
- [74]=>
- int(75)
- [75]=>
- int(76)
- [76]=>
- int(77)
- [77]=>
- int(78)
- [78]=>
- int(79)
- [79]=>
- int(80)
- [80]=>
- int(81)
- [81]=>
- int(82)
- [82]=>
- int(83)
- [83]=>
- int(84)
- [84]=>
- int(85)
- [85]=>
- int(86)
- [86]=>
- int(87)
- [87]=>
- int(88)
- [88]=>
- int(89)
- [89]=>
- int(90)
- [90]=>
- int(91)
- [91]=>
- int(92)
- [92]=>
- int(93)
- [93]=>
- int(94)
- [94]=>
- int(95)
- [95]=>
- int(96)
- [96]=>
- int(97)
- [97]=>
- int(98)
- [98]=>
- int(99)
- [99]=>
- int(100)
-}
-array(100) {
- [0]=>
- int(100)
- [1]=>
- int(99)
- [2]=>
- int(98)
- [3]=>
- int(97)
- [4]=>
- int(96)
- [5]=>
- int(95)
- [6]=>
- int(94)
- [7]=>
- int(93)
- [8]=>
- int(92)
- [9]=>
- int(91)
- [10]=>
- int(90)
- [11]=>
- int(89)
- [12]=>
- int(88)
- [13]=>
- int(87)
- [14]=>
- int(86)
- [15]=>
- int(85)
- [16]=>
- int(84)
- [17]=>
- int(83)
- [18]=>
- int(82)
- [19]=>
- int(81)
- [20]=>
- int(80)
- [21]=>
- int(79)
- [22]=>
- int(78)
- [23]=>
- int(77)
- [24]=>
- int(76)
- [25]=>
- int(75)
- [26]=>
- int(74)
- [27]=>
- int(73)
- [28]=>
- int(72)
- [29]=>
- int(71)
- [30]=>
- int(70)
- [31]=>
- int(69)
- [32]=>
- int(68)
- [33]=>
- int(67)
- [34]=>
- int(66)
- [35]=>
- int(65)
- [36]=>
- int(64)
- [37]=>
- int(63)
- [38]=>
- int(62)
- [39]=>
- int(61)
- [40]=>
- int(60)
- [41]=>
- int(59)
- [42]=>
- int(58)
- [43]=>
- int(57)
- [44]=>
- int(56)
- [45]=>
- int(55)
- [46]=>
- int(54)
- [47]=>
- int(53)
- [48]=>
- int(52)
- [49]=>
- int(51)
- [50]=>
- int(50)
- [51]=>
- int(49)
- [52]=>
- int(48)
- [53]=>
- int(47)
- [54]=>
- int(46)
- [55]=>
- int(45)
- [56]=>
- int(44)
- [57]=>
- int(43)
- [58]=>
- int(42)
- [59]=>
- int(41)
- [60]=>
- int(40)
- [61]=>
- int(39)
- [62]=>
- int(38)
- [63]=>
- int(37)
- [64]=>
- int(36)
- [65]=>
- int(35)
- [66]=>
- int(34)
- [67]=>
- int(33)
- [68]=>
- int(32)
- [69]=>
- int(31)
- [70]=>
- int(30)
- [71]=>
- int(29)
- [72]=>
- int(28)
- [73]=>
- int(27)
- [74]=>
- int(26)
- [75]=>
- int(25)
- [76]=>
- int(24)
- [77]=>
- int(23)
- [78]=>
- int(22)
- [79]=>
- int(21)
- [80]=>
- int(20)
- [81]=>
- int(19)
- [82]=>
- int(18)
- [83]=>
- int(17)
- [84]=>
- int(16)
- [85]=>
- int(15)
- [86]=>
- int(14)
- [87]=>
- int(13)
- [88]=>
- int(12)
- [89]=>
- int(11)
- [90]=>
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
int(10)
- [91]=>
+ [1]=>
int(9)
- [92]=>
+ [2]=>
int(8)
- [93]=>
+ [3]=>
int(7)
- [94]=>
+ [4]=>
int(6)
- [95]=>
+ [5]=>
int(5)
- [96]=>
+ [6]=>
int(4)
- [97]=>
+ [7]=>
int(3)
- [98]=>
+ [8]=>
int(2)
- [99]=>
+ [9]=>
int(1)
}
-array(100) {
+
+-- Numeric Strings as Low and High --
+-- An array of elements from low to high --
+array(10) {
[0]=>
int(1)
[1]=>
@@ -452,389 +185,34 @@ array(100) {
int(9)
[9]=>
int(10)
- [10]=>
- int(11)
- [11]=>
- int(12)
- [12]=>
- int(13)
- [13]=>
- int(14)
- [14]=>
- int(15)
- [15]=>
- int(16)
- [16]=>
- int(17)
- [17]=>
- int(18)
- [18]=>
- int(19)
- [19]=>
- int(20)
- [20]=>
- int(21)
- [21]=>
- int(22)
- [22]=>
- int(23)
- [23]=>
- int(24)
- [24]=>
- int(25)
- [25]=>
- int(26)
- [26]=>
- int(27)
- [27]=>
- int(28)
- [28]=>
- int(29)
- [29]=>
- int(30)
- [30]=>
- int(31)
- [31]=>
- int(32)
- [32]=>
- int(33)
- [33]=>
- int(34)
- [34]=>
- int(35)
- [35]=>
- int(36)
- [36]=>
- int(37)
- [37]=>
- int(38)
- [38]=>
- int(39)
- [39]=>
- int(40)
- [40]=>
- int(41)
- [41]=>
- int(42)
- [42]=>
- int(43)
- [43]=>
- int(44)
- [44]=>
- int(45)
- [45]=>
- int(46)
- [46]=>
- int(47)
- [47]=>
- int(48)
- [48]=>
- int(49)
- [49]=>
- int(50)
- [50]=>
- int(51)
- [51]=>
- int(52)
- [52]=>
- int(53)
- [53]=>
- int(54)
- [54]=>
- int(55)
- [55]=>
- int(56)
- [56]=>
- int(57)
- [57]=>
- int(58)
- [58]=>
- int(59)
- [59]=>
- int(60)
- [60]=>
- int(61)
- [61]=>
- int(62)
- [62]=>
- int(63)
- [63]=>
- int(64)
- [64]=>
- int(65)
- [65]=>
- int(66)
- [66]=>
- int(67)
- [67]=>
- int(68)
- [68]=>
- int(69)
- [69]=>
- int(70)
- [70]=>
- int(71)
- [71]=>
- int(72)
- [72]=>
- int(73)
- [73]=>
- int(74)
- [74]=>
- int(75)
- [75]=>
- int(76)
- [76]=>
- int(77)
- [77]=>
- int(78)
- [78]=>
- int(79)
- [79]=>
- int(80)
- [80]=>
- int(81)
- [81]=>
- int(82)
- [82]=>
- int(83)
- [83]=>
- int(84)
- [84]=>
- int(85)
- [85]=>
- int(86)
- [86]=>
- int(87)
- [87]=>
- int(88)
- [88]=>
- int(89)
- [89]=>
- int(90)
- [90]=>
- int(91)
- [91]=>
- int(92)
- [92]=>
- int(93)
- [93]=>
- int(94)
- [94]=>
- int(95)
- [95]=>
- int(96)
- [96]=>
- int(97)
- [97]=>
- int(98)
- [98]=>
- int(99)
- [99]=>
- int(100)
-}
-array(100) {
- [0]=>
- int(100)
- [1]=>
- int(99)
- [2]=>
- int(98)
- [3]=>
- int(97)
- [4]=>
- int(96)
- [5]=>
- int(95)
- [6]=>
- int(94)
- [7]=>
- int(93)
- [8]=>
- int(92)
- [9]=>
- int(91)
- [10]=>
- int(90)
- [11]=>
- int(89)
- [12]=>
- int(88)
- [13]=>
- int(87)
- [14]=>
- int(86)
- [15]=>
- int(85)
- [16]=>
- int(84)
- [17]=>
- int(83)
- [18]=>
- int(82)
- [19]=>
- int(81)
- [20]=>
- int(80)
- [21]=>
- int(79)
- [22]=>
- int(78)
- [23]=>
- int(77)
- [24]=>
- int(76)
- [25]=>
- int(75)
- [26]=>
- int(74)
- [27]=>
- int(73)
- [28]=>
- int(72)
- [29]=>
- int(71)
- [30]=>
- int(70)
- [31]=>
- int(69)
- [32]=>
- int(68)
- [33]=>
- int(67)
- [34]=>
- int(66)
- [35]=>
- int(65)
- [36]=>
- int(64)
- [37]=>
- int(63)
- [38]=>
- int(62)
- [39]=>
- int(61)
- [40]=>
- int(60)
- [41]=>
- int(59)
- [42]=>
- int(58)
- [43]=>
- int(57)
- [44]=>
- int(56)
- [45]=>
- int(55)
- [46]=>
- int(54)
- [47]=>
- int(53)
- [48]=>
- int(52)
- [49]=>
- int(51)
- [50]=>
- int(50)
- [51]=>
- int(49)
- [52]=>
- int(48)
- [53]=>
- int(47)
- [54]=>
- int(46)
- [55]=>
- int(45)
- [56]=>
- int(44)
- [57]=>
- int(43)
- [58]=>
- int(42)
- [59]=>
- int(41)
- [60]=>
- int(40)
- [61]=>
- int(39)
- [62]=>
- int(38)
- [63]=>
- int(37)
- [64]=>
- int(36)
- [65]=>
- int(35)
- [66]=>
- int(34)
- [67]=>
- int(33)
- [68]=>
- int(32)
- [69]=>
- int(31)
- [70]=>
- int(30)
- [71]=>
- int(29)
- [72]=>
- int(28)
- [73]=>
- int(27)
- [74]=>
- int(26)
- [75]=>
- int(25)
- [76]=>
- int(24)
- [77]=>
- int(23)
- [78]=>
- int(22)
- [79]=>
- int(21)
- [80]=>
- int(20)
- [81]=>
- int(19)
- [82]=>
- int(18)
- [83]=>
- int(17)
- [84]=>
- int(16)
- [85]=>
- int(15)
- [86]=>
- int(14)
- [87]=>
- int(13)
- [88]=>
- int(12)
- [89]=>
- int(11)
- [90]=>
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
int(10)
- [91]=>
+ [1]=>
int(9)
- [92]=>
+ [2]=>
int(8)
- [93]=>
+ [3]=>
int(7)
- [94]=>
+ [4]=>
int(6)
- [95]=>
+ [5]=>
int(5)
- [96]=>
+ [6]=>
int(4)
- [97]=>
+ [7]=>
int(3)
- [98]=>
+ [8]=>
int(2)
- [99]=>
+ [9]=>
int(1)
}
+
+-- Chars as Low and High --
+-- An array of elements from low to high --
array(26) {
[0]=>
string(1) "a"
@@ -889,6 +267,8 @@ array(26) {
[25]=>
string(1) "z"
}
+
+-- An array of elements from high to low --
array(26) {
[0]=>
string(1) "z"
@@ -943,14 +323,18 @@ array(26) {
[25]=>
string(1) "a"
}
+
+-- Low and High are equal --
array(1) {
[0]=>
- string(1) "q"
+ int(5)
}
array(1) {
[0]=>
- int(5)
+ string(1) "q"
}
+
+-- floats as Low and High --
array(6) {
[0]=>
float(5.1)
@@ -1007,7 +391,9 @@ array(6) {
[5]=>
float(5.1)
}
-array(41) {
+
+-- Passing step with Low and High --
+array(11) {
[0]=>
float(1)
[1]=>
@@ -1030,152 +416,32 @@ array(41) {
float(1.9)
[10]=>
float(2)
- [11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
-}
-array(41) {
- [0]=>
- float(5)
- [1]=>
- float(4.9)
- [2]=>
- float(4.8)
- [3]=>
- float(4.7)
- [4]=>
- float(4.6)
- [5]=>
- float(4.5)
- [6]=>
- float(4.4)
- [7]=>
- float(4.3)
- [8]=>
- float(4.2)
- [9]=>
- float(4.1)
- [10]=>
- float(4)
- [11]=>
- float(3.9)
- [12]=>
- float(3.8)
- [13]=>
- float(3.7)
- [14]=>
- float(3.6)
- [15]=>
- float(3.5)
- [16]=>
- float(3.4)
- [17]=>
- float(3.3)
- [18]=>
- float(3.2)
- [19]=>
- float(3.1)
- [20]=>
- float(3)
- [21]=>
- float(2.9)
- [22]=>
- float(2.8)
- [23]=>
- float(2.7)
- [24]=>
- float(2.6)
- [25]=>
- float(2.5)
- [26]=>
- float(2.4)
- [27]=>
- float(2.3)
- [28]=>
- float(2.2)
- [29]=>
- float(2.1)
- [30]=>
+}
+array(11) {
+ [0]=>
float(2)
- [31]=>
+ [1]=>
float(1.9)
- [32]=>
+ [2]=>
float(1.8)
- [33]=>
+ [3]=>
float(1.7)
- [34]=>
+ [4]=>
float(1.6)
- [35]=>
+ [5]=>
float(1.5)
- [36]=>
+ [6]=>
float(1.4)
- [37]=>
+ [7]=>
float(1.3)
- [38]=>
+ [8]=>
float(1.2)
- [39]=>
+ [9]=>
float(1.1)
- [40]=>
+ [10]=>
float(1)
}
-array(41) {
+array(11) {
[0]=>
float(1)
[1]=>
@@ -1198,68 +464,8 @@ array(41) {
float(1.9)
[10]=>
float(2)
- [11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
-}
-array(41) {
+}
+array(11) {
[0]=>
float(1)
[1]=>
@@ -1282,64 +488,720 @@ array(41) {
float(1.9)
[10]=>
float(2)
+}
+
+-- Testing basic string with step --
+array(7) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "c"
+ [2]=>
+ string(1) "e"
+ [3]=>
+ string(1) "g"
+ [4]=>
+ string(1) "i"
+ [5]=>
+ string(1) "k"
+ [6]=>
+ string(1) "m"
+}
+
+*** Testing range() with various low and high values ***
+-- creating an array with low = 'ABCD' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+
+-- creating an array with low = 'ABCD' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = 'ABCD' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '-10.5555' and high = 'ABCD' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '-10.5555' --
+array(1) {
+ [0]=>
+ float(-10.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '1' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
[11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
+ float(0.4445)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = 'Array' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '1' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = '1' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = 'Array' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Possible variatins with steps ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+
+*** Testing max/outof range values ***
+array(2) {
+ [0]=>
+ int(2147483645)
+ [1]=>
+ int(2147483646)
+}
+array(3) {
+ [0]=>
+ float(2147483646)
+ [1]=>
+ float(2147483647)
+ [2]=>
+ float(2147483648)
+}
+array(2) {
+ [0]=>
+ int(-2147483647)
+ [1]=>
+ int(-2147483646)
+}
+array(2) {
+ [0]=>
+ float(-2147483648)
+ [1]=>
+ float(-2147483647)
+}
+array(3) {
+ [0]=>
+ float(-2147483649)
+ [1]=>
+ float(-2147483648)
+ [2]=>
+ float(-2147483647)
}
+
+*** Testing error conditions ***
+
+-- Testing ( (low < high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low < high) && (high-low < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (low-high < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid number of arguments --
+Warning: range() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: range() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: range() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid steps --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Done
diff --git a/ext/standard/tests/array/range_64bit.phpt b/ext/standard/tests/array/range_64bit.phpt
new file mode 100644
index 000000000..2f348afab
--- /dev/null
+++ b/ext/standard/tests/array/range_64bit.phpt
@@ -0,0 +1,1207 @@
+--TEST--
+Test range() function
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: array range ( mixed $low, mixed $high [, number $step] );
+ Description: Create an array containing a range of elements
+*/
+
+echo "*** Testing range() function on basic operations ***\n";
+
+echo "\n-- Integers as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range(1, 10) );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range(10, 1) );
+
+echo "\n-- Numeric Strings as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("1", "10") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("10", "1") );
+
+echo "\n-- Chars as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("a", "z") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("z", "a") );
+
+echo "\n-- Low and High are equal --\n";
+var_dump( range(5, 5) );
+var_dump( range("q", "q") );
+
+echo "\n-- floats as Low and High --\n";
+var_dump( range(5.1, 10.1) );
+var_dump( range(10.1, 5.1) );
+
+var_dump( range("5.1", "10.1") );
+var_dump( range("10.1", "5.1") );
+
+echo "\n-- Passing step with Low and High --\n";
+var_dump( range(1, 2, 0.1) );
+var_dump( range(2, 1, 0.1) );
+
+var_dump( range(1, 2, "0.1") );
+var_dump( range("1", "2", 0.1) );
+
+echo "\n-- Testing basic string with step --\n";
+var_dump( range("abcd", "mnop", 2) );
+
+echo "\n*** Testing range() with various low and high values ***";
+$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+
+for( $i = 0; $i < count($low_arr); $i++) {
+ for( $j = 0; $j < count($high_arr); $j++) {
+ echo "\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
+ var_dump( range( $low_arr[$i], $high_arr[$j] ) );
+ }
+}
+
+
+echo "\n*** Possible variatins with steps ***\n";
+var_dump( range( 1, 5, TRUE ) );
+var_dump( range( 1, 5, array(1, 2) ) );
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing ( (low < high) && (step = 0) ) --";
+var_dump( range(1, 2, 0) );
+var_dump( range("a", "b", 0) );
+
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
+var_dump( range(2, 1, 0) );
+var_dump( range("b", "a", 0) );
+
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
+var_dump( range(1.0, 7.0, 6.5) );
+
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
+var_dump( range(7.0, 1.0, 6.5) );
+
+echo "\n-- Testing Invalid number of arguments --";
+var_dump( range() ); // No.of args = 0
+var_dump( range(1) ); // No.of args < expected
+var_dump( range(1,2,3,4) ); // No.of args > expected
+var_dump( range(-1, -2, 2) );
+var_dump( range("a", "j", "z") );
+
+echo "\n-- Testing Invalid steps --";
+$step_arr = array( "string", NULL, FALSE, "", "\0" );
+
+foreach( $step_arr as $step ) {
+ var_dump( range( 1, 5, $step ) );
+}
+
+echo "\nDone";
+?>
+--EXPECTF--
+*** Testing range() function on basic operations ***
+
+-- Integers as Low and High --
+-- An array of elements from low to high --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(9)
+ [2]=>
+ int(8)
+ [3]=>
+ int(7)
+ [4]=>
+ int(6)
+ [5]=>
+ int(5)
+ [6]=>
+ int(4)
+ [7]=>
+ int(3)
+ [8]=>
+ int(2)
+ [9]=>
+ int(1)
+}
+
+-- Numeric Strings as Low and High --
+-- An array of elements from low to high --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(9)
+ [2]=>
+ int(8)
+ [3]=>
+ int(7)
+ [4]=>
+ int(6)
+ [5]=>
+ int(5)
+ [6]=>
+ int(4)
+ [7]=>
+ int(3)
+ [8]=>
+ int(2)
+ [9]=>
+ int(1)
+}
+
+-- Chars as Low and High --
+-- An array of elements from low to high --
+array(26) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+ [4]=>
+ string(1) "e"
+ [5]=>
+ string(1) "f"
+ [6]=>
+ string(1) "g"
+ [7]=>
+ string(1) "h"
+ [8]=>
+ string(1) "i"
+ [9]=>
+ string(1) "j"
+ [10]=>
+ string(1) "k"
+ [11]=>
+ string(1) "l"
+ [12]=>
+ string(1) "m"
+ [13]=>
+ string(1) "n"
+ [14]=>
+ string(1) "o"
+ [15]=>
+ string(1) "p"
+ [16]=>
+ string(1) "q"
+ [17]=>
+ string(1) "r"
+ [18]=>
+ string(1) "s"
+ [19]=>
+ string(1) "t"
+ [20]=>
+ string(1) "u"
+ [21]=>
+ string(1) "v"
+ [22]=>
+ string(1) "w"
+ [23]=>
+ string(1) "x"
+ [24]=>
+ string(1) "y"
+ [25]=>
+ string(1) "z"
+}
+
+-- An array of elements from high to low --
+array(26) {
+ [0]=>
+ string(1) "z"
+ [1]=>
+ string(1) "y"
+ [2]=>
+ string(1) "x"
+ [3]=>
+ string(1) "w"
+ [4]=>
+ string(1) "v"
+ [5]=>
+ string(1) "u"
+ [6]=>
+ string(1) "t"
+ [7]=>
+ string(1) "s"
+ [8]=>
+ string(1) "r"
+ [9]=>
+ string(1) "q"
+ [10]=>
+ string(1) "p"
+ [11]=>
+ string(1) "o"
+ [12]=>
+ string(1) "n"
+ [13]=>
+ string(1) "m"
+ [14]=>
+ string(1) "l"
+ [15]=>
+ string(1) "k"
+ [16]=>
+ string(1) "j"
+ [17]=>
+ string(1) "i"
+ [18]=>
+ string(1) "h"
+ [19]=>
+ string(1) "g"
+ [20]=>
+ string(1) "f"
+ [21]=>
+ string(1) "e"
+ [22]=>
+ string(1) "d"
+ [23]=>
+ string(1) "c"
+ [24]=>
+ string(1) "b"
+ [25]=>
+ string(1) "a"
+}
+
+-- Low and High are equal --
+array(1) {
+ [0]=>
+ int(5)
+}
+array(1) {
+ [0]=>
+ string(1) "q"
+}
+
+-- floats as Low and High --
+array(6) {
+ [0]=>
+ float(5.1)
+ [1]=>
+ float(6.1)
+ [2]=>
+ float(7.1)
+ [3]=>
+ float(8.1)
+ [4]=>
+ float(9.1)
+ [5]=>
+ float(10.1)
+}
+array(6) {
+ [0]=>
+ float(10.1)
+ [1]=>
+ float(9.1)
+ [2]=>
+ float(8.1)
+ [3]=>
+ float(7.1)
+ [4]=>
+ float(6.1)
+ [5]=>
+ float(5.1)
+}
+array(6) {
+ [0]=>
+ float(5.1)
+ [1]=>
+ float(6.1)
+ [2]=>
+ float(7.1)
+ [3]=>
+ float(8.1)
+ [4]=>
+ float(9.1)
+ [5]=>
+ float(10.1)
+}
+array(6) {
+ [0]=>
+ float(10.1)
+ [1]=>
+ float(9.1)
+ [2]=>
+ float(8.1)
+ [3]=>
+ float(7.1)
+ [4]=>
+ float(6.1)
+ [5]=>
+ float(5.1)
+}
+
+-- Passing step with Low and High --
+array(11) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1.1)
+ [2]=>
+ float(1.2)
+ [3]=>
+ float(1.3)
+ [4]=>
+ float(1.4)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.6)
+ [7]=>
+ float(1.7)
+ [8]=>
+ float(1.8)
+ [9]=>
+ float(1.9)
+ [10]=>
+ float(2)
+}
+array(11) {
+ [0]=>
+ float(2)
+ [1]=>
+ float(1.9)
+ [2]=>
+ float(1.8)
+ [3]=>
+ float(1.7)
+ [4]=>
+ float(1.6)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.4)
+ [7]=>
+ float(1.3)
+ [8]=>
+ float(1.2)
+ [9]=>
+ float(1.1)
+ [10]=>
+ float(1)
+}
+array(11) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1.1)
+ [2]=>
+ float(1.2)
+ [3]=>
+ float(1.3)
+ [4]=>
+ float(1.4)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.6)
+ [7]=>
+ float(1.7)
+ [8]=>
+ float(1.8)
+ [9]=>
+ float(1.9)
+ [10]=>
+ float(2)
+}
+array(11) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1.1)
+ [2]=>
+ float(1.2)
+ [3]=>
+ float(1.3)
+ [4]=>
+ float(1.4)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.6)
+ [7]=>
+ float(1.7)
+ [8]=>
+ float(1.8)
+ [9]=>
+ float(1.9)
+ [10]=>
+ float(2)
+}
+
+-- Testing basic string with step --
+array(7) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "c"
+ [2]=>
+ string(1) "e"
+ [3]=>
+ string(1) "g"
+ [4]=>
+ string(1) "i"
+ [5]=>
+ string(1) "k"
+ [6]=>
+ string(1) "m"
+}
+
+*** Testing range() with various low and high values ***
+-- creating an array with low = 'ABCD' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+
+-- creating an array with low = 'ABCD' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = 'ABCD' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '-10.5555' and high = 'ABCD' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '-10.5555' --
+array(1) {
+ [0]=>
+ float(-10.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '1' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = 'Array' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '1' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = '1' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = 'Array' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Possible variatins with steps ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+
+*** Testing max/outof range values ***
+array(2) {
+ [0]=>
+ int(2147483645)
+ [1]=>
+ int(2147483646)
+}
+array(3) {
+ [0]=>
+ int(2147483646)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(2147483648)
+}
+array(2) {
+ [0]=>
+ int(-2147483647)
+ [1]=>
+ int(-2147483646)
+}
+array(2) {
+ [0]=>
+ int(-2147483648)
+ [1]=>
+ int(-2147483647)
+}
+array(3) {
+ [0]=>
+ int(-2147483649)
+ [1]=>
+ int(-2147483648)
+ [2]=>
+ int(-2147483647)
+}
+
+*** Testing error conditions ***
+
+-- Testing ( (low < high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low < high) && (high-low < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (low-high < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid number of arguments --
+Warning: range() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: range() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: range() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid steps --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Done
diff --git a/ext/standard/tests/file/fgetc_basic.phpt b/ext/standard/tests/file/fgetc_basic.phpt
new file mode 100644
index 000000000..fca3a312a
--- /dev/null
+++ b/ext/standard/tests/file/fgetc_basic.phpt
@@ -0,0 +1,543 @@
+--TEST--
+Test fgetc() function : basic functionality
+--FILE--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+// include the header for common test function
+include ("file.inc");
+
+echo "*** Testing fgetc() : basic operations ***\n";
+/* read charecter from different files which are opened in different modes */
+$file_modes = array( "r", "rb", "rt", "r+", "r+b", "r+t");
+
+/* create file with following type of contents */
+$file_content_types = array("numeric", "text", "text_with_new_line");
+
+for($outerloop_counter = 0; $outerloop_counter < count($file_content_types); $outerloop_counter++) {
+ echo "--- Outerloop iteration ";
+ echo $outerloop_counter + 1;
+ echo " ---\n";
+ // create file file
+ create_files(dirname(__FILE__), 1, $file_content_types[$outerloop_counter]);
+
+ //open the file in different modes and check the working of fgetc
+ for($innerloop_counter = 0; $innerloop_counter < count($file_modes); $innerloop_counter++) {
+ echo "-- Innerloop iteration ";
+ echo $innerloop_counter + 1;
+ echo " of Outerloop Iteration ";
+ echo $outerloop_counter + 1;
+ echo " --\n";
+
+ // open the file using the $file_modes
+ $filename = dirname(__FILE__)."/file1.tmp"; // file name that is created by create_files
+ echo "-- Testing fgetc() : file opened using $file_modes[$innerloop_counter] mode --\n";
+ $file_handle = fopen($filename, $file_modes[$innerloop_counter]);
+ if ( !$file_handle ) {
+ echo "Error: failed to open file $filename!";
+ exit();
+ }
+
+ // perform the read file atleast 6 char and check
+ for( $counter = 1; $counter <= 6; $counter++ ) {
+ // read data from the file and check, file pointer position, feof etc
+ var_dump( fgetc($file_handle) ); // read a char
+ var_dump( ftell($file_handle) ); // file pointer position
+ var_dump( feof($file_handle) ); // is it eof()
+ var_dump($file_handle); // dump the $file_handle to see if any thing got modifed
+ } // end of for
+
+ // close the file
+ fclose ( $file_handle);
+
+ } // end of innerloop for
+
+ // delete the file
+ delete_files(dirname(__FILE__), 1);
+
+} // end of outerloop for
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fgetc() : basic operations ***
+--- Outerloop iteration 1 ---
+-- Innerloop iteration 1 of Outerloop Iteration 1 --
+-- Testing fgetc() : file opened using r mode --
+string(1) "2"
+int(1)
+bool(false)
+resource(8) of type (stream)
+string(1) "2"
+int(2)
+bool(false)
+resource(8) of type (stream)
+string(1) "2"
+int(3)
+bool(false)
+resource(8) of type (stream)
+string(1) "2"
+int(4)
+bool(false)
+resource(8) of type (stream)
+string(1) "2"
+int(5)
+bool(false)
+resource(8) of type (stream)
+string(1) "2"
+int(6)
+bool(false)
+resource(8) 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)
+string(1) "2"
+int(2)
+bool(false)
+resource(9) of type (stream)
+string(1) "2"
+int(3)
+bool(false)
+resource(9) of type (stream)
+string(1) "2"
+int(4)
+bool(false)
+resource(9) of type (stream)
+string(1) "2"
+int(5)
+bool(false)
+resource(9) of type (stream)
+string(1) "2"
+int(6)
+bool(false)
+resource(9) 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)
+string(1) "2"
+int(2)
+bool(false)
+resource(10) of type (stream)
+string(1) "2"
+int(3)
+bool(false)
+resource(10) of type (stream)
+string(1) "2"
+int(4)
+bool(false)
+resource(10) of type (stream)
+string(1) "2"
+int(5)
+bool(false)
+resource(10) of type (stream)
+string(1) "2"
+int(6)
+bool(false)
+resource(10) 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)
+string(1) "2"
+int(2)
+bool(false)
+resource(11) of type (stream)
+string(1) "2"
+int(3)
+bool(false)
+resource(11) of type (stream)
+string(1) "2"
+int(4)
+bool(false)
+resource(11) of type (stream)
+string(1) "2"
+int(5)
+bool(false)
+resource(11) of type (stream)
+string(1) "2"
+int(6)
+bool(false)
+resource(11) 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)
+string(1) "2"
+int(2)
+bool(false)
+resource(12) of type (stream)
+string(1) "2"
+int(3)
+bool(false)
+resource(12) of type (stream)
+string(1) "2"
+int(4)
+bool(false)
+resource(12) of type (stream)
+string(1) "2"
+int(5)
+bool(false)
+resource(12) of type (stream)
+string(1) "2"
+int(6)
+bool(false)
+resource(12) 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)
+string(1) "2"
+int(2)
+bool(false)
+resource(13) of type (stream)
+string(1) "2"
+int(3)
+bool(false)
+resource(13) of type (stream)
+string(1) "2"
+int(4)
+bool(false)
+resource(13) of type (stream)
+string(1) "2"
+int(5)
+bool(false)
+resource(13) of type (stream)
+string(1) "2"
+int(6)
+bool(false)
+resource(13) 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)
+string(1) "e"
+int(2)
+bool(false)
+resource(16) of type (stream)
+string(1) "x"
+int(3)
+bool(false)
+resource(16) of type (stream)
+string(1) "t"
+int(4)
+bool(false)
+resource(16) of type (stream)
+string(1) " "
+int(5)
+bool(false)
+resource(16) of type (stream)
+string(1) "t"
+int(6)
+bool(false)
+resource(16) 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)
+string(1) "e"
+int(2)
+bool(false)
+resource(17) of type (stream)
+string(1) "x"
+int(3)
+bool(false)
+resource(17) of type (stream)
+string(1) "t"
+int(4)
+bool(false)
+resource(17) of type (stream)
+string(1) " "
+int(5)
+bool(false)
+resource(17) of type (stream)
+string(1) "t"
+int(6)
+bool(false)
+resource(17) 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)
+string(1) "e"
+int(2)
+bool(false)
+resource(18) of type (stream)
+string(1) "x"
+int(3)
+bool(false)
+resource(18) of type (stream)
+string(1) "t"
+int(4)
+bool(false)
+resource(18) of type (stream)
+string(1) " "
+int(5)
+bool(false)
+resource(18) of type (stream)
+string(1) "t"
+int(6)
+bool(false)
+resource(18) 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)
+string(1) "e"
+int(2)
+bool(false)
+resource(19) of type (stream)
+string(1) "x"
+int(3)
+bool(false)
+resource(19) of type (stream)
+string(1) "t"
+int(4)
+bool(false)
+resource(19) of type (stream)
+string(1) " "
+int(5)
+bool(false)
+resource(19) of type (stream)
+string(1) "t"
+int(6)
+bool(false)
+resource(19) 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)
+string(1) "e"
+int(2)
+bool(false)
+resource(20) of type (stream)
+string(1) "x"
+int(3)
+bool(false)
+resource(20) of type (stream)
+string(1) "t"
+int(4)
+bool(false)
+resource(20) of type (stream)
+string(1) " "
+int(5)
+bool(false)
+resource(20) of type (stream)
+string(1) "t"
+int(6)
+bool(false)
+resource(20) 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)
+string(1) "e"
+int(2)
+bool(false)
+resource(21) of type (stream)
+string(1) "x"
+int(3)
+bool(false)
+resource(21) of type (stream)
+string(1) "t"
+int(4)
+bool(false)
+resource(21) of type (stream)
+string(1) " "
+int(5)
+bool(false)
+resource(21) of type (stream)
+string(1) "t"
+int(6)
+bool(false)
+resource(21) 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)
+string(1) "i"
+int(2)
+bool(false)
+resource(24) of type (stream)
+string(1) "n"
+int(3)
+bool(false)
+resource(24) of type (stream)
+string(1) "e"
+int(4)
+bool(false)
+resource(24) of type (stream)
+string(1) "
+"
+int(5)
+bool(false)
+resource(24) of type (stream)
+string(1) "l"
+int(6)
+bool(false)
+resource(24) 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)
+string(1) "i"
+int(2)
+bool(false)
+resource(25) of type (stream)
+string(1) "n"
+int(3)
+bool(false)
+resource(25) of type (stream)
+string(1) "e"
+int(4)
+bool(false)
+resource(25) of type (stream)
+string(1) "
+"
+int(5)
+bool(false)
+resource(25) of type (stream)
+string(1) "l"
+int(6)
+bool(false)
+resource(25) 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)
+string(1) "i"
+int(2)
+bool(false)
+resource(26) of type (stream)
+string(1) "n"
+int(3)
+bool(false)
+resource(26) of type (stream)
+string(1) "e"
+int(4)
+bool(false)
+resource(26) of type (stream)
+string(1) "
+"
+int(5)
+bool(false)
+resource(26) of type (stream)
+string(1) "l"
+int(6)
+bool(false)
+resource(26) 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)
+string(1) "i"
+int(2)
+bool(false)
+resource(27) of type (stream)
+string(1) "n"
+int(3)
+bool(false)
+resource(27) of type (stream)
+string(1) "e"
+int(4)
+bool(false)
+resource(27) of type (stream)
+string(1) "
+"
+int(5)
+bool(false)
+resource(27) of type (stream)
+string(1) "l"
+int(6)
+bool(false)
+resource(27) 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)
+string(1) "i"
+int(2)
+bool(false)
+resource(28) of type (stream)
+string(1) "n"
+int(3)
+bool(false)
+resource(28) of type (stream)
+string(1) "e"
+int(4)
+bool(false)
+resource(28) of type (stream)
+string(1) "
+"
+int(5)
+bool(false)
+resource(28) of type (stream)
+string(1) "l"
+int(6)
+bool(false)
+resource(28) 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)
+string(1) "i"
+int(2)
+bool(false)
+resource(29) of type (stream)
+string(1) "n"
+int(3)
+bool(false)
+resource(29) of type (stream)
+string(1) "e"
+int(4)
+bool(false)
+resource(29) of type (stream)
+string(1) "
+"
+int(5)
+bool(false)
+resource(29) of type (stream)
+string(1) "l"
+int(6)
+bool(false)
+resource(29) of type (stream)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/fgetc_error.phpt b/ext/standard/tests/file/fgetc_error.phpt
new file mode 100644
index 000000000..b771c3a29
--- /dev/null
+++ b/ext/standard/tests/file/fgetc_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test fgetc() function : error conditions
+--FILE--
+<?php
+/*
+ Prototype: string fgetc ( resource $handle );
+ Description: Gets character from file pointer
+*/
+
+echo "*** Testing error conditions ***\n";
+// zero argument
+echo "-- Testing fgetc() with zero argument --\n";
+var_dump( fgetc() );
+
+// more than expected no. of args
+echo "-- Testing fgetc() with more than expected number of arguments --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( fgetc($fp, $fp) );
+fclose($fp);
+
+// test invalid arguments : non-resources
+echo "-- Testing fgetc() with invalid arguments --\n";
+$invalid_args = array (
+ "string",
+ 10,
+ 10.5,
+ true,
+ array(1,2,3),
+ new stdclass,
+);
+/* loop to test fgetc() with different invalid type of args */
+for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
+ echo "-- Iteration $loop_counter --\n";
+ var_dump( fgetc($invalid_args[$loop_counter - 1]) );
+}
+
+echo "Done\n";
+--EXPECTF--
+*** Testing error conditions ***
+-- Testing fgetc() with zero argument --
+
+Warning: Wrong parameter count for fgetc() in %s on line %d
+NULL
+-- Testing fgetc() with more than expected number of arguments --
+
+Warning: Wrong parameter count for fgetc() in %s on line %d
+NULL
+-- Testing fgetc() with invalid arguments --
+-- Iteration 1 --
+
+Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %s
+bool(false)
+-- Iteration 6 --
+
+Warning: fgetc(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc
new file mode 100644
index 000000000..ea8bf0400
--- /dev/null
+++ b/ext/standard/tests/file/file.inc
@@ -0,0 +1,472 @@
+<?php
+/* Header file for common file test functions
+ Following functions are provided :
+ create_files() : create files with specified contents
+ delete_files() : delete files
+ create_links() : crate links of different types
+ delete_links() : delete links
+ fill_files() : fill file with specified contents
+ change_file_perms : Change permission of files
+
+*/
+
+define('file_not_found', 2, 1);
+
+/*
+ Function: bool create_file(string $filename, string $mode = "w");
+ Description: creates a new file using fopen() call
+ $filename = Name of the file
+ $mode = Mode as specified in fopen call, read documentation of fopen() call for more info
+
+ Returns:
+ true on success, false otherwise
+*/
+function create_file($filename, $mode = "w") {
+ $file_handle = fopen ($filename, $mode);
+ if ( $file_handle == false )
+ return false;
+ fclose($file_handle);
+ return true;
+}
+
+/*
+ Function : bool fill_file(resource $file_handle, string $fill_type, string $file_size);
+ Description: Fills the file with data as specified with requested size.
+ $file_handle = file handle, opened with write options,
+ $fill_type:
+ "text" = fills with string of size $file_size
+ "numeric" = fills with numeric value of size $file_size
+ "empty" = no fill operation performed, returns true
+ "text_with_new_line" = similar to "text" fill type but writes with new line
+ "alphanumeric" = fills with alphnumeric values
+ Returns: true on success, false on failure & invalid fill type
+*/
+
+function fill_file($file_handle, $fill_type, $file_size) {
+
+ if ( $fill_type == "empty" ) {
+ // no fill required, return true
+ return true;
+ } if ( $fill_type == "text" ) {
+ $data = "text ";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "text_with_new_line" ) {
+ $data = "line\nline of text\n";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "alphanumeric" ) {
+ $data = "ab12 ";
+ $size_divider = strlen($data);
+ $add_value = strlen($data);
+ } else if ( $fill_type == "numeric" ) {
+ $data = 2;
+ $size_divider = 1;
+ $add_value = 0;
+ } else {
+ // invalid fill type;
+ return false;
+ }
+
+ // write in terms of a chunk of 1 K to avoid memory size overflow
+ $size = $file_size;
+ $chunk_size = 1024;
+ if ( $size > $chunk_size ) {
+ $loop_count = 1;
+ do {
+ $loop_count ++;
+ if ( $size <= $chunk_size ) {
+ $chunk_size = $size;
+ }
+ $num_values = str_repeat($data, ($chunk_size/$size_divider) + $add_value );
+ $bytes_written = fwrite($file_handle, $num_values, $chunk_size);
+ if ( $bytes_written != $chunk_size ) {
+ return false;
+ }
+ $size -= $chunk_size;
+ } while ( $size > 0 );
+ } else {
+ $num_values = str_repeat($data, ($chunk_size/$size_divider) + $add_value );
+ $bytes_written = fwrite($file_handle, $num_values, $file_size);
+ if ( $bytes_written != $chunk_size ) {
+ return false;
+ }
+ }
+
+ // successful, return true
+ return true;
+}
+
+/*
+ Function: int change_file_perms(string $file_path, int $count = 1, int $perms = 0755,
+ string $name_prefix = "file",
+ string $name_suffix = 1, $file_extension = ".tmp");
+ Description: changes file permission for given file(s).
+ $file_path = dir path where file exists
+ $count = no. of files, default is 1
+ $perms = new permission of the file, similar to $mode args of chmod() call
+ $name_prefix = common name prefix, default is "file"
+ $name_suffix = suffix to end the common name given in name_prefix to create
+ a unique name. default is 1.
+ $file_extension = default is .tmp
+ Returns:
+ Integer, Count of total files permission changed.
+*/
+function change_file_perms($file_path,
+ $count = 1,
+ $perms = 0755,
+ $name_prefix = "file",
+ $name_suffix = 1,
+ $file_extension = ".tmp" )
+{
+ $changed = 0;
+
+ if( $count <= 0 )
+ return $changed;
+
+ if ( $name_suffix <= 0)
+ $name_suffix = 1;
+
+ for($loop_counter = 1; $loop_counter <= $count; $loop_counter++) {
+ $filename = $file_path."/".$name_prefix.$name_suffix.$file_extension;
+ if( chmod($filename, $perms) )
+ $changed++;
+ $name_suffix++;
+ }
+ return $changed;
+}
+
+/*
+ Function: array create_files( string $file_path,
+ int $count = 1,
+ string $content_type = "numeric",
+ int $permission = 0755,
+ int $size = 1,
+ string $mode = "w",
+ string $name_prefix = "file",
+ int $name_suffix = 1,
+ string $flag = "kilobytes"
+ string $file_extension = ".tmp"
+ );
+ Description: Creates given number of files with specified mode and
+ permissions. File is filled with content of size specified.
+ $file_path = dir where files will be created
+ $name_prefix = prefix to be used for names, name is suffix with a
+ unqiue numeric value to make the file name unique, default = file
+ $name_suffix = suffix to be used for the name, default = 1
+ $count = total no. of files to be created, default = 1
+ $mode = file open mode as specified in fopen() call. Do not use
+ modes used for only reading the file. Default = "w"
+ $permission = An octal number, This should be similar to $mode
+ specified in chmod() call.
+ $content_type = Specify type of the content to fill in the file.
+ "numeric" = fill file with numeric vlaues
+ "text" = fill file with regular text
+ "empty" = empty file
+ "text_with_new_line" = similar to text fill type, but writes with new line char
+ "alphanumeric" = fill file with alpha numeric text
+ If imporper $content type is specified, file is created as empty
+ $size = size of the fill in terms of kilobyte, i.e size of the file.
+ if $flag is specified as "byte", then then given size is taken in bytes
+ $flag = specifiy if size has to be treated as no of total bytes or
+ multiple of KB.
+ "kilobytes" = take size in terms of multiple of KB
+ "byte" = take size in terms of bytes
+ $file_extension = default is .tmp
+
+ Returns:
+ An array with following key value pair:
+ created => total file created
+ filled => total files filled
+ perms_changed => total files permission changed
+*/
+function create_files( $file_path,
+ $count = 1,
+ $content_type = "numeric",
+ $permission = 0755,
+ $size = 1,
+ $mode = "w",
+ $name_prefix = "file",
+ $name_suffix = 1,
+ $flag = "kilobytes",
+ $file_extension = ".tmp"
+ )
+{
+ $return_value = array('created' => 0, 'filled' => 0, 'perms_changed' => 0);
+
+ //ensure that suffix is a +ve integer
+ if ($name_suffix <= 0) {
+ $name_suffix = 1;
+ }
+
+ // check for proper size
+ if ( $size == 0 )
+ return $return_value;
+
+ // prepare the size based on flag
+ $file_size = $size;
+ if ( $flag == "kilobytes" ) {
+ $file_size = $file_size * 1024;
+ }
+
+ $tmp_name_suffix = $name_suffix;
+ // create the files with specified mode and permission
+ for($file_created_count = 1; $file_created_count <= $count; $file_created_count ++) {
+ $filename = $file_path."/".$name_prefix.$tmp_name_suffix.$file_extension;
+
+ $status = create_file($filename, $mode);
+
+ $tmp_name_suffix++;
+
+ if ($status == true) {
+ $return_value['created']++;
+ }
+ else {
+ return $return_value;
+ }
+ }
+
+ if ( $content_type == "empty" ) {
+ $return_value['filled'] = $count;
+ return $return_value;
+ }
+
+ // fill the file with specifiec type of data and size
+ $tmp_name_suffix = $name_suffix;
+ for($loop_counter = 1; $loop_counter <= $count; $loop_counter ++) {
+ $filename = $file_path."/".$name_prefix.$tmp_name_suffix.$file_extension;
+ $file_handle = fopen($filename, $mode);
+ if($file_handle == false) {
+ fclose($file_handle);
+ return $return_value;
+ } // end of if
+
+ // call fill_file() to fill the file
+ if( fill_file($file_handle, $content_type, $file_size) )
+ $return_value['filled']++;
+
+ fclose($file_handle);
+
+ $tmp_name_suffix++;
+ } // end of for
+
+ // change all file's permissions
+ $return_value['perms_changed'] = change_file_perms($file_path, $count, $permission, $name_prefix,
+ $name_suffix, $file_extension);
+
+ return $return_value;
+}
+
+
+/*
+ Function: function create_links( $file_path,
+ $filename,
+ $link_count = 1,
+ $link_type = "soft",
+ $link_size = 1024,
+ $link_name_prefix = "link",
+ $link_name_suffix = 1,
+ $link_file_content = "text",
+ $link_perms = 0755,
+ $link_file_extension = ".tmp"
+ );
+
+ Description: Creates given number of links with specified mode and
+ permissions.Link is filled with content of size specified.
+ $file_path = location of the file and where links need to be created
+ $link_name_prefix = prefix to be used for names, name is suffix with a
+ unique numeric value to make the file name unique, default = link
+ $link_name_suffix = suffix to be used for the name, default = 1
+ $link_count = total no. of links to be created to given file, default = 1
+ $link_perms = An octal number, This should be similar to $mode
+ specified in chmod() call.
+ $link_file_content = Type of the content to fill in the file.
+ numeric = fill file with numeric vlaues
+ text = fill file with regular text
+ text_with_new_line = same as text but new lines are written
+ alphanumeric = fill with alphanumeric text
+ If imporper $content type is specified, file is created as empty
+ $size = size of the fill in terms of kilobyte, i.e size of the file.
+ $link_type = type of the link to be created
+ "soft" = soft link
+ "hard" = hard link
+ $filename = file used to create a link on
+
+ Returns:
+ An array with following key value pair:
+ created => total file created
+ filled => total files filled, always returned as 1
+ perms_changed => total files permission changed
+*/
+function create_links( $file_path,
+ $filename,
+ $link_count = 1,
+ $link_type = "soft",
+ $link_size = 1024,
+ $link_name_prefix = "link",
+ $link_name_suffix = 1,
+ $link_file_content = "text",
+ $link_perms = 0755,
+ $link_file_extension = ".tmp"
+ )
+{
+ $return_value = array('created' => 0, 'filled' => 0, 'perms_changed' => 0);
+ $tmp_name_suffix = $link_name_suffix;
+ $src_filename = $file_path."/".$filename;
+ switch( $link_type ) {
+ default :
+ case "soft" : // create a soft link
+ for($link_created_count = 1; $link_created_count <= $link_count; $link_created_count++) {
+ $linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension;
+ $status = symlink( $src_filename, $linkname);
+ $tmp_name_suffix++;
+ if ($status) {
+ $return_value['created']++;
+ }
+ else {
+ $return_value;
+ }
+ }
+ break;
+
+ case "hard" : // create a hard link
+ for($link_created_count = 1; $link_created_count <= $link_count; $link_created_count++) {
+ $linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension;
+ $status = link($src_filename, $linkname);
+ $tmp_name_suffix++;
+ if ($status) {
+ $return_value['created']++;
+ }
+ else {
+ $return_value;
+ }
+ }
+ break;
+ }
+
+ if ( $link_file_content == "empty" ) {
+ $return_value['filled'] = 1;
+ return $return_value;
+ }
+
+ // fill the file with specific type of data and size
+ $tmp_name_suffix = $link_name_suffix;
+ $linkname = $file_path."/".$link_name_prefix.$tmp_name_suffix.$link_file_extension;
+ $file_handle = fopen($linkname, "w");
+ if($file_handle == false) {
+ return $return_value;
+ } // end of if
+
+ // call fill_file() to fill the file
+ if( fill_file($file_handle, $link_file_content, $link_size) )
+ $return_value['filled']++;
+
+ // close the link
+ fclose($file_handle);
+
+ // change the permission of the link file, only if hard link.
+ // this is not applicable to soft links
+ if( $link_type == "hard" ) {
+ $return_value['perms_changed'] = change_file_perms($file_path,
+ $link_count,
+ $link_perms,
+ $link_name_prefix,
+ $link_name_suffix,
+ $link_file_extension );
+ }
+
+ return $return_value;
+}
+
+/*
+ Function: bool delete_file(string $filename);
+ Description: delete a given file if exists
+ Returns: true on success
+ false on failure
+ file_not_found if file doesn't exist
+*/
+function delete_file($filename) {
+ // check if file exists
+ if ( file_exists($filename) ) {
+ if ( unlink($filename) )
+ return true;
+ else
+ return false;
+ }
+ return file_not_found;
+}
+
+/*
+ Function: array delete_files(string $file_path, int $count = 1, string $name_prefix = "file",
+ int name_suffix = 1, $file_extension = ".tmp" );
+ Description: Deletes given number of files if exists.
+ $file_path = location of the files
+ $name_prefix = prefix for the filename, rest of the name is incremental(increment by 1 only)
+ numeric starting from suffix upto count
+ $count = number of files to be deleted
+ $name_suffix = first numeric suffix in the name
+ Returns: An array with following key/value pair
+ deleted = Number of files deleted.
+ notfound = Count of non existing file
+ failed = Count of failed to delete
+*/
+function delete_files($file_path,
+ $count = 1,
+ $name_prefix = "file",
+ $name_suffix = 1,
+ $file_extension = ".tmp")
+{
+ $return_value = array ('deleted' => 0, 'notfound' => 0, 'failed' => 0);
+
+ if ( $name_suffix < 1 )
+ $name_suffix = 1;
+ for($loop_counter = 1; $loop_counter <= $count; $loop_counter++) {
+ $filename = $file_path."/".$name_prefix.$name_suffix.$file_extension;
+ $name_suffix++;
+ $status = delete_file($filename);
+ if($status == true) {
+ $return_value['deleted']++;
+ } else if($status == file_not_found) {
+ $return_value['notfound']++;
+ } else {
+ $return_value['failed']++;
+ }
+
+ } // end of for
+ return $return_value;
+}
+
+/*
+ Function: array delete_links( $file_path,
+ $link_file_count,
+ $link_name_prefix,
+ $link_name_suffix,
+ $link_file_extension );
+ Description: Deletes given number of links if exists. Uses delete_files() function
+ $file_path = location of link files
+ $link_file_count = Number of link files
+ $link_name_prefix = prefix for the linkname, rest of the name is incremental(increment by 1 only)
+ numeric starting from $link_name_suffix upto count
+ $link_name_suffix = first numeric suffix in the name
+
+ Returns: An array with following key/value pair
+ deleted = Number of links deleted.
+ notfound = Count of non existing link
+ failed = Count of failed to delete
+*/
+function delete_links($file_path,
+ $link_file_count = 1,
+ $link_name_prefix = "link",
+ $link_name_suffix = 1,
+ $link_file_extension = ".tmp")
+{
+ // call the delete files to delete links
+ $return_value = delete_files( $file_path,
+ $link_file_count,
+ $link_name_prefix,
+ $link_name_suffix,
+ $link_file_extension );
+ return $return_value;
+}
+
+
diff --git a/ext/standard/tests/file/fileinode_basic.phpt b/ext/standard/tests/file/fileinode_basic.phpt
new file mode 100644
index 000000000..27b7dbd79
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test fileinode() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+echo "*** Testing fileinode() with file, directory ***\n";
+
+/* Getting inode of created file */
+$file_path = dirname(__FILE__);
+fopen("$file_path/inode.tmp", "w");
+print( fileinode("$file_path/inode.tmp") )."\n";
+
+/* Getting inode of current file */
+print( fileinode(__FILE__) )."\n";
+
+/* Getting inode of directories */
+print( fileinode(".") )."\n";
+print( fileinode("./..") )."\n";
+
+echo "\n*** Done ***";
+--CLEAN--
+<?php
+unlink (dirname(__FILE__)."/inode.tmp");
+?>
+
+--EXPECTF--
+*** Testing fileinode() with file, directory ***
+%d
+%d
+%d
+%d
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt
new file mode 100644
index 000000000..4730d060d
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test fileinode() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+echo "*** Testing error conditions of fileinode() ***";
+
+/* Non-existing file or dir */
+var_dump( fileinode("/no/such/file/dir") );
+
+/* Invalid arguments */
+var_dump( fileinode("string") );
+var_dump( fileinode(100) );
+
+/* No.of argumetns less than expected */
+var_dump( fileinode() );
+
+/* No.of argumetns greater than expected */
+var_dump( fileinode(__FILE__, "string") );
+
+echo "\n*** Done ***";
+
+--EXPECTF--
+*** Testing error conditions of fileinode() ***
+Warning: fileinode(): stat failed for /no/such/file/dir in %s on line %d
+bool(false)
+
+Warning: fileinode(): stat failed for string in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for fileinode() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for fileinode() in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fileinode_variation.phpt b/ext/standard/tests/file/fileinode_variation.phpt
new file mode 100644
index 000000000..7a279642d
--- /dev/null
+++ b/ext/standard/tests/file/fileinode_variation.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test fileinode() function: Variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no fnmatch() on Windows');
+}
+--FILE--
+<?php
+/*
+Prototype: int fileinode ( string $filename );
+Description: Returns the inode number of the file, or FALSE in case of an error.
+*/
+
+include "file.inc";
+
+echo "*** Testing fileinode() with files, links and directories ***\n";
+
+echo "-- Testing with files --\n";
+create_files( dirname(__FILE__), 2);
+
+print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n";
+print( fileinode( dirname(__FILE__)."/file2.tmp") )."\n";
+clearstatcache();
+
+echo "-- Testing with links: hard link --\n";
+link( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/link1.tmp"); // Creating an hard link
+print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n";
+clearstatcache();
+print( fileinode( dirname(__FILE__)."/link1.tmp") )."\n";
+clearstatcache();
+
+echo "-- Testing with links: soft link --\n";
+symlink( dirname(__FILE__)."/file2.tmp", dirname(__FILE__)."/link2.tmp"); // Creating a soft link
+print( fileinode( dirname(__FILE__)."/file2.tmp") )."\n";
+clearstatcache();
+print( fileinode( dirname(__FILE__)."/link2.tmp") )."\n";
+
+delete_files( dirname(__FILE__), 2, "link");
+
+echo "-- Testing after copying a file --\n";
+copy( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/file1_new.tmp");
+print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n";
+clearstatcache();
+print( fileinode( dirname(__FILE__)."/file1_new.tmp") )."\n";
+
+unlink( dirname(__FILE__)."/file1_new.tmp");
+
+delete_files( dirname(__FILE__), 2);
+
+
+echo "-- Testing after renaming the file --\n";
+$file_path = dirname(__FILE__);
+fopen("$file_path/old.txt", "w");
+print( fileinode("$file_path/old.txt") )."\n";
+clearstatcache();
+
+rename("$file_path/old.txt", "$file_path/new.txt");
+print( fileinode("$file_path/new.txt") )."\n";
+
+unlink("$file_path/new.txt");
+
+echo "-- Testing with directories --\n";
+mkdir("$file_path/dir");
+print( fileinode("$file_path/dir") )."\n";
+clearstatcache();
+
+mkdir("$file_path/dir/subdir");
+print( fileinode("$file_path/dir/subdir") );
+
+rmdir("$file_path/dir/subdir");
+rmdir("$file_path/dir");
+
+echo "\n*** Done ***";
+
+--EXPECTF--
+*** Testing fileinode() with files, links and directories ***
+-- Testing with files --
+%d
+%d
+-- Testing with links: hard link --
+%d
+%d
+-- Testing with links: soft link --
+%d
+%d
+-- Testing after copying a file --
+%d
+%d
+-- Testing after renaming the file --
+%d
+%d
+-- Testing with directories --
+%d
+%d
+*** Done ***
diff --git a/ext/standard/tests/file/filetype_basic.phpt b/ext/standard/tests/file/filetype_basic.phpt
new file mode 100644
index 000000000..4a6d3b2bc
--- /dev/null
+++ b/ext/standard/tests/file/filetype_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test filetype() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+echo "*** Testing filetype() with files and dirs ***\n";
+
+print( filetype(__FILE__) )."\n";
+print( filetype(".") )."\n";
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing filetype() with files and dirs ***
+file
+dir
+*** Done ***
diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt
new file mode 100644
index 000000000..9b4d71fff
--- /dev/null
+++ b/ext/standard/tests/file/filetype_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test filetype() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+echo "\n*** Testing error conditions ***";
+/* non-existing file or dir */
+print( filetype("/no/such/file/dir") );
+
+/* unknown type */
+print( filetype("string") );
+print( filetype(100) );
+
+/* No.of args less than expected */
+print( filetype() );
+
+/* No.of args greater than expected */
+print( filetype("file", "file") );
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+Warning: filetype(): Lstat failed for /no/such/file/dir in %s on line %d
+
+Warning: filetype(): Lstat failed for string in %s on line %d
+
+Warning: filetype(): Lstat failed for 100 in %s on line %d
+
+Warning: Wrong parameter count for filetype() in %s on line %d
+
+Warning: Wrong parameter count for filetype() in %s on line %d
+
+*** Done ***
diff --git a/ext/standard/tests/file/filetype_variation.phpt b/ext/standard/tests/file/filetype_variation.phpt
new file mode 100644
index 000000000..09b961ef7
--- /dev/null
+++ b/ext/standard/tests/file/filetype_variation.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test filetype() function: Variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no fnmatch() on Windows');
+}
+if (!function_exists("posix_mkfifo")) {
+ die("skip no posix_mkfifo()");
+}
+?>
+--FILE--
+<?php
+/*
+Prototype: string filetype ( string $filename );
+Description: Returns the type of the file. Possible values are fifo, char,
+ dir, block, link, file, and unknown.
+*/
+
+include "file.inc";
+
+echo "*** Testing filetype() with various types ***\n";
+
+create_files( dirname(__FILE__), 2);
+
+echo "-- Checking with files --\n";
+print( filetype( dirname(__FILE__)."/file1.tmp") )."\n";
+print( filetype( dirname(__FILE__)."/file2.tmp") )."\n";
+clearstatcache();
+
+echo "-- Checking with links: hardlink --\n";
+link( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/link1.tmp");
+print( filetype( dirname(__FILE__)."/link1.tmp" ) )."\n";
+
+echo "-- Checking with links: symlink --\n";
+symlink( dirname(__FILE__)."/file2.tmp", dirname(__FILE__)."/link2.tmp");
+print( filetype( dirname(__FILE__)."/link2.tmp") )."\n";
+
+delete_files( dirname(__FILE__), 2, "link");
+
+delete_files( dirname(__FILE__), 2, "file");
+
+$file_path = dirname(__FILE__);
+echo "-- Checking with directory --\n";
+mkdir("$file_path/temp");
+print( filetype("$file_path/temp") )."\n";
+rmdir( "$file_path/temp" );
+
+echo "-- Checking with fifo --\n";
+posix_mkfifo( dirname(__FILE__)."/file3.tmp", 0755);
+print( filetype( dirname(__FILE__)."/file3.tmp") )."\n";
+delete_files( dirname(__FILE__), 1, "file", 3);
+
+/* Checking with block in file */
+/* To test this PEAR package should be installed */
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing filetype() with various types ***
+-- Checking with files --
+file
+file
+-- Checking with links: hardlink --
+file
+-- Checking with links: symlink --
+link
+-- Checking with directory --
+dir
+-- Checking with fifo --
+fifo
+
+*** Done ***
diff --git a/ext/standard/tests/file/flock_basic.phpt b/ext/standard/tests/file/flock_basic.phpt
new file mode 100644
index 000000000..d218cee5e
--- /dev/null
+++ b/ext/standard/tests/file/flock_basic.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test flock() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
+Description: PHP supports a portable way of locking complete files
+ in an advisory way
+*/
+
+echo "*** Testing flock() fun with file and dir ***\n";
+$file_path = dirname(__FILE__);
+
+$file_handle = fopen("$file_path/lock.tmp", "w");
+var_dump(flock($file_handle, LOCK_SH|LOCK_NB));
+var_dump(flock($file_handle, LOCK_UN));
+var_dump(flock($file_handle, LOCK_EX));
+var_dump(flock($file_handle, LOCK_UN));
+fclose($file_handle);
+unlink("$file_path/lock.tmp");
+
+mkdir("$file_path/dir");
+$dir_handle = opendir("$file_path/dir");
+var_dump(flock($dir_handle, LOCK_SH|LOCK_NB));
+var_dump(flock($dir_handle, LOCK_UN));
+var_dump(flock($dir_handle, LOCK_EX));
+var_dump(flock($dir_handle, LOCK_UN));
+closedir($dir_handle);
+rmdir("$file_path/dir");
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing flock() fun with file and dir ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+*** Done ***
diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt
new file mode 100644
index 000000000..077e5430b
--- /dev/null
+++ b/ext/standard/tests/file/flock_error.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Test flock() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
+Description: PHP supports a portable way of locking complete files
+ in an advisory way
+*/
+
+echo "*** Testing error conditions ***\n";
+
+$file = dirname(__FILE__)."/flock.tmp";
+$fp = fopen($file, "w");
+
+/* array of operatons */
+$operations = array(
+ 0,
+ LOCK_NB,
+ FALSE,
+ NULL,
+ array(1,2,3),
+ array(),
+ "string",
+ "",
+ "\0"
+);
+
+$i = 0;
+foreach($operations as $operation) {
+ echo "\n--- Iteration $i ---";
+ var_dump(flock($fp, $operation));
+ $i++;
+}
+
+
+/* Invalid arguments */
+$fp = fopen($file, "w");
+fclose($fp);
+var_dump(flock($fp, LOCK_SH|LOCK_NB));
+
+var_dump(flock("", "", $var));
+
+/* No.of args leass than expected */
+var_dump(flock());
+var_dump(flock($fp));
+
+/* No.of args greater than expected */
+var_dump(flock($fp, "", $var, ""));
+
+echo "\n*** Done ***\n";
+?>
+--CLEAN--
+<?php
+$file = dirname(__FILE__)."/flock.tmp";
+unlink($file);
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+--- Iteration 0 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 1 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 2 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 3 ---
+Warning: flock(): Illegal operation argument in %s on line %d
+bool(false)
+
+--- Iteration 4 ---
+Warning: flock() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+--- Iteration 5 ---
+Warning: flock() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+--- Iteration 6 ---
+Warning: flock() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+--- Iteration 7 ---
+Warning: flock() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+--- Iteration 8 ---
+Warning: flock() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: flock(): 6 is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: flock() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: flock() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt
new file mode 100644
index 000000000..d34f78f7f
--- /dev/null
+++ b/ext/standard/tests/file/flock_variation.phpt
@@ -0,0 +1,328 @@
+--TEST--
+Test flock() function: Variations
+--FILE--
+<?php
+/*
+Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
+Description: PHP supports a portable way of locking complete files
+ in an advisory way
+*/
+
+echo "*** Testing flock() fun with the various operation and
+ wouldblock values ***\n";
+$file = dirname(__FILE__)."/flock.tmp";
+$fp = fopen($file, "w");
+
+/* array of operatons */
+$operations = array(
+ LOCK_SH,
+ LOCK_EX,
+ LOCK_SH|LOCK_NB,
+ LOCK_EX|LOCK_NB,
+ LOCK_SH|LOCK_EX,
+ LOCK_UN,
+ 1,
+ 2,
+ 2.234,
+ TRUE
+);
+
+/* array of wouldblocks */
+$wouldblocks = array(
+ 0,
+ 1,
+ 2,
+ 1.234,
+ TRUE,
+ FALSE,
+ NULL,
+ array(1,2,3),
+ array(),
+ "string",
+ "",
+ "\0"
+);
+
+$i = 0;
+foreach($operations as $operation) {
+ echo "--- Outer iteration $i ---\n";
+ var_dump(flock($fp, $operation));
+ $j = 0;
+ foreach($wouldblocks as $wouldblock) {
+ echo "-- Inner iteration $j in $i --\n";
+ var_dump(flock($fp, $operation, $wouldblock));
+ $j++;
+ }
+ $i++;
+}
+
+fclose($fp);
+@unlink($file);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing flock() fun with the various operation and
+ wouldblock values ***
+--- Outer iteration 0 ---
+bool(true)
+-- Inner iteration 0 in 0 --
+bool(true)
+-- Inner iteration 1 in 0 --
+bool(true)
+-- Inner iteration 2 in 0 --
+bool(true)
+-- Inner iteration 3 in 0 --
+bool(true)
+-- Inner iteration 4 in 0 --
+bool(true)
+-- Inner iteration 5 in 0 --
+bool(true)
+-- Inner iteration 6 in 0 --
+bool(true)
+-- Inner iteration 7 in 0 --
+bool(true)
+-- Inner iteration 8 in 0 --
+bool(true)
+-- Inner iteration 9 in 0 --
+bool(true)
+-- Inner iteration 10 in 0 --
+bool(true)
+-- Inner iteration 11 in 0 --
+bool(true)
+--- Outer iteration 1 ---
+bool(true)
+-- Inner iteration 0 in 1 --
+bool(true)
+-- Inner iteration 1 in 1 --
+bool(true)
+-- Inner iteration 2 in 1 --
+bool(true)
+-- Inner iteration 3 in 1 --
+bool(true)
+-- Inner iteration 4 in 1 --
+bool(true)
+-- Inner iteration 5 in 1 --
+bool(true)
+-- Inner iteration 6 in 1 --
+bool(true)
+-- Inner iteration 7 in 1 --
+bool(true)
+-- Inner iteration 8 in 1 --
+bool(true)
+-- Inner iteration 9 in 1 --
+bool(true)
+-- Inner iteration 10 in 1 --
+bool(true)
+-- Inner iteration 11 in 1 --
+bool(true)
+--- Outer iteration 2 ---
+bool(true)
+-- Inner iteration 0 in 2 --
+bool(true)
+-- Inner iteration 1 in 2 --
+bool(true)
+-- Inner iteration 2 in 2 --
+bool(true)
+-- Inner iteration 3 in 2 --
+bool(true)
+-- Inner iteration 4 in 2 --
+bool(true)
+-- Inner iteration 5 in 2 --
+bool(true)
+-- Inner iteration 6 in 2 --
+bool(true)
+-- Inner iteration 7 in 2 --
+bool(true)
+-- Inner iteration 8 in 2 --
+bool(true)
+-- Inner iteration 9 in 2 --
+bool(true)
+-- Inner iteration 10 in 2 --
+bool(true)
+-- Inner iteration 11 in 2 --
+bool(true)
+--- Outer iteration 3 ---
+bool(true)
+-- Inner iteration 0 in 3 --
+bool(true)
+-- Inner iteration 1 in 3 --
+bool(true)
+-- Inner iteration 2 in 3 --
+bool(true)
+-- Inner iteration 3 in 3 --
+bool(true)
+-- Inner iteration 4 in 3 --
+bool(true)
+-- Inner iteration 5 in 3 --
+bool(true)
+-- Inner iteration 6 in 3 --
+bool(true)
+-- Inner iteration 7 in 3 --
+bool(true)
+-- Inner iteration 8 in 3 --
+bool(true)
+-- Inner iteration 9 in 3 --
+bool(true)
+-- Inner iteration 10 in 3 --
+bool(true)
+-- Inner iteration 11 in 3 --
+bool(true)
+--- Outer iteration 4 ---
+bool(true)
+-- Inner iteration 0 in 4 --
+bool(true)
+-- Inner iteration 1 in 4 --
+bool(true)
+-- Inner iteration 2 in 4 --
+bool(true)
+-- Inner iteration 3 in 4 --
+bool(true)
+-- Inner iteration 4 in 4 --
+bool(true)
+-- Inner iteration 5 in 4 --
+bool(true)
+-- Inner iteration 6 in 4 --
+bool(true)
+-- Inner iteration 7 in 4 --
+bool(true)
+-- Inner iteration 8 in 4 --
+bool(true)
+-- Inner iteration 9 in 4 --
+bool(true)
+-- Inner iteration 10 in 4 --
+bool(true)
+-- Inner iteration 11 in 4 --
+bool(true)
+--- Outer iteration 5 ---
+bool(true)
+-- Inner iteration 0 in 5 --
+bool(true)
+-- Inner iteration 1 in 5 --
+bool(true)
+-- Inner iteration 2 in 5 --
+bool(true)
+-- Inner iteration 3 in 5 --
+bool(true)
+-- Inner iteration 4 in 5 --
+bool(true)
+-- Inner iteration 5 in 5 --
+bool(true)
+-- Inner iteration 6 in 5 --
+bool(true)
+-- Inner iteration 7 in 5 --
+bool(true)
+-- Inner iteration 8 in 5 --
+bool(true)
+-- Inner iteration 9 in 5 --
+bool(true)
+-- Inner iteration 10 in 5 --
+bool(true)
+-- Inner iteration 11 in 5 --
+bool(true)
+--- Outer iteration 6 ---
+bool(true)
+-- Inner iteration 0 in 6 --
+bool(true)
+-- Inner iteration 1 in 6 --
+bool(true)
+-- Inner iteration 2 in 6 --
+bool(true)
+-- Inner iteration 3 in 6 --
+bool(true)
+-- Inner iteration 4 in 6 --
+bool(true)
+-- Inner iteration 5 in 6 --
+bool(true)
+-- Inner iteration 6 in 6 --
+bool(true)
+-- Inner iteration 7 in 6 --
+bool(true)
+-- Inner iteration 8 in 6 --
+bool(true)
+-- Inner iteration 9 in 6 --
+bool(true)
+-- Inner iteration 10 in 6 --
+bool(true)
+-- Inner iteration 11 in 6 --
+bool(true)
+--- Outer iteration 7 ---
+bool(true)
+-- Inner iteration 0 in 7 --
+bool(true)
+-- Inner iteration 1 in 7 --
+bool(true)
+-- Inner iteration 2 in 7 --
+bool(true)
+-- Inner iteration 3 in 7 --
+bool(true)
+-- Inner iteration 4 in 7 --
+bool(true)
+-- Inner iteration 5 in 7 --
+bool(true)
+-- Inner iteration 6 in 7 --
+bool(true)
+-- Inner iteration 7 in 7 --
+bool(true)
+-- Inner iteration 8 in 7 --
+bool(true)
+-- Inner iteration 9 in 7 --
+bool(true)
+-- Inner iteration 10 in 7 --
+bool(true)
+-- Inner iteration 11 in 7 --
+bool(true)
+--- Outer iteration 8 ---
+bool(true)
+-- Inner iteration 0 in 8 --
+bool(true)
+-- Inner iteration 1 in 8 --
+bool(true)
+-- Inner iteration 2 in 8 --
+bool(true)
+-- Inner iteration 3 in 8 --
+bool(true)
+-- Inner iteration 4 in 8 --
+bool(true)
+-- Inner iteration 5 in 8 --
+bool(true)
+-- Inner iteration 6 in 8 --
+bool(true)
+-- Inner iteration 7 in 8 --
+bool(true)
+-- Inner iteration 8 in 8 --
+bool(true)
+-- Inner iteration 9 in 8 --
+bool(true)
+-- Inner iteration 10 in 8 --
+bool(true)
+-- Inner iteration 11 in 8 --
+bool(true)
+--- Outer iteration 9 ---
+bool(true)
+-- Inner iteration 0 in 9 --
+bool(true)
+-- Inner iteration 1 in 9 --
+bool(true)
+-- Inner iteration 2 in 9 --
+bool(true)
+-- Inner iteration 3 in 9 --
+bool(true)
+-- Inner iteration 4 in 9 --
+bool(true)
+-- Inner iteration 5 in 9 --
+bool(true)
+-- Inner iteration 6 in 9 --
+bool(true)
+-- Inner iteration 7 in 9 --
+bool(true)
+-- Inner iteration 8 in 9 --
+bool(true)
+-- Inner iteration 9 in 9 --
+bool(true)
+-- Inner iteration 10 in 9 --
+bool(true)
+-- Inner iteration 11 in 9 --
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_basic.phpt b/ext/standard/tests/file/fnmatch_basic.phpt
new file mode 100644
index 000000000..cc68924e4
--- /dev/null
+++ b/ext/standard/tests/file/fnmatch_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test fnmatch() function: Basic functionality
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no fnmatch() on Windows');
+}
+--FILE--
+<?php
+/* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
+ Description: fnmatch() checks if the passed string would match
+ the given shell wildcard pattern.
+*/
+
+echo "*** Testing fnmatch() with file ***\n";
+$file = basename(__FILE__);
+
+var_dump( fnmatch("*.php", $file) );
+var_dump( fnmatch("*.p*p", $file) );
+var_dump( fnmatch("*.p*", $file) );
+var_dump( fnmatch("*", $file) );
+var_dump( fnmatch("**", $file) );
+var_dump( fnmatch("*.phpt", $file) );
+
+echo "*** Testing fnmatch() with other than file ***\n";
+var_dump( fnmatch(100, 100) );
+var_dump( fnmatch("string", "string") );
+var_dump( fnmatch(TRUE, TRUE) );
+var_dump( fnmatch(FALSE, FALSE) );
+var_dump( fnmatch(NULL, NULL) );
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing fnmatch() with file ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+*** Testing fnmatch() with other than file ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_error.phpt b/ext/standard/tests/file/fnmatch_error.phpt
new file mode 100644
index 000000000..2bbff2371
--- /dev/null
+++ b/ext/standard/tests/file/fnmatch_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test fnmatch() function: Error conditions
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no fnmatch() on Windows');
+}
+--FILE--
+<?php
+/* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
+ Description: fnmatch() checks if the passed string would match
+ the given shell wildcard pattern.
+*/
+
+echo "*** Testing error conditions for fnmatch() ***";
+
+/* Invalid arguments */
+var_dump( fnmatch(array(), array()) );
+
+$file_handle = fopen(__FILE__, "r");
+var_dump( fnmatch($file_handle, $file_handle) );
+fclose( $file_handle );
+
+$std_obj = new stdClass();
+var_dump( fnmatch($std_obj, $std_obj) );
+
+
+/* No.of arguments less than expected */
+var_dump( fnmatch("match.txt") );
+var_dump( fnmatch("") );
+
+/* No.of arguments greater than expected */
+var_dump( fnmatch("match.txt", "match.txt", TRUE, 100) );
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing error conditions for fnmatch() ***
+Warning: fnmatch() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: fnmatch() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fnmatch() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Warning: fnmatch() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt
new file mode 100644
index 000000000..c3a3bdd2b
--- /dev/null
+++ b/ext/standard/tests/file/fnmatch_variation.phpt
@@ -0,0 +1,402 @@
+--TEST--
+Test fnmatch() function: Variations
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip no fnmatch() on Windows');
+}
+--FILE--
+<?php
+/* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
+ Description: fnmatch() checks if the passed string would match
+ the given shell wildcard pattern.
+*/
+
+echo "*** Testing fnmatch() with file and various patterns ***\n";
+$file_name = dirname(__FILE__)."/match.tmp";
+
+fopen($file_name, "w");
+
+$pattern_arr = array(
+0 => "*.tmp",
+1 => "match*",
+2 => "mat*",
+3 => "mat*tmp",
+4 => "m*t",
+5 => "ma[pt]ch*",
+6 => "*.t*",
+7 => "***.tmp",
+8 => "match**",
+9 => "*.t*p",
+10 => "",
+11 => "match",
+12 => ".tmp",
+13 => "?match",
+14 => "match?tmp",
+15 => "?tmp",
+16 => "match?",
+17 => "?match?",
+18 => "match.tmp",
+19 => "/match.tmp",
+20 => "/match.tmp/",
+21 => 'match.tmp',
+22 => 'match.tmp\0',
+23 => "match.tmp\0",
+24 => "match\0.tmp",
+25 => chr(109).chr(97)."tch.tmp",
+26 => chr(109).chr(97).chr(116).chr(99).chr(104).".tmp",
+27 => chr(109).chr(97).chr(116).chr(99).chr(104).chr(46).chr(116).chr(120).chr(116),
+28 => chr(109).chr(97).chr(116).chr(99).chr(104).".".chr(116).chr(120).chr(116),
+29 => "MATCH.TMP",
+30 => "MATCH*",
+31 => $file_name
+);
+
+for( $i = 0; $i<count($pattern_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ var_dump( fnmatch($pattern_arr[$i], $file_name) );
+}
+unlink($file_name);
+
+
+echo "\n*** Testing fnmatch() with other types other than files ***";
+
+/* defining a common function */
+function match( $pattern, $string ) {
+ for( $i = 0; $i<count($pattern); $i++ ) {
+ echo "-- Iteration $i --\n";
+ for( $j = 0; $j<count($string); $j++ ) {
+ var_dump( fnmatch($pattern[$i], $string[$j]) );
+ }
+ }
+}
+
+echo "\n--- With Integers ---\n";
+$int_arr = array(
+ 16,
+ 16.00,
+ 020,
+ 020.00,
+ 0xF,
+ 0xF0000
+);
+match($int_arr, $int_arr);
+
+echo "\n--- With Strings ---\n";
+$str_arr = array(
+ "string",
+ "string\0",
+ 'string',
+ "str\0ing",
+ "stringstring"
+);
+match($str_arr, $str_arr);
+
+echo "\n--- With booleans ---\n";
+$bool_arr = array(
+ TRUE,
+ true,
+ 1,
+ 10,
+ FALSE,
+ false,
+ 0,
+ "",
+ "string"
+);
+match($bool_arr, $bool_arr);
+
+echo "\n--- With NULL ---\n";
+$null_arr = array(
+ NULL,
+ null,
+ "",
+ "\0",
+ "string",
+ 0
+);
+match($null_arr, $null_arr);
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing fnmatch() with file and various patterns ***
+-- Iteration 0 --
+bool(true)
+-- 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(true)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(true)
+
+*** Testing fnmatch() with other types other than files ***
+--- With Integers ---
+-- Iteration 0 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+--- With Strings ---
+-- Iteration 0 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+--- With booleans ---
+-- Iteration 0 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+--- With NULL ---
+-- Iteration 0 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+*** Done ***
diff --git a/ext/standard/tests/file/fpassthru_basic.phpt b/ext/standard/tests/file/fpassthru_basic.phpt
new file mode 100644
index 000000000..a6e6612dd
--- /dev/null
+++ b/ext/standard/tests/file/fpassthru_basic.phpt
@@ -0,0 +1,126 @@
+--TEST--
+Test fpassthru() function: Basic functionality
+--FILE--
+<?php
+/*
+Prototype: int fpassthru ( resource $handle );
+Description: Reads to EOF on the given file pointer from the current position
+ and writes the results to the output buffer.
+*/
+
+$file_name = dirname(__FILE__)."/passthru.tmp";
+$write_handle = fopen($file_name, "w");
+
+$string = "Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^
+ Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^\n";
+
+fwrite($write_handle, $string);
+fclose($write_handle);
+
+$read_handle = fopen($file_name, "r");
+
+echo "*** Test basic functionality of fpassthru() function ***\n";
+echo "\n-- Before seek operation --\n";
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 0 --\n";
+fseek($read_handle, 0);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 3 --\n";
+fseek($read_handle, 3);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 13 --\n";
+fseek($read_handle, 13);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 14 --\n";
+fseek($read_handle, 14);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 23 --\n";
+fseek($read_handle, 23);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 34 --\n";
+fseek($read_handle, 34);
+var_dump( fpassthru($read_handle) );
+
+echo "\n-- After seeking position to 1000 --\n";
+fseek($read_handle, 1000);
+var_dump( fpassthru($read_handle) );
+
+fclose($read_handle);
+
+echo "*** Done ***\n";
+
+?>
+--CLEAN--
+<?php
+unlink(dirname(__FILE__)."/passthru.tmp");
+?>
+--EXPECTF--
+*** Test basic functionality of fpassthru() function ***
+
+-- Before seek operation --
+Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(133)
+
+-- After seeking position to 0 --
+Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(133)
+
+-- After seeking position to 3 --
+lo, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(130)
+
+-- After seeking position to 13 --
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(120)
+
+-- After seeking position to 14 --
+ abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(119)
+
+-- After seeking position to 23 --
+adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(110)
+
+-- After seeking position to 34 --
+2394723947 $%$%#$%#$%#^#%^
+ Hello, world
+, abcdefg adsdsfdf
+8u2394723947 $%$%#$%#$%#^#%^
+int(99)
+
+-- After seeking position to 1000 --
+int(0)
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/file/fpassthru_error.phpt b/ext/standard/tests/file/fpassthru_error.phpt
new file mode 100644
index 000000000..68e2e46cd
--- /dev/null
+++ b/ext/standard/tests/file/fpassthru_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test fpassthru() function: Error conditions
+--FILE--
+<?php
+/*
+Prototype: int fpassthru ( resource $handle );
+Description: Reads to EOF on the given file pointer from the current position
+ and writes the results to the output buffer.
+*/
+
+echo "*** Test error conditions of fpassthru() function ***\n";
+
+/* Non-existing file resource */
+$no_file = fread("/no/such/file", "r");
+var_dump( fpassthru($no_file) );
+
+/* No.of args less than expected */
+var_dump( fpassthru() );
+
+/* No.of args greaer than expected */
+var_dump( fpassthru("", "") );
+
+echo "\n*** Done ***\n";
+
+?>
+--EXPECTF--
+*** Test error conditions of fpassthru() function ***
+
+Warning: fread(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for fpassthru() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for fpassthru() in %s on line %d
+NULL
+
+*** Done ***
diff --git a/ext/standard/tests/file/fpassthru_variation.phpt b/ext/standard/tests/file/fpassthru_variation.phpt
new file mode 100644
index 000000000..56a039e62
--- /dev/null
+++ b/ext/standard/tests/file/fpassthru_variation.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test fpassthru() function: Variations
+--FILE--
+<?php
+/*
+Prototype: int fpassthru ( resource $handle );
+Description: Reads to EOF on the given file pointer from the current position
+ and writes the results to the output buffer.
+*/
+
+echo "*** Testing fpassthru() function with files ***\n\n";
+
+echo "--- Testing with different offsets ---\n";
+
+$file_name = dirname(__FILE__)."/passthru.tmp";
+$file_write = fopen($file_name, "w");
+fwrite($file_write, "1234567890abcdefghijklmnopqrstuvwxyz");
+fclose($file_write);
+
+$file_read = fopen($file_name, "r");
+
+$offset_arr = array(
+ /* Positive offsets */
+ 0,
+ 1,
+ 5,
+ 10,
+ 20,
+ 30,
+ 35,
+ 36,
+ 70,
+ /* Negative offsets, the file pointer should be at the end of file
+ to get data */
+ -1,
+ -5,
+ -10,
+ -20,
+ -35,
+ -36,
+ -70
+);
+
+for( $i=0; $i<count($offset_arr); $i++ ) {
+ echo "-- Iteration $i --\n";
+ if( $offset_arr[$i] >= 0 ) {
+ fseek($file_read, $offset_arr[$i], SEEK_SET);
+ var_dump(fpassthru($file_read) );
+ rewind( $file_read );
+ }else
+ {
+ fseek($file_read, $offset_arr[$i], SEEK_END);
+ var_dump( fpassthru($file_read) );
+ rewind( $file_read );
+ }
+}
+
+fclose($file_read); // closing the handle
+
+echo "\n--- Testing with binary mode file ---\n";
+/* Opening the file in binary read mode */
+$file_read = fopen($file_name, "rb");
+
+fseek($file_read, 12, SEEK_SET);
+var_dump(fpassthru($file_read) );
+rewind( $file_read );
+fclose($file_read);
+
+unlink($file_name);
+
+echo "\n*** Done ***\n";
+
+?>
+--EXPECTF--
+*** Testing fpassthru() function with files ***
+
+--- Testing with different offsets ---
+-- Iteration 0 --
+1234567890abcdefghijklmnopqrstuvwxyzint(36)
+-- Iteration 1 --
+234567890abcdefghijklmnopqrstuvwxyzint(35)
+-- Iteration 2 --
+67890abcdefghijklmnopqrstuvwxyzint(31)
+-- Iteration 3 --
+abcdefghijklmnopqrstuvwxyzint(26)
+-- Iteration 4 --
+klmnopqrstuvwxyzint(16)
+-- Iteration 5 --
+uvwxyzint(6)
+-- Iteration 6 --
+zint(1)
+-- Iteration 7 --
+int(0)
+-- Iteration 8 --
+int(0)
+-- Iteration 9 --
+zint(1)
+-- Iteration 10 --
+vwxyzint(5)
+-- Iteration 11 --
+qrstuvwxyzint(10)
+-- Iteration 12 --
+ghijklmnopqrstuvwxyzint(20)
+-- Iteration 13 --
+234567890abcdefghijklmnopqrstuvwxyzint(35)
+-- Iteration 14 --
+1234567890abcdefghijklmnopqrstuvwxyzint(36)
+-- Iteration 15 --
+1234567890abcdefghijklmnopqrstuvwxyzint(36)
+
+--- Testing with binary mode file ---
+cdefghijklmnopqrstuvwxyzint(24)
+
+*** Done ***
diff --git a/ext/standard/tests/general_functions/bug34794.phpt b/ext/standard/tests/general_functions/bug34794.phpt
index 3aacf7e51..1b25bc28c 100644
--- a/ext/standard/tests/general_functions/bug34794.phpt
+++ b/ext/standard/tests/general_functions/bug34794.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #34794: proc_close() hangs when used with two processes
+Bug #34794 (proc_close() hangs when used with two processes)
--SKIPIF--
<?php
if (!is_executable('/bin/cat')) echo 'skip cat not found';
diff --git a/ext/standard/tests/general_functions/bug39322.phpt b/ext/standard/tests/general_functions/bug39322.phpt
index cb3459995..6ba740dc8 100644
--- a/ext/standard/tests/general_functions/bug39322.phpt
+++ b/ext/standard/tests/general_functions/bug39322.phpt
@@ -1,5 +1,5 @@
--TEST--
-bug #39322: proc_terminate() loosing process resource
+Bug #39322 (proc_terminate() loosing process resource)
--SKIPIF--
<?php
if (!is_executable('/bin/sleep')) echo 'skip sleep not found';
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt
new file mode 100644
index 000000000..7cadd2c62
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt
Binary files differ
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt
new file mode 100644
index 000000000..b6b1d1cd1
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt
Binary files differ
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_e.phpt b/ext/standard/tests/general_functions/debug_zval_dump_e.phpt
new file mode 100644
index 000000000..7b306978d
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_e.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test debug_zval_dump() function : error conditions
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value
+ to output.
+*/
+
+echo "*** Testing error conditions ***\n";
+
+/* passing zero argument */
+debug_zval_dump();
+
+echo "Done\n";
+
+?>
+
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for debug_zval_dump() in %s on line %d
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
new file mode 100644
index 000000000..e85494e7b
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
@@ -0,0 +1,839 @@
+--TEST--
+Test debug_zval_dump() function : working on objects
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value to output.
+*/
+
+/* Prototype: void zval_dump( $value );
+ Description: use debug_zval_dump() to display the objects and its
+ reference count */
+function zval_dump( $values ) {
+ $counter = 1;
+ foreach( $values as $value ) {
+ echo "-- Iteration $counter --\n";
+ debug_zval_dump( $value );
+ $counter++;
+ }
+}
+
+/* checking on objects type */
+echo "*** Testing debug_zval_dump() on objects ***\n";
+class object_class {
+ var $value1 = 1;
+ private $value2 = 10;
+ protected $value3 = 20;
+ public $value4 = 30;
+
+ private function foo1() {
+ echo "function foo1\n";
+ }
+ protected function foo2() {
+ echo "function foo2\n";
+ }
+ public function foo3() {
+ echo "function foo3\n";
+ }
+ public $array_var = array( "key1" => 1, "key2 " => 3);
+
+ function object_class () {
+ $this->value1 = 5;
+ $this->object_class1 = $this;
+ }
+}
+
+class no_member_class{
+//no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ protected $p1 = 40;
+ private $p2 = 50;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* creating new object $obj */
+$obj = new contains_object_class();
+$obj1 = & $obj; //object $obj1 references object $obj
+$obj2 = & $obj;
+$obj3 = & $obj2;
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ @$temp_class_obj, //undefined object
+ $obj2->class_object1,
+ $obj3->class_object2,
+ $obj2->class_object1->value4,
+ @$unset_obj
+);
+/* using zval_dump() to dump out the objects and its reference count */
+zval_dump($objects);
+
+$int_var = 500;
+$obj = $int_var; //$obj is lost, $obj1,$obj2,$obj3,$obj4 = 500
+echo "\n-- Testing debug_zval_dump() on overwritten object variables --\n";
+debug_zval_dump($obj, $obj1, $obj2, $obj3);
+
+echo "\n-- Testing debug_zval_dump() on objects having circular reference --\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+debug_zval_dump($recursion_obj2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing debug_zval_dump() on objects ***
+-- Iteration 1 --
+object(object_class)#%d (6) refcount(4){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(4){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 2 --
+object(no_member_class)#%d (0) refcount(3){
+}
+-- Iteration 3 --
+object(contains_object_class)#%d (9) refcount(3){
+ ["p"]=>
+ long(30) refcount(2)
+ ["p1:protected"]=>
+ long(40) refcount(2)
+ ["p2:private"]=>
+ long(50) refcount(2)
+ ["class_object1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) refcount(2){
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#%d (9) refcount(1){
+ ["p"]=>
+ long(30) refcount(2)
+ ["p1:protected"]=>
+ long(40) refcount(2)
+ ["p2:private"]=>
+ long(50) refcount(2)
+ ["class_object1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) refcount(2){
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 4 --
+object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 5 --
+object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 6 --
+object(no_member_class)#%d (0) refcount(4){
+}
+-- Iteration 7 --
+NULL refcount(1)
+-- Iteration 8 --
+object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 9 --
+object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(5)
+ ["value3:protected"]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(6)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 10 --
+long(30) refcount(8)
+-- Iteration 11 --
+NULL refcount(1)
+
+-- Testing debug_zval_dump() on overwritten object variables --
+long(500) refcount(1)
+long(500) refcount(1)
+long(500) refcount(1)
+long(500) refcount(1)
+
+-- Testing debug_zval_dump() on objects having circular reference --
+object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2:private"]=>
+ long(10) refcount(7)
+ ["value3:protected"]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
new file mode 100644
index 000000000..a01e59262
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test debug_zval_dump() function : usage variations
+--INI--
+allow_call_time_pass_reference=1
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value
+ to output.
+*/
+
+echo "*** Testing debug_zval_dump() on functions ***\n";
+echo "--- Variation 1: global variable inside a function ---\n";
+$global_var = 10; //declaring global variable
+
+/* function to dump reference count of global variable,$global_var
+ and local variable,$local_var */
+function dump_globalvar( &$local_var ) {
+ global $global_var;
+ echo "\n-- Value of local variable inside dump_globalvar() --\n";
+ debug_zval_dump( $local_var );
+ echo "\n-- Value of global variable inside dump_globalvar() --\n";
+ debug_zval_dump( $global_var );
+}
+/* dump value and reference count of $global_var using debug_zval_dump() */
+echo "\n-- Value of global variable, before calling dump_globalvar() --\n";
+debug_zval_dump( $global_var );
+
+/* calling function dump_globalvar() to check the reference count of local
+ and global variables inside the function */
+dump_globalvar( $global_var );
+
+/* dump value and reference count of $global_var after exiting function
+ dump_globalvar();
+ expected: reference count of $global_var should remain the same as
+ before calling dump_globalvar() function */
+echo "\n-- Value of global variable, after exiting dump_globalvar() --\n";
+debug_zval_dump( $global_var );
+
+echo "\n--- Variation 2: one variable references another ---\n";
+$first_var = 10;
+/* dump value and reference count of $first_var */
+echo "\n-- Value of \$first_var: --\n";
+debug_zval_dump($first_var);
+
+/* $ref_first_var references $first_var */
+$ref_first_var = &$var_1;
+
+echo "\n-- Value of \$ref_first_var --\n";
+debug_zval_dump($ref_first_var);
+echo "\n-- Value of \$first_var --\n";
+debug_zval_dump($first_var);
+
+unset($ref_first_var);
+
+/* dump value and reference count of $first_var, $ref_first_var
+ here $ref_first_var is unset */
+echo "\n-- Value of \$ref_first_var --\n";
+debug_zval_dump($ref_first_var);
+echo "\n-- Value of \$first_var --\n";
+debug_zval_dump($first_var);
+
+echo "\n--- Variation 3: multiple references of variables ---\n";
+$var_1 = 10;
+$var_2 = &$var_1;
+$var_3 = &$var_2;
+echo "\n-- Value of \$var_1: (before referencing) --\n";
+debug_zval_dump($var_1);
+echo "\n-- Value of \$var_2: (referencing var_1) --\n";
+debug_zval_dump($var_2);
+echo "\n-- Value of \$var_3: (referencing var_2) --\n";
+debug_zval_dump($var_3);
+
+/* unsetting $var_3 */
+unset($var_3);
+echo "\n-- Value of \$var_3: (after unsetting var_3) --\n";
+debug_zval_dump($var_3);
+echo "\n-- Value of \$var_2: --\n";
+debug_zval_dump($var_2);
+echo "\n-- Value of \$var_3: --\n";
+debug_zval_dump($var_1);
+
+/* unsetting $var_1 */
+unset($var_1);
+echo "\n-- Value of \$var_1: (after unsetting variable_1) --\n";
+debug_zval_dump($var_1);
+echo "\n-- Value of \$var_2: --\n";
+debug_zval_dump($var_2);
+
+echo "\n*** Testing debug_zval_dump() on miscelleneous input arguments ***\n";
+/* unset a variable */
+$unset_var = 10.5;
+unset($unset_var);
+
+$misc_values = array (
+ /* nulls */
+ NULL,
+ null,
+
+ /* unset variable */
+ @$unset_var,
+
+ /* undefined variable */
+ @$undef_var,
+
+ /* mixed types */
+ @TRUE123,
+ "123string",
+ "string123",
+ "NULLstring"
+);
+/* loop to display the variables and its reference count using
+ debug_zval_dump() */
+$counter = 1;
+foreach( $misc_values as $value ) {
+ echo "-- Iteration $counter --\n";
+ debug_zval_dump( $value );
+ debug_zval_dump( &$value );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+
+--EXPECTF--
+*** Testing debug_zval_dump() on functions ***
+--- Variation 1: global variable inside a function ---
+
+-- Value of global variable, before calling dump_globalvar() --
+long(10) refcount(2)
+
+-- Value of local variable inside dump_globalvar() --
+long(10) refcount(1)
+
+-- Value of global variable inside dump_globalvar() --
+long(10) refcount(1)
+
+-- Value of global variable, after exiting dump_globalvar() --
+long(10) refcount(2)
+
+--- Variation 2: one variable references another ---
+
+-- Value of $first_var: --
+long(10) refcount(2)
+
+-- Value of $ref_first_var --
+NULL refcount(1)
+
+-- Value of $first_var --
+long(10) refcount(2)
+
+-- Value of $ref_first_var --
+
+Notice: Undefined variable: ref_first_var in %s on line %d
+NULL refcount(1)
+
+-- Value of $first_var --
+long(10) refcount(2)
+
+--- Variation 3: multiple references of variables ---
+
+-- Value of $var_1: (before referencing) --
+long(10) refcount(1)
+
+-- Value of $var_2: (referencing var_1) --
+long(10) refcount(1)
+
+-- Value of $var_3: (referencing var_2) --
+long(10) refcount(1)
+
+-- Value of $var_3: (after unsetting var_3) --
+
+Notice: Undefined variable: var_3 in %s on line %d
+NULL refcount(1)
+
+-- Value of $var_2: --
+long(10) refcount(1)
+
+-- Value of $var_3: --
+long(10) refcount(1)
+
+-- Value of $var_1: (after unsetting variable_1) --
+
+Notice: Undefined variable: var_1 in %s on line %d
+NULL refcount(1)
+
+-- Value of $var_2: --
+long(10) refcount(2)
+
+*** Testing debug_zval_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL refcount(3)
+&NULL refcount(2)
+-- Iteration 2 --
+NULL refcount(3)
+&NULL refcount(2)
+-- Iteration 3 --
+NULL refcount(1)
+&NULL refcount(2)
+-- Iteration 4 --
+NULL refcount(1)
+&NULL refcount(2)
+-- Iteration 5 --
+string(7) "TRUE123" refcount(3)
+&string(7) "TRUE123" refcount(2)
+-- Iteration 6 --
+string(9) "123string" refcount(3)
+&string(9) "123string" refcount(2)
+-- Iteration 7 --
+string(9) "string123" refcount(3)
+&string(9) "string123" refcount(2)
+-- Iteration 8 --
+string(10) "NULLstring" refcount(3)
+&string(10) "NULLstring" refcount(2)
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
new file mode 100644
index 000000000..d6fb0d495
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
@@ -0,0 +1,906 @@
+--TEST--
+Test gettype() & settype() functions : basic functionalities
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test the basic functionalities of settype() & gettype() functions.
+ Use the gettype() to get the type of regular data and use settype()
+ to change its type to other types */
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+echo "**** Testing gettype() and settype() functions ****\n";
+
+$fp = fopen(__FILE__, "r");
+$dfp = opendir( dirname(__FILE__) );
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "Object";
+ }
+}
+
+$unset_var = 10;
+unset($unset_var);
+
+$values = array(
+ array(1,2,3),
+ $var1,
+ $var2,
+ 1,
+ -20,
+ 2.54,
+ -2.54,
+ NULL,
+ false,
+ "some string",
+ 'string',
+ $fp,
+ $dfp,
+ new point(10,20)
+);
+
+$types = array(
+ "null",
+ "integer",
+ "int",
+ "float",
+ "double",
+ "boolean",
+ "bool",
+ "resource",
+ "array",
+ "object",
+ "string"
+);
+
+echo "\n*** Testing gettype(): basic operations ***\n";
+foreach ($values as $value) {
+ var_dump( gettype($value) );
+}
+
+echo "\n*** Testing settype(): basic operations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $loop_count = 1;
+ foreach ($values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count ++;
+ // set to new type
+ var_dump( settype($var, $type) );
+
+ // dump the var
+ var_dump( $var );
+
+ // check the new type
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+**** Testing gettype() and settype() functions ****
+
+*** Testing gettype(): basic operations ***
+string(5) "array"
+string(6) "string"
+string(5) "array"
+string(7) "integer"
+string(7) "integer"
+string(6) "double"
+string(6) "double"
+string(4) "NULL"
+string(7) "boolean"
+string(6) "string"
+string(6) "string"
+string(8) "resource"
+string(8) "resource"
+string(6) "object"
+
+*** Testing settype(): basic operations ***
+
+-- Setting type of data to null --
+-- Iteration 1 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 3 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 4 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 5 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 6 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 7 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 8 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 10 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 11 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 12 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 13 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 14 --
+bool(true)
+NULL
+string(4) "NULL"
+
+-- Setting type of data to integer --
+-- Iteration 1 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 2 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+bool(true)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+bool(true)
+int(2)
+string(7) "integer"
+-- Iteration 7 --
+bool(true)
+int(-2)
+string(7) "integer"
+-- Iteration 8 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+bool(true)
+int(5)
+string(7) "integer"
+-- Iteration 13 --
+bool(true)
+int(6)
+string(7) "integer"
+-- Iteration 14 --
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+
+-- Setting type of data to int --
+-- Iteration 1 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 2 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+bool(true)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+bool(true)
+int(2)
+string(7) "integer"
+-- Iteration 7 --
+bool(true)
+int(-2)
+string(7) "integer"
+-- Iteration 8 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+bool(true)
+int(5)
+string(7) "integer"
+-- Iteration 13 --
+bool(true)
+int(6)
+string(7) "integer"
+-- Iteration 14 --
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+
+-- Setting type of data to float --
+-- Iteration 1 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 2 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+bool(true)
+float(-20)
+string(6) "double"
+-- Iteration 6 --
+bool(true)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+bool(true)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+bool(true)
+float(5)
+string(6) "double"
+-- Iteration 13 --
+bool(true)
+float(6)
+string(6) "double"
+-- Iteration 14 --
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+
+-- Setting type of data to double --
+-- Iteration 1 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 2 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+bool(true)
+float(-20)
+string(6) "double"
+-- Iteration 6 --
+bool(true)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+bool(true)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+bool(true)
+float(5)
+string(6) "double"
+-- Iteration 13 --
+bool(true)
+float(6)
+string(6) "double"
+-- Iteration 14 --
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+
+-- Setting type of data to boolean --
+-- Iteration 1 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 2 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 3 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 13 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 14 --
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to bool --
+-- Iteration 1 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 2 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 3 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 13 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 14 --
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to resource --
+-- Iteration 1 --
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(5) "array"
+-- Iteration 2 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(14) "another string"
+string(6) "string"
+-- Iteration 3 --
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 4 --
+2: settype(): Cannot convert to resource type
+bool(false)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+2: settype(): Cannot convert to resource type
+bool(false)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(11) "some string"
+string(6) "string"
+-- Iteration 11 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(6) "string"
+string(6) "string"
+-- Iteration 12 --
+2: settype(): Cannot convert to resource type
+bool(false)
+resource(5) of type (stream)
+string(8) "resource"
+-- Iteration 13 --
+2: settype(): Cannot convert to resource type
+bool(false)
+resource(6) of type (stream)
+string(8) "resource"
+-- Iteration 14 --
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#1 (2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(6) "object"
+
+-- Setting type of data to array --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(5) "array"
+-- Iteration 2 --
+bool(true)
+array(1) {
+ [0]=>
+ string(14) "another string"
+}
+string(5) "array"
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 4 --
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+string(5) "array"
+-- Iteration 5 --
+bool(true)
+array(1) {
+ [0]=>
+ int(-20)
+}
+string(5) "array"
+-- Iteration 6 --
+bool(true)
+array(1) {
+ [0]=>
+ float(2.54)
+}
+string(5) "array"
+-- Iteration 7 --
+bool(true)
+array(1) {
+ [0]=>
+ float(-2.54)
+}
+string(5) "array"
+-- Iteration 8 --
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 9 --
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+string(5) "array"
+-- Iteration 10 --
+bool(true)
+array(1) {
+ [0]=>
+ string(11) "some string"
+}
+string(5) "array"
+-- Iteration 11 --
+bool(true)
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+string(5) "array"
+-- Iteration 12 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(5) of type (stream)
+}
+string(5) "array"
+-- Iteration 13 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(6) of type (stream)
+}
+string(5) "array"
+-- Iteration 14 --
+bool(true)
+array(2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(5) "array"
+
+-- Setting type of data to object --
+-- Iteration 1 --
+bool(true)
+object(stdClass)#2 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(6) "object"
+-- Iteration 2 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(14) "another string"
+}
+string(6) "object"
+-- Iteration 3 --
+bool(true)
+object(stdClass)#2 (3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 4 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ int(1)
+}
+string(6) "object"
+-- Iteration 5 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ int(-20)
+}
+string(6) "object"
+-- Iteration 6 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ float(2.54)
+}
+string(6) "object"
+-- Iteration 7 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ float(-2.54)
+}
+string(6) "object"
+-- Iteration 8 --
+bool(true)
+object(stdClass)#2 (0) {
+}
+string(6) "object"
+-- Iteration 9 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ bool(false)
+}
+string(6) "object"
+-- Iteration 10 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(11) "some string"
+}
+string(6) "object"
+-- Iteration 11 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(6) "string"
+}
+string(6) "object"
+-- Iteration 12 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ resource(5) of type (stream)
+}
+string(6) "object"
+-- Iteration 13 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ resource(6) of type (stream)
+}
+string(6) "object"
+-- Iteration 14 --
+bool(true)
+object(point)#1 (2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(6) "object"
+
+-- Setting type of data to string --
+-- Iteration 1 --
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 2 --
+bool(true)
+string(14) "another string"
+string(6) "string"
+-- Iteration 3 --
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 4 --
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 5 --
+bool(true)
+string(3) "-20"
+string(6) "string"
+-- Iteration 6 --
+bool(true)
+string(4) "2.54"
+string(6) "string"
+-- Iteration 7 --
+bool(true)
+string(5) "-2.54"
+string(6) "string"
+-- Iteration 8 --
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+bool(true)
+string(11) "some string"
+string(6) "string"
+-- Iteration 11 --
+bool(true)
+string(6) "string"
+string(6) "string"
+-- Iteration 12 --
+bool(true)
+string(14) "Resource id #5"
+string(6) "string"
+-- Iteration 13 --
+bool(true)
+string(14) "Resource id #6"
+string(6) "string"
+-- Iteration 14 --
+bool(true)
+string(6) "Object"
+string(6) "string"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt
new file mode 100644
index 000000000..3a61842da
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test gettype() & settype() functions : error conditions
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test different error conditions of settype() and gettype() functions */
+
+echo "**** Testing gettype() and settype() functions ****\n";
+
+echo "\n*** Testing gettype(): error conditions ***\n";
+//Zero arguments
+var_dump( gettype() );
+// args more than expected
+var_dump( gettype( "1", "2" ) );
+
+echo "\n*** Testing settype(): error conditions ***\n";
+//Zero arguments
+var_dump( settype() );
+
+// args more than expected
+$var = 10.5;
+var_dump( settype( $var, $var, "int" ) );
+
+// passing an invalid type to set
+var_dump( settype( $var, "unknown" ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+**** Testing gettype() and settype() functions ****
+
+*** Testing gettype(): error conditions ***
+
+Warning: Wrong parameter count for gettype() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gettype() in %s on line %d
+NULL
+
+*** Testing settype(): error conditions ***
+
+Warning: Wrong parameter count for settype() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for settype() in %s on line %d
+NULL
+
+Warning: settype(): Invalid type in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
new file mode 100644
index 000000000..b8834d514
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
@@ -0,0 +1,589 @@
+--TEST--
+Test gettype() & settype() functions : usage variatoins
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to null type.
+ Set type of the data to "null" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to "null type"
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to null type */
+$type = "null";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to null --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
new file mode 100644
index 000000000..0f0f3e8b4
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
@@ -0,0 +1,1002 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to int/integer type.
+ Set type of the data to "int"/"integer" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to interger/int type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+// test conversion to these types
+$types = array(
+ "integer",
+ "int"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to integer --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+int(3)
+string(7) "integer"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+int(-2147483648)
+string(7) "integer"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+int(-2147483647)
+string(7) "integer"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+int(-508130303)
+string(7) "integer"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+int(1952002105)
+string(7) "integer"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+int(343000682)
+string(7) "integer"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+
+-- Setting type of data to int --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+int(3)
+string(7) "integer"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+int(-2147483648)
+string(7) "integer"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+int(-2147483647)
+string(7) "integer"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+int(-508130303)
+string(7) "integer"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+int(1952002105)
+string(7) "integer"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+int(343000682)
+string(7) "integer"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
new file mode 100644
index 000000000..35066b0ea
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
@@ -0,0 +1,1002 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to float/double type.
+ Set type of the data to "float"/"double" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to float/double type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+// test conversion to these types
+$types = array(
+ "float",
+ "double"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to float --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+float(3)
+string(6) "double"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+float(2147483647)
+string(6) "double"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+float(85)
+string(6) "double"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+float(-21903)
+string(6) "double"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+float(365)
+string(6) "double"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+float(-365)
+string(6) "double"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+
+-- Setting type of data to double --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+float(3)
+string(6) "double"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+float(2147483647)
+string(6) "double"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+float(85)
+string(6) "double"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+float(-21903)
+string(6) "double"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+float(365)
+string(6) "double"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+float(-365)
+string(6) "double"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
new file mode 100644
index 000000000..8b93e63c2
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
@@ -0,0 +1,1201 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to bool/boolean type.
+ Set type of the data to "bool"/"boolean" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to bool/boolean type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+class class_with_no_member {
+ // no member(s)
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ '0',
+
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ 0,
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 0.0,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+ new class_with_no_member,
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var,
+
+ /* binary strings */
+ b"0",
+ b'0',
+ b"10string",
+ b'10string',
+ b"+0123",
+ b'-0123',
+ b"0xff",
+ b'0x55',
+ b'1e2',
+ b'2974394749328742328432',
+ b"1e2",
+ b'10string',
+ b"10string"
+);
+
+// test conversion to these types
+$types = array(
+ "boolean",
+ "bool"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to boolean --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 43 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 44 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 48 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 49 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 50 --
+string(7) "integer"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 54 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 56 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 57 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 58 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 59 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 76 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 77 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 78 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 79 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 80 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 81 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 82 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 83 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 84 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 85 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 86 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 87 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 88 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 89 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 90 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 91 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 92 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 93 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 94 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 95 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 96 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 97 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 98 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to bool --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 43 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 44 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 48 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 49 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 50 --
+string(7) "integer"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 54 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 56 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 57 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 58 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 59 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 76 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 77 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 78 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 79 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 80 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 81 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 82 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 83 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 84 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 85 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 86 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 87 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 88 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 89 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 90 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 91 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 92 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 93 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 94 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 95 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 96 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 97 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 98 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
new file mode 100644
index 000000000..c9fa57592
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
@@ -0,0 +1,714 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to resource type.
+ Set type of the data to "resource" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to resource type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to resource type */
+$type = "resource";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to resource --
+-- Iteration 1 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "ÿ"
+string(6) "string"
+-- Iteration 6 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "f"
+string(6) "string"
+-- Iteration 7 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "
+3"
+string(6) "string"
+-- Iteration 8 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) " "
+string(6) "string"
+-- Iteration 11 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) " "
+string(6) "string"
+-- Iteration 12 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "10"
+string(6) "string"
+-- Iteration 13 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "10"
+string(6) "string"
+-- Iteration 14 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "10string"
+string(6) "string"
+-- Iteration 15 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "10string"
+string(6) "string"
+-- Iteration 16 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "1"
+string(6) "string"
+-- Iteration 17 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "-1"
+string(6) "string"
+-- Iteration 18 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 19 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) " 1"
+string(6) "string"
+-- Iteration 20 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 21 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 22 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "1"
+string(6) "string"
+-- Iteration 23 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "-1"
+string(6) "string"
+-- Iteration 24 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 25 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) " 1"
+string(6) "string"
+-- Iteration 26 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 27 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 28 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0xff"
+string(6) "string"
+-- Iteration 29 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0x55"
+string(6) "string"
+-- Iteration 30 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "0XA55"
+string(6) "string"
+-- Iteration 31 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "0X123"
+string(6) "string"
+-- Iteration 32 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0123"
+string(6) "string"
+-- Iteration 33 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0123"
+string(6) "string"
+-- Iteration 34 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 35 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 36 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 37 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 38 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "-0x80001"
+string(6) "string"
+-- Iteration 39 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "+0x80001"
+string(6) "string"
+-- Iteration 40 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(10) "-0x80001.5"
+string(6) "string"
+-- Iteration 41 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(9) "0x80001.5"
+string(6) "string"
+-- Iteration 42 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(12) "@$%#$%^$%^&^"
+string(6) "string"
+-- Iteration 43 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(0) {
+}
+string(5) "array"
+-- Iteration 44 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(1) {
+ [0]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 45 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 46 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 47 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(5) "array"
+-- Iteration 48 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#1 (2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 77 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#2 (2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(6) "object"
+-- Iteration 78 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#3 (2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(6) "object"
+-- Iteration 79 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 80 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
new file mode 100644
index 000000000..0e99630b5
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
@@ -0,0 +1,846 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to array type.
+ Set type of the data to "array" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to array type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to array type */
+$type = "array";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to array --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+string(5) "array"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(true)
+}
+string(5) "array"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(true)
+}
+string(5) "array"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "ÿ"
+}
+string(5) "array"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+string(5) "array"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "
+3"
+}
+string(5) "array"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+string(5) "array"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+string(5) "array"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+string(5) "array"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+string(5) "array"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+string(5) "array"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+string(5) "array"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "10string"
+}
+string(5) "array"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "10string"
+}
+string(5) "array"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+string(5) "array"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+string(5) "array"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(3) "1e2"
+}
+string(5) "array"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) " 1"
+}
+string(5) "array"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(22) "2974394749328742328432"
+}
+string(5) "array"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-1e-2"
+}
+string(5) "array"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+string(5) "array"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+string(5) "array"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(3) "1e2"
+}
+string(5) "array"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) " 1"
+}
+string(5) "array"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(22) "2974394749328742328432"
+}
+string(5) "array"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-1e-2"
+}
+string(5) "array"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0xff"
+}
+string(5) "array"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0x55"
+}
+string(5) "array"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "0XA55"
+}
+string(5) "array"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "0X123"
+}
+string(5) "array"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0123"
+}
+string(5) "array"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0123"
+}
+string(5) "array"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-0123"
+}
+string(5) "array"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "+0123"
+}
+string(5) "array"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-0123"
+}
+string(5) "array"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "+0123"
+}
+string(5) "array"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "-0x80001"
+}
+string(5) "array"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "+0x80001"
+}
+string(5) "array"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(10) "-0x80001.5"
+}
+string(5) "array"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(9) "0x80001.5"
+}
+string(5) "array"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(12) "@$%#$%^$%^&^"
+}
+string(5) "array"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+array(1) {
+ [0]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+array(3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(5) "array"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+string(5) "array"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+string(5) "array"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+string(5) "array"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(1232147483649)
+}
+string(5) "array"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(85)
+}
+string(5) "array"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(1058513956921)
+}
+string(5) "array"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(-21903)
+}
+string(5) "array"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(365)
+}
+string(5) "array"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(-365)
+}
+string(5) "array"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(80561044571754)
+}
+string(5) "array"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(100000)
+}
+string(5) "array"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-100000)
+}
+string(5) "array"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(100000)
+}
+string(5) "array"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-100000)
+}
+string(5) "array"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-1.5)
+}
+string(5) "array"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(0.5)
+}
+string(5) "array"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-0.5)
+}
+string(5) "array"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(500000)
+}
+string(5) "array"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-500000)
+}
+string(5) "array"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-5.0E-7)
+}
+string(5) "array"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(500000)
+}
+string(5) "array"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-500000)
+}
+string(5) "array"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(512000)
+}
+string(5) "array"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-512000)
+}
+string(5) "array"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(5.12E-7)
+}
+string(5) "array"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(5.12E-7)
+}
+string(5) "array"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(512000)
+}
+string(5) "array"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-512000)
+}
+string(5) "array"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(5) "array"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(5) "array"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
new file mode 100644
index 000000000..2da7bb204
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
@@ -0,0 +1,844 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to object type.
+ Set type of the data to "object" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to object type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to object type */
+$type = "object";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to object --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(false)
+}
+string(6) "object"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(true)
+}
+string(6) "object"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(true)
+}
+string(6) "object"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "ÿ"
+}
+string(6) "object"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "f"
+}
+string(6) "object"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "
+3"
+}
+string(6) "object"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(0) ""
+}
+string(6) "object"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(0) ""
+}
+string(6) "object"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) " "
+}
+string(6) "object"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) " "
+}
+string(6) "object"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "10"
+}
+string(6) "object"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "10"
+}
+string(6) "object"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "10string"
+}
+string(6) "object"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "10string"
+}
+string(6) "object"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "1"
+}
+string(6) "object"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "-1"
+}
+string(6) "object"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(3) "1e2"
+}
+string(6) "object"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) " 1"
+}
+string(6) "object"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(22) "2974394749328742328432"
+}
+string(6) "object"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-1e-2"
+}
+string(6) "object"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "1"
+}
+string(6) "object"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "-1"
+}
+string(6) "object"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(3) "1e2"
+}
+string(6) "object"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) " 1"
+}
+string(6) "object"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(22) "2974394749328742328432"
+}
+string(6) "object"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-1e-2"
+}
+string(6) "object"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0xff"
+}
+string(6) "object"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0x55"
+}
+string(6) "object"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "0XA55"
+}
+string(6) "object"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "0X123"
+}
+string(6) "object"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0123"
+}
+string(6) "object"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0123"
+}
+string(6) "object"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-0123"
+}
+string(6) "object"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "+0123"
+}
+string(6) "object"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-0123"
+}
+string(6) "object"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "+0123"
+}
+string(6) "object"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "-0x80001"
+}
+string(6) "object"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "+0x80001"
+}
+string(6) "object"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(10) "-0x80001.5"
+}
+string(6) "object"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(9) "0x80001.5"
+}
+string(6) "object"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(12) "@$%#$%^$%^&^"
+}
+string(6) "object"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (1) {
+ [0]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(6) "object"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-2147483648)
+}
+string(6) "object"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(2147483647)
+}
+string(6) "object"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(2147483649)
+}
+string(6) "object"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(1232147483649)
+}
+string(6) "object"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(85)
+}
+string(6) "object"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(1058513956921)
+}
+string(6) "object"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(-21903)
+}
+string(6) "object"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(365)
+}
+string(6) "object"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(-365)
+}
+string(6) "object"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(80561044571754)
+}
+string(6) "object"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(100000)
+}
+string(6) "object"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-100000)
+}
+string(6) "object"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(100000)
+}
+string(6) "object"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-100000)
+}
+string(6) "object"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-1.5)
+}
+string(6) "object"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(0.5)
+}
+string(6) "object"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-0.5)
+}
+string(6) "object"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(500000)
+}
+string(6) "object"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-500000)
+}
+string(6) "object"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-5.0E-7)
+}
+string(6) "object"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(500000)
+}
+string(6) "object"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-500000)
+}
+string(6) "object"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(512000)
+}
+string(6) "object"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-512000)
+}
+string(6) "object"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(5.12E-7)
+}
+string(6) "object"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(5.12E-7)
+}
+string(6) "object"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(512000)
+}
+string(6) "object"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-512000)
+}
+string(6) "object"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+object(point)#1 (2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+object(point)#2 (2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(6) "object"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+object(point)#3 (2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(6) "object"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
new file mode 100644
index 000000000..54fb9c145
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
@@ -0,0 +1,595 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to string type.
+ Set type of the data to "string" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to string type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to string type */
+$type = "string";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to string --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+string(1) "ÿ"
+string(6) "string"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+string(1) "f"
+string(6) "string"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+string(2) "
+3"
+string(6) "string"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+string(1) " "
+string(6) "string"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+string(1) " "
+string(6) "string"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+string(2) "10"
+string(6) "string"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+string(2) "10"
+string(6) "string"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+string(8) "10string"
+string(6) "string"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+string(8) "10string"
+string(6) "string"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+string(2) "-1"
+string(6) "string"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+string(2) " 1"
+string(6) "string"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+string(2) "-1"
+string(6) "string"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+string(2) " 1"
+string(6) "string"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+string(4) "0xff"
+string(6) "string"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+string(4) "0x55"
+string(6) "string"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+string(5) "0XA55"
+string(6) "string"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+string(5) "0X123"
+string(6) "string"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+string(4) "0123"
+string(6) "string"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+string(4) "0123"
+string(6) "string"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+string(8) "-0x80001"
+string(6) "string"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+string(8) "+0x80001"
+string(6) "string"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+string(10) "-0x80001.5"
+string(6) "string"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+string(9) "0x80001.5"
+string(6) "string"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+string(12) "@$%#$%^$%^&^"
+string(6) "string"
+-- Iteration 43 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 44 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 45 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 46 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 47 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+string(11) "-2147483648"
+string(6) "string"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+string(10) "2147483647"
+string(6) "string"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+string(10) "2147483649"
+string(6) "string"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+string(13) "1232147483649"
+string(6) "string"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+string(2) "85"
+string(6) "string"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+string(13) "1058513956921"
+string(6) "string"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+string(6) "-21903"
+string(6) "string"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+string(3) "365"
+string(6) "string"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+string(4) "-365"
+string(6) "string"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+string(14) "80561044571754"
+string(6) "string"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+string(6) "100000"
+string(6) "string"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+string(7) "-100000"
+string(6) "string"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+string(6) "100000"
+string(6) "string"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+string(7) "-100000"
+string(6) "string"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+string(4) "-1.5"
+string(6) "string"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+string(3) "0.5"
+string(6) "string"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+string(4) "-0.5"
+string(6) "string"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+string(6) "500000"
+string(6) "string"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+string(7) "-500000"
+string(6) "string"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+string(7) "-5.0E-7"
+string(6) "string"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+string(6) "500000"
+string(6) "string"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+string(7) "-500000"
+string(6) "string"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+string(6) "512000"
+string(6) "string"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+string(7) "-512000"
+string(6) "string"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+string(7) "5.12E-7"
+string(6) "string"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+string(7) "5.12E-7"
+string(6) "string"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+string(6) "512000"
+string(6) "string"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+string(7) "-512000"
+string(6) "string"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+Done
diff --git a/ext/standard/tests/general_functions/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt
index 23dc049db..805d240b8 100644
--- a/ext/standard/tests/general_functions/import_request.phpt
+++ b/ext/standard/tests/general_functions/import_request.phpt
@@ -37,7 +37,7 @@ NULL
Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
-Warning: import_request_variables(): Attempted GLOBALS variable overwrite. in %s on line %d
+Warning: import_request_variables(): Attempted GLOBALS variable overwrite in %s on line %d
Warning: import_request_variables(): Numeric key detected - possible security hazard. in %s on line %d
NULL
@@ -50,13 +50,11 @@ NULL
NULL
Notice: Undefined variable: g_ap in %s on line %d
-
-Notice: Undefined variable: g_1 in %s on line %d
string(1) "1"
string(3) "heh"
string(1) "3"
NULL
-NULL
+string(2) "hm"
NULL
string(1) "1"
string(3) "heh"
diff --git a/ext/standard/tests/general_functions/import_request1.phpt b/ext/standard/tests/general_functions/import_request1.phpt
new file mode 100644
index 000000000..cb6df69e0
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request1.phpt
@@ -0,0 +1,99 @@
+--TEST--
+import_request_variables() test (overwrite super-globals)
+--GET--
+GET=0&POST=1&COOKIE=2&FILES=3&REQUEST=4
+--POST--
+GET=5&POST=6&COOKIE=7&FILES=8&REQUEST=9
+--COOKIE--
+GET=10;POST=11;COOKIE=12;FILES=13;REQUEST=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gpc", "_");
+var_dump($_GET, $_POST, $_COOKIE, $_FILES, $_REQUEST);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+array(5) {
+ ["GET"]=>
+ string(1) "0"
+ ["POST"]=>
+ string(1) "1"
+ ["COOKIE"]=>
+ string(1) "2"
+ ["FILES"]=>
+ string(1) "3"
+ ["REQUEST"]=>
+ string(1) "4"
+}
+array(5) {
+ ["GET"]=>
+ string(1) "5"
+ ["POST"]=>
+ string(1) "6"
+ ["COOKIE"]=>
+ string(1) "7"
+ ["FILES"]=>
+ string(1) "8"
+ ["REQUEST"]=>
+ string(1) "9"
+}
+array(5) {
+ ["GET"]=>
+ string(2) "10"
+ ["POST"]=>
+ string(2) "11"
+ ["COOKIE"]=>
+ string(2) "12"
+ ["FILES"]=>
+ string(2) "13"
+ ["REQUEST"]=>
+ string(2) "14"
+}
+array(0) {
+}
+array(5) {
+ ["GET"]=>
+ string(1) "5"
+ ["POST"]=>
+ string(1) "6"
+ ["COOKIE"]=>
+ string(1) "7"
+ ["FILES"]=>
+ string(1) "8"
+ ["REQUEST"]=>
+ string(1) "9"
+}
+Done
diff --git a/ext/standard/tests/general_functions/import_request2.phpt b/ext/standard/tests/general_functions/import_request2.phpt
new file mode 100644
index 000000000..eb278217c
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request2.phpt
@@ -0,0 +1,25 @@
+--TEST--
+import_request_variables() test (numeric keys)
+--GET--
+1=0&2=1&3=2&4=3&5=4
+--POST--
+1=5&2=6&3=7&4=8&5=9
+--COOKIE--
+1=10;2=11;3=12;4=13;5=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gpc", "_");
+var_dump($_1, $_2, $_3, $_4, $_5);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+Done
diff --git a/ext/standard/tests/general_functions/import_request3.phpt b/ext/standard/tests/general_functions/import_request3.phpt
new file mode 100644
index 000000000..a9fba26dd
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request3.phpt
@@ -0,0 +1,25 @@
+--TEST--
+import_request_variables() test (numeric keys, different order)
+--GET--
+1=0&2=1&3=2&4=3&5=4
+--POST--
+1=5&2=6&3=7&4=8&5=9
+--COOKIE--
+1=10;2=11;3=12;4=13;5=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gcp", "_");
+var_dump($_1, $_2, $_3, $_4, $_5);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+Done
diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt
index 6016873fd..4749df9af 100644
--- a/ext/standard/tests/general_functions/ini_get_all.phpt
+++ b/ext/standard/tests/general_functions/ini_get_all.phpt
@@ -1,7 +1,7 @@
--TEST--
ini_get_all() tests
--SKIPIF--
-<?php if (!extension_loaded("pcre")) die("skip"); ?>
+<?php if (!extension_loaded("reflection")) die("skip"); ?>
--FILE--
<?php
diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt
new file mode 100644
index 000000000..998d26034
--- /dev/null
+++ b/ext/standard/tests/general_functions/intval.phpt
@@ -0,0 +1,306 @@
+--TEST--
+Test intval() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: int intval( mixed $var [.int $base] );
+ * Description: Returns the integer value of var, using the specified base for the conversion(the default is base 10).
+ */
+
+echo "*** Testing intval() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ '0',
+ '1',
+ '-1',
+ '-2147483648', // max negative integer value
+ '-2147483647',
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ '0x12ab',
+ '0Xfff',
+ '0XFA',
+ -0x80000000, // max negative integer as hexadecimal
+ '0x7fffffff', // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ '0123', // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ );
+
+/* loop to check that intval() recognizes different
+ integer values, expected output:integer value in decimal notation for valid integer */
+
+echo "\n***Output with default base value ie 10 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value) );
+}
+
+
+echo "\n***Output with base value of 10( explicitly passed as argument) ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 10) );
+}
+
+
+echo "\n***Output with base value of 16 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 16) );
+}
+
+echo "\n***Output with base value of 8 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 8) );
+}
+
+echo "\n*** Testing intval() on non integer types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+fclose($fp);
+$dfp = opendir ( dirname(__FILE__) );
+closedir($dfp);
+
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ '-2147483649', // float value
+ '2147483648', // float value
+ '-0x80000001', // float value, beyond max negative int
+ '0x800000001', // float value, beyond max positive int
+ '020000000001', // float value, beyond max positive int
+ '-020000000001', // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+
+
+/* loop through the $not_int_types to see working of
+ intval() on non integer types, expected output: integer value in decimal notation for valid integers */
+foreach ($not_int_types as $type ) {
+ var_dump( intval($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( intval() );
+
+//arguments more than expected
+var_dump( intval(TRUE, FALSE, TRUE) );
+
+echo "\n--- Done ---\n";
+
+
+?>
+--EXPECTF--
+*** Testing intval() with valid integer values ***
+
+***Output with default base value ie 10 ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483647)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(123)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 10( explicitly passed as argument) ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483647)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(123)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 16 ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483648)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(4779)
+int(4095)
+int(250)
+int(-2147483648)
+int(2147483647)
+int(2147483647)
+int(291)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 8 ***
+int(0)
+int(1)
+int(-1)
+int(-9020)
+int(-9020)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(83)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+*** Testing intval() on non integer types ***
+int(-2147483648)
+int(2147483647)
+int(0)
+int(0)
+int(2147483647)
+int(-2147483648)
+int(0)
+int(0)
+int(1)
+int(100000)
+int(-1000000)
+int(100000000)
+int(-1000000000)
+int(10)
+int(1050000)
+int(5)
+int(6)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for intval() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for intval() in %s on line %d
+NULL
+
+--- Done ---
diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt
new file mode 100644
index 000000000..bb240518c
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_array.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test is_array() function
+--FILE--
+<?php
+/* Prototype: bool is_array ( mixed $var );
+ * Description: Finds whether the given variable is an array
+ */
+
+echo "*** Testing is_array() on different type of arrays ***\n";
+/* different types of arrays */
+$arrays = array(
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test')
+);
+/* loop to check that is_array() recognizes different
+ type of arrays, expected output bool(true) */
+$loop_counter = 1;
+foreach ($arrays as $var_array ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_array ($var_array) );
+}
+
+echo "\n*** Testing is_array() on non array types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variables
+$unset_array = array(10);
+unset($unset_array);
+
+// other types in a array
+$varient_arrays = array (
+ /* integers */
+ 543915,
+ -5322,
+ 0x55F,
+ -0xCCF,
+ 123,
+ -0654,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ 'string',
+ "string",
+
+ /* floats */
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* nulls */
+ null,
+ NULL,
+
+ /* boolean */
+ true,
+ TRUE,
+ FALSE,
+ false,
+
+ /* unset/undefined arrays */
+ @$unset_array,
+ @$undefined_array
+);
+/* loop through the $varient_array to see working of
+ is_array() on non array types, expected output bool(false) */
+$loop_counter = 1;
+foreach ($varient_arrays as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_array ($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_array() );
+
+//arguments more than expected
+var_dump( is_array ($fp, $fp) );
+
+echo "Done\n";
+?>
+--CLEAN--
+/* close resources */
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_array() on different type of arrays ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+
+*** Testing is_array() on non array types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_array(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_array(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt
new file mode 100644
index 000000000..9ef60d4b4
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_bool.phpt
@@ -0,0 +1,295 @@
+--TEST--
+Test is_bool() function
+--FILE--
+<?php
+/* Prototype: bool is_bool ( mixed $var );
+ * Description: Finds whether the given variable is a boolean
+ */
+
+echo "*** Testing is_bool() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bools = array(
+ TRUE,
+ FALSE,
+ true,
+ false,
+);
+/* loop to check that is_bool() recognizes different
+ bool values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_bools as $bool_val ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_bool($bool_val) );
+}
+
+echo "\n*** Testing is_bool() on non boolean values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_bool1 = true;
+$unset_bool2 = false;
+$unset_var = 0;
+unset ($unset_bool1);
+unset ($unset_bool2);
+unset ($unset_var);
+
+// other types in a array
+$not_bool_types = array (
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ 'string',
+ "string",
+ "true",
+ "false",
+ "FALSE",
+ "TRUE",
+ 'true',
+ 'false',
+ 'FALSE',
+ 'TRUE',
+ "NULL",
+ "null",
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* nulls */
+ null,
+ NULL,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* unset bool vars and undefined var */
+ @$unset_bool1,
+ @$unset_bool2,
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_bool_types to see working of
+ is_bool() on non bull types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_bool_types as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_bool($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_bool() );
+
+//arguments more than expected
+var_dump( is_bool(TRUE, FALSE) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close resources
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_bool() with valid boolean values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+*** Testing is_bool() on non boolean values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+-- Iteration 46 --
+bool(false)
+-- Iteration 47 --
+bool(false)
+-- Iteration 48 --
+bool(false)
+-- Iteration 49 --
+bool(false)
+-- Iteration 50 --
+bool(false)
+-- Iteration 51 --
+bool(false)
+-- Iteration 52 --
+bool(false)
+-- Iteration 53 --
+bool(false)
+-- Iteration 54 --
+bool(false)
+-- Iteration 55 --
+bool(false)
+-- Iteration 56 --
+bool(false)
+-- Iteration 57 --
+bool(false)
+-- Iteration 58 --
+bool(false)
+-- Iteration 59 --
+bool(false)
+-- Iteration 60 --
+bool(false)
+-- Iteration 61 --
+bool(false)
+-- Iteration 62 --
+bool(false)
+-- Iteration 63 --
+bool(false)
+-- Iteration 64 --
+bool(false)
+-- Iteration 65 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_bool(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_bool(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt
new file mode 100644
index 000000000..d72a22a5c
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_float.phpt
@@ -0,0 +1,441 @@
+--TEST--
+Test is_float() & it's FALIASes: is_double() & is_real() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: bool is_float ( mixed $var );
+ * Description: Finds whether the given variable is a float
+ */
+
+echo "*** Testing is_float(), is_double() and is_real() with float values***\n";
+// different valid float vlaues
+$floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+/* loop to check that is_float(), is_double() & is_real() recognizes
+ different float values, expected: bool(true) */
+$loop_counter = 1;
+foreach ($floats as $float ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_float($float) );
+ var_dump( is_double($float) );
+ var_dump( is_real($float) );
+}
+
+echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ var $array = array(10.5);
+};
+$object = new foo();
+
+$not_floats = array (
+ new foo, //object
+ $object,
+
+ $fp, // resource
+ $dfp,
+
+ array(), // arrays
+ array(NULL),
+ array(0.5e10),
+ array(1,2,3,4),
+ array("string"),
+
+ NULL, // nulls
+ null,
+
+ true, // boolean
+ TRUE,
+ false,
+ FALSE,
+
+ "", // strings
+ '',
+ "0",
+ '0',
+ "0.0",
+ '0.0',
+ '0.5',
+ "-0.5",
+ "1e5",
+ '1e5',
+ '1.5e6_string',
+ "1.5e6_string",
+
+ 1, // integers, hex and octal
+ -1,
+ 0,
+ 12345,
+ 0xFF55,
+ -0x673,
+ 0123,
+ -0123,
+
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_floats to see working of
+ is_float(), is_double() & is_real() on objects,
+ arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_floats as $value ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_float($value) );
+ var_dump( is_double($value) );
+ var_dump( is_real($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_float() );
+var_dump( is_double() );
+var_dump( is_real() );
+
+//arguments more than expected
+var_dump( is_float( $floats[0], $floats[1]) );
+var_dump( is_double( $floats[0], $floats[1]) );
+var_dump( is_real( $floats[0], $floats[1]) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_float(), is_double() and is_real() with float values***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 13 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 24 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 25 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 26 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 27 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 28 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 29 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_float(), is_double() & is_real() with non float values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_float(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_double(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_real(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_float(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_double(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_real(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt
new file mode 100644
index 000000000..3ebd925d6
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_float_64bit.phpt
@@ -0,0 +1,443 @@
+--TEST--
+Test is_float() & it's FALIASes: is_double() & is_real() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool is_float ( mixed $var );
+ * Description: Finds whether the given variable is a float
+ */
+
+echo "*** Testing is_float(), is_double() and is_real() with float values***\n";
+// different valid float vlaues
+$floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+/* loop to check that is_float(), is_double() & is_real() recognizes
+ different float values, expected: bool(true) */
+$loop_counter = 1;
+foreach ($floats as $float ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_float($float) );
+ var_dump( is_double($float) );
+ var_dump( is_real($float) );
+}
+
+echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ var $array = array(10.5);
+};
+$object = new foo();
+
+$not_floats = array (
+ new foo, //object
+ $object,
+
+ $fp, // resource
+ $dfp,
+
+ array(), // arrays
+ array(NULL),
+ array(0.5e10),
+ array(1,2,3,4),
+ array("string"),
+
+ NULL, // nulls
+ null,
+
+ true, // boolean
+ TRUE,
+ false,
+ FALSE,
+
+ "", // strings
+ '',
+ "0",
+ '0',
+ "0.0",
+ '0.0',
+ '0.5',
+ "-0.5",
+ "1e5",
+ '1e5',
+ '1.5e6_string',
+ "1.5e6_string",
+
+ 1, // integers, hex and octal
+ -1,
+ 0,
+ 12345,
+ 0xFF55,
+ -0x673,
+ 0123,
+ -0123,
+
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_floats to see working of
+ is_float(), is_double() & is_real() on objects,
+ arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_floats as $value ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_float($value) );
+ var_dump( is_double($value) );
+ var_dump( is_real($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_float() );
+var_dump( is_double() );
+var_dump( is_real() );
+
+//arguments more than expected
+var_dump( is_float( $floats[0], $floats[1]) );
+var_dump( is_double( $floats[0], $floats[1]) );
+var_dump( is_real( $floats[0], $floats[1]) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_float(), is_double() and is_real() with float values***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 13 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 24 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 25 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 26 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 27 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 28 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 29 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_float(), is_double() & is_real() with non float values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_float(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_double(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_real(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_float(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_double(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_real(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt
new file mode 100644
index 000000000..2158bcc08
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_int.phpt
@@ -0,0 +1,466 @@
+--TEST--
+Test is_int() & it's FALIASes: is_long() & is_integer() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: bool is_int ( mixed $var );
+ * Description: Finds whether the given variable is an integer
+ */
+
+echo "*** Testing is_int(), is_integer() & is_long() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+);
+/* loop to check that is_int() recognizes different
+ integer values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_ints as $int_val ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($int_val) );
+ var_dump( is_integer($int_val) );
+ var_dump( is_long($int_val) );
+}
+
+echo "\n*** Testing is_int(), is_integer() & is_long() with non integer values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_int_types to see working of
+ is_int() on non integer types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_int_types as $type ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($type) );
+ var_dump( is_integer($type) );
+ var_dump( is_long($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_int() );
+var_dump( is_integer() );
+var_dump( is_long() );
+
+//arguments more than expected
+var_dump( is_int(TRUE, FALSE) );
+var_dump( is_integer(TRUE, FALSE) );
+var_dump( is_long(TRUE, FALSE) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_int(), is_integer() & is_long() with valid integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 8--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 9--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 10--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 11--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 14--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 15--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 16--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_int(), is_integer() & is_long() with non integer values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 38--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 39--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 40--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 41--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 42--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 43--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 44--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 45--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 46--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 47--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 48--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 49--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 50--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 51--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 52--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 53--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 54--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_int(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_integer(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_long(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_int(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_integer(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_long(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt
new file mode 100644
index 000000000..fc53a3dfa
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_int_64bit.phpt
@@ -0,0 +1,468 @@
+--TEST--
+Test is_int() & it's FALIASes: is_long() & is_integer() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool is_int ( mixed $var );
+ * Description: Finds whether the given variable is an integer
+ */
+
+echo "*** Testing is_int(), is_integer() & is_long() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+);
+/* loop to check that is_int() recognizes different
+ integer values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_ints as $int_val ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($int_val) );
+ var_dump( is_integer($int_val) );
+ var_dump( is_long($int_val) );
+}
+
+echo "\n*** Testing is_int(), is_integer() & is_long() with non integer values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_int_types to see working of
+ is_int() on non integer types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_int_types as $type ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($type) );
+ var_dump( is_integer($type) );
+ var_dump( is_long($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_int() );
+var_dump( is_integer() );
+var_dump( is_long() );
+
+//arguments more than expected
+var_dump( is_int(TRUE, FALSE) );
+var_dump( is_integer(TRUE, FALSE) );
+var_dump( is_long(TRUE, FALSE) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_int(), is_integer() & is_long() with valid integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 8--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 9--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 10--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 11--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 12--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 13--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 14--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 15--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 16--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 17--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 18--
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_int(), is_integer() & is_long() with non integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 38--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 39--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 40--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 41--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 42--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 43--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 44--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 45--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 46--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 47--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 48--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 49--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 50--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 51--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 52--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 53--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 54--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_int(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_integer(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_long(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_int(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_integer(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_long(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt
new file mode 100644
index 000000000..261385b85
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_null.phpt
@@ -0,0 +1,297 @@
+--TEST--
+Test is_null() function
+--FILE--
+<?php
+/* Prototype: bool is_null ( mixed $var );
+ * Description: Finds whether the given variable is NULL
+ */
+
+echo "*** Testing is_null() with valid null values ***\n";
+// different valid null vlaues
+$unset_array = array();
+$unset_int = 10;
+$unset_float = 10.5;
+$unset_bool = true;
+$unset_object = new stdclass;
+$unset_resource = fopen(__FILE__, "r");
+// unset them to make it null.
+unset ($unset_array, $unset_int, $unset_float, $unset_bool, $unset_object, $unset_resource);
+$null_var1 = NULL;
+$null_var2 = null;
+
+$valid_nulls = array(
+ NULL,
+ null,
+ @$null_var1,
+ @$null_var2,
+ @$unset_array,
+ @$unset_int,
+ @$unset_float,
+ @$unset_bool,
+ @$unset_object,
+ @$unset_resource,
+ @$undefined_var,
+);
+/* loop to check that is_null() recognizes different
+ null values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_nulls as $null_val ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_null($null_val) );
+}
+
+echo "\n*** Testing is_bool() on non null values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// other types in a array
+$not_null_types = array (
+/* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ 'string',
+ "string",
+ "true",
+ "false",
+ "FALSE",
+ "TRUE",
+ 'true',
+ 'false',
+ 'FALSE',
+ 'TRUE',
+ "NULL",
+ "null",
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+);
+/* loop through the $not_null_types to see working of
+ is_null() on non null types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_null_types as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_null($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_null() );
+
+//arguments more than expected
+var_dump( is_null(NULL, null) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_null() with valid null values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+
+*** Testing is_bool() on non null values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+-- Iteration 46 --
+bool(false)
+-- Iteration 47 --
+bool(false)
+-- Iteration 48 --
+bool(false)
+-- Iteration 49 --
+bool(false)
+-- Iteration 50 --
+bool(false)
+-- Iteration 51 --
+bool(false)
+-- Iteration 52 --
+bool(false)
+-- Iteration 53 --
+bool(false)
+-- Iteration 54 --
+bool(false)
+-- Iteration 55 --
+bool(false)
+-- Iteration 56 --
+bool(false)
+-- Iteration 57 --
+bool(false)
+-- Iteration 58 --
+bool(false)
+-- Iteration 59 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_null(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_null(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt
new file mode 100644
index 000000000..812140266
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_numeric.phpt
@@ -0,0 +1,388 @@
+--TEST--
+Test is_numeric() function
+--FILE--
+<?php
+/* Prototype: bool is_numeric ( mixed $var );
+ * Description: Finds whether a variable is a number or a numeric string
+ */
+
+echo "*** Testing is_numeric() with valid numeric values ***\n";
+// different valid numeric vlaues
+$numerics = array(
+ 0,
+ 1,
+ -1,
+ -0,
+ +0,
+ 0.0,
+ -0.0,
+ +0.0,
+ 1.0,
+ -1.0,
+ +1.0,
+ .5,
+ -.5,
+ +.5,
+ -.5e-2,
+ .5e-2,
+ +.5e-2,
+ +.5E+2,
+ 0.70000000,
+ +0.70000000,
+ -0.70000000,
+ 1234567890123456,
+ -1234567890123456,
+ 984847472827282718178,
+ -984847472827282718178,
+ 123.56e30,
+ 123.56E30,
+ 426.45e-30,
+ 5657.3E-40,
+ 3486.36e+40,
+ 3486.36E+90,
+ -3486.36E+10,
+ -3486.36e+80,
+ -426.45e-50,
+ -426.45E-99,
+ 1e2,
+ -1e2,
+ -1e-2,
+ +1e2,
+ +1e+2,
+ +1e-2,
+ +1e+2,
+ 2245555555555555.444,
+ 1.444444444444444444,
+ 0xff, // hexa decimal numbers
+ 0xFF,
+ //0x1111111111111111111111,
+ -0x1111111,
+ +0x6698319,
+ 01000000000000000000000,
+ 0123,
+ 0345900,
+ -0200001,
+ -0200001.7,
+ 0200001.7,
+ +0200001,
+ +0200001.7,
+ +0200001.7,
+ 2.00000000000000000000001, // a float value with more precision points
+ "1", // numeric in the form of string
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0xff',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123'
+);
+/* loop to check that is_numeric() recognizes different
+ numeric values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($numerics as $num ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_numeric($num) );
+}
+
+echo "\n*** Testing is_numeric() on non numeric types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10.5;
+unset ($unset_var);
+
+// other types in a array
+$not_numerics = array(
+ "-0x80001",
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ new stdclass, // object
+ $fp, // resource
+ $dfp,
+ array(),
+ array("string"),
+ "",
+ "1 ",
+ "- 1",
+ "1.2.4",
+ "1e7.6",
+ "3FF",
+ "20 test",
+ "3.6test",
+ "1,000",
+ "NULL",
+ "true",
+ true,
+ NULL,
+ null,
+ TRUE,
+ FALSE,
+ false,
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_numerics to see working of
+ is_numeric() on non numeric values, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_numerics as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_numeric($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_numeric() );
+
+//arguments more than expected
+var_dump( is_numeric("10", "20") );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_numeric() with valid numeric values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+-- Iteration 23 --
+bool(true)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+-- Iteration 26 --
+bool(true)
+-- Iteration 27 --
+bool(true)
+-- Iteration 28 --
+bool(true)
+-- Iteration 29 --
+bool(true)
+-- Iteration 30 --
+bool(true)
+-- Iteration 31 --
+bool(true)
+-- Iteration 32 --
+bool(true)
+-- Iteration 33 --
+bool(true)
+-- Iteration 34 --
+bool(true)
+-- Iteration 35 --
+bool(true)
+-- Iteration 36 --
+bool(true)
+-- Iteration 37 --
+bool(true)
+-- Iteration 38 --
+bool(true)
+-- Iteration 39 --
+bool(true)
+-- Iteration 40 --
+bool(true)
+-- Iteration 41 --
+bool(true)
+-- Iteration 42 --
+bool(true)
+-- Iteration 43 --
+bool(true)
+-- Iteration 44 --
+bool(true)
+-- Iteration 45 --
+bool(true)
+-- Iteration 46 --
+bool(true)
+-- Iteration 47 --
+bool(true)
+-- Iteration 48 --
+bool(true)
+-- Iteration 49 --
+bool(true)
+-- Iteration 50 --
+bool(true)
+-- Iteration 51 --
+bool(true)
+-- Iteration 52 --
+bool(true)
+-- Iteration 53 --
+bool(true)
+-- Iteration 54 --
+bool(true)
+-- Iteration 55 --
+bool(true)
+-- Iteration 56 --
+bool(true)
+-- Iteration 57 --
+bool(true)
+-- Iteration 58 --
+bool(true)
+-- Iteration 59 --
+bool(true)
+-- Iteration 60 --
+bool(true)
+-- Iteration 61 --
+bool(true)
+-- Iteration 62 --
+bool(true)
+-- Iteration 63 --
+bool(true)
+-- Iteration 64 --
+bool(true)
+-- Iteration 65 --
+bool(true)
+-- Iteration 66 --
+bool(true)
+-- Iteration 67 --
+bool(true)
+-- Iteration 68 --
+bool(true)
+-- Iteration 69 --
+bool(true)
+-- Iteration 70 --
+bool(true)
+-- Iteration 71 --
+bool(true)
+-- Iteration 72 --
+bool(true)
+-- Iteration 73 --
+bool(true)
+-- Iteration 74 --
+bool(true)
+-- Iteration 75 --
+bool(true)
+-- Iteration 76 --
+bool(true)
+-- Iteration 77 --
+bool(true)
+-- Iteration 78 --
+bool(true)
+
+*** Testing is_numeric() on non numeric types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for is_numeric() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for is_numeric() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt
new file mode 100644
index 000000000..9916c9e32
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_object.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test is_object() function
+--FILE--
+<?php
+/* Prototype: bool is_object ( mixed $var );
+ * Description: Finds whether the given variable is an object
+ */
+
+echo "*** Testing is_object() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface IValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+
+// implement the interface
+class Value implements IValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_dump ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ new stdclass,
+ new foo,
+ new concreteClass,
+ new Value,
+ new myClass,
+ $myClass_object,
+ $myClass_object->foo_object,
+ $myClass_object->public_var1,
+ $foo_object,
+ $Value_object,
+ $concreteClass_object
+);
+
+/* loop to check that is_object() recognizes different
+ objects, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_objects as $object ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_object($object) );
+}
+
+echo "\n*** Testing is_object() on non object types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset object
+$unset_object = new foo();
+unset ($unset_object);
+
+// other types in a array
+$not_objects = array (
+ 0,
+ -1,
+ 0.1,
+ -10.0000000000000000005,
+ 10.5e+5,
+ 0xFF,
+ 0123,
+ $fp, // resource
+ $dfp,
+ array(),
+ array("string"),
+ "0",
+ "1",
+ "",
+ true,
+ NULL,
+ null,
+ @$unset_object, // unset object
+ @$undefined_var, // undefined variable
+);
+/* loop through the $not_objects to see working of
+ is_object() on non object types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_objects as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_object($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_object() );
+
+//arguments more than expected
+var_dump( is_object($myClass_object, $myClass_object) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_object() with valid objects ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+
+*** Testing is_object() on non object types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_object(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_object(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_resource.phpt b/ext/standard/tests/general_functions/is_resource.phpt
index d44461e44..2717e3fa4 100644
--- a/ext/standard/tests/general_functions/is_resource.phpt
+++ b/ext/standard/tests/general_functions/is_resource.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #27822: is_resource() returns TRUE for closed resources
+Bug #27822 (is_resource() returns TRUE for closed resources)
--FILE--
<?php
$f = fopen(__FILE__, 'r');
diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt
new file mode 100644
index 000000000..f7f142a16
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_scalar.phpt
@@ -0,0 +1,241 @@
+--TEST--
+Test is_scalar() function
+--FILE--
+<?php
+/* Prototype: bool is_scalar ( mixed $var );
+ * Description: Finds whether a variable is a scalar (i.e integer, float, string or boolean)
+ */
+
+echo "*** Testing basic operations ***\n";
+$scalar_variables = array(
+ 0, // integers
+ 1,
+ -45678,
+ 0x5FF, // hexadecimal as integer
+ 0X566,
+ -0xAAF,
+ -0XCCF,
+ 01234, // octal as integer
+ -0126,
+
+ 0.0, // floats
+ -1.0,
+ 1e5,
+ -1e7,
+ 1.6E7,
+ 475.e-8,
+ 784.e+30,
+ 98.45E+40,
+ .5E-40,
+
+ "", // strings
+ '',
+ " ",
+ ' ',
+ "string",
+ 'string',
+ "0", // numeric as string
+ "40",
+ "50.696",
+ "0x534",
+ "0X534",
+
+ TRUE, // boolean
+ FALSE,
+ true,
+ false
+);
+/* loop through each valid scalar variables in $scalar_variables
+ and see the working of is_scalar(), expected output: bool(true)
+*/
+$loop_counter = 1;
+foreach($scalar_variables as $scalar) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_scalar($scalar) );
+}
+
+echo "\n*** Testing possible variations ***\n";
+// different scalar variables which are unset
+$int_var = 10;
+$float_var = 1e5;
+$string_var = "string";
+$boolean_var = true;
+$object = new stdclass;
+$array = array(10);
+$resource = opendir('.');
+unset($int_var, $float_var, $string_var, $boolean_var, $object, $array, $resource);
+
+// resources
+$fp = fopen(__FILE__, "r");
+$dfp = opendir(".");
+
+$variation_array = array(
+ NULL,
+ null,
+
+ array(), // arrays
+ array(NULL),
+ array(true),
+ array(0),
+ array(1,2,3,4),
+
+ $fp, // resources
+ $dfp,
+
+ new stdclass, // object
+
+ @$int_var, // scalars that are unset
+ @$float_var,
+ @$string_var,
+ @$boolean_var,
+
+ @$array, // non scalars that are unset
+ @$object,
+ @$resource,
+
+ @$undefined_var // undefined variable
+);
+
+/* loop through each element of $variation_array to see the
+ working of is_scalar on non-scalar values, expected output: bool(false)
+*/
+$loop_counter = 1;
+foreach( $variation_array as $value ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_scalar($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+// Zero arguments
+var_dump( is_scalar() );
+
+// Arguments more than expected
+var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) );
+var_dump( is_scalar( new stdclass, new stdclass) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing basic operations ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+-- Iteration 23 --
+bool(true)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+-- Iteration 26 --
+bool(true)
+-- Iteration 27 --
+bool(true)
+-- Iteration 28 --
+bool(true)
+-- Iteration 29 --
+bool(true)
+-- Iteration 30 --
+bool(true)
+-- Iteration 31 --
+bool(true)
+-- Iteration 32 --
+bool(true)
+-- Iteration 33 --
+bool(true)
+
+*** Testing possible variations ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for is_scalar() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for is_scalar() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for is_scalar() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt
new file mode 100644
index 000000000..92bca6673
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_string.phpt
@@ -0,0 +1,304 @@
+--TEST--
+Test is_string() function
+--FILE--
+<?php
+/* Prototype: bool is_string ( mixed $var );
+ * Description: Finds whether the given variable is a string
+ */
+
+echo "*** Testing is_string() with valid string values ***\n";
+// different valid strings
+
+/* string created using Heredoc (<<<) */
+$heredoc_string = <<<EOT
+This is string defined
+using heredoc.
+EOT;
+/* heredoc string with only numerics */
+$heredoc_numeric_string = <<<EOT
+123456 3993
+4849 string
+EOT;
+/* null heardoc string */
+$heredoc_empty_string = <<<EOT
+EOT;
+$heredoc_null_string = <<<EOT
+NULL
+EOT;
+
+$strings = array(
+ "",
+ " ",
+ '',
+ ' ',
+ "string",
+ 'string',
+ "NULL",
+ 'null',
+ "FALSE",
+ 'true',
+ "\x0b",
+ "\0",
+ '\0',
+ '\060',
+ "\070",
+ "0x55F",
+ "055",
+ "@#$#$%%$^^$%^%^$^&",
+ $heredoc_string,
+ $heredoc_numeric_string,
+ $heredoc_empty_string,
+ $heredoc_null_string
+);
+/* loop to check that is_string() recognizes different
+ strings, expected output bool(true) */
+$loop_counter = 1;
+foreach ($strings as $string ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_string($string) );
+}
+
+echo "\n*** Testing is_string() on non string values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset vars
+$unset_string1 = "string";
+$unset_string2 = 'string';
+$unset_heredoc = <<<EOT
+this is heredoc string
+EOT;
+// unset the vars
+unset($unset_string1, $unset_string2, $unset_heredoc);
+
+// other types in a array
+$not_strings = array (
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* undefined and unset vars */
+ @$unset_string1,
+ @$unset_string2,
+ @$unset_heredoc,
+ @$undefined_var
+);
+/* loop through the $not_strings to see working of
+ is_string() on non string types, expected output bool(false) */
+$loop_counter = 1;
+foreach ($not_strings as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_string($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_string() );
+
+//arguments more than expected
+var_dump( is_string("string", "test") );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing is_string() with valid string values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+
+*** Testing is_string() on non string values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_string(): Only one argument expected in %s on line %d
+bool(false)
+
+Warning: is_string(): Only one argument expected in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt
new file mode 100644
index 000000000..673b853ea
--- /dev/null
+++ b/ext/standard/tests/general_functions/print_r.phpt
@@ -0,0 +1,1736 @@
+--TEST--
+Test print_r() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool print_r ( mixed $expression [, bool $return] );
+ Description: Prints human-readable information about a variable
+*/
+
+/* Prototype: void check_printr( $variables )
+ Description: use print_r() to print variables */
+function check_printr( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "\n-- Iteration $counter --\n";
+ //default = false, prints output to screen
+ print_r($variable);
+ //$return=TRUE, print_r() will return its output, instead of printing it
+ $ret_string = print_r($variable, true); //$ret_string captures the output
+ echo "\n$ret_string\n";
+ //$return=false, print_r() prints the output; default behavior
+ print_r($variable, false);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing print_r() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_printr() to display contents of integer variables
+ using print_r() */
+check_printr($integers);
+
+echo "\n*** Testing print_r() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_printr() to display contents of float variables
+ using print_r() */
+check_printr($floats);
+
+echo "\n*** Testing print_r() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_printr() to display contents of strings using print_r() */
+check_printr($strings);
+
+echo "\n*** Testing print_r() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_printr() to display boolean variables using print_r() */
+check_printr($booleans);
+var_dump( reset($booleans) );
+echo "\n";
+var_dump( current($booleans) );
+
+echo "\n*** Testing print_r() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_printr() to display contents of $arrays */
+check_printr($arrays);
+
+echo "\n*** Testing print_r() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_printr() to display contents of the objects using print_r() */
+check_printr($objects);
+
+echo "\n** Testing print_r() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+print_r($recursion_obj2);
+
+echo "\n*** Testing print_r() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_printr() to display the resource content type
+ using print_r() */
+check_printr($resources);
+
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_printr() to display combinations of scalar and
+ non-scalar variables using print_r() */
+check_printr($variations);
+
+echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_printr() to display miscelleneous data using print_r() */
+check_printr($misc_values);
+
+/* checking print_r() on functions */
+echo "\n*** Testing print_r() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+print_r( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump( print_r() );
+
+//passing more than required no. of arguments
+var_dump( print_r(123, true, "abc") );
+
+// check when second arg is given other than boolean TRUE
+var_dump( print_r ($value, "string") );
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing print_r() on integer variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+83
+83
+83
+-- Iteration 3 --
+123000000
+123000000
+123000000
+-- Iteration 4 --
+-83
+-83
+-83
+-- Iteration 5 --
+-12300000
+-12300000
+-12300000
+-- Iteration 6 --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+-- Iteration 8 --
+2147483647
+2147483647
+2147483647
+-- Iteration 9 --
+2147483648
+2147483648
+2147483648
+-- Iteration 10 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 11 --
+-2147483647
+-2147483647
+-2147483647
+-- Iteration 12 --
+2147483647
+2147483647
+2147483647
+-- Iteration 13 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 14 --
+2147483647
+2147483647
+2147483647
+-- Iteration 15 --
+-2147483648
+-2147483648
+-2147483648
+*** Testing print_r() on float variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+0
+0
+0
+-- Iteration 3 --
+1.234
+1.234
+1.234
+-- Iteration 4 --
+-1.234
+-1.234
+-1.234
+-- Iteration 5 --
+-2
+-2
+-2
+-- Iteration 6 --
+2
+2
+2
+-- Iteration 7 --
+-0.5
+-0.5
+-0.5
+-- Iteration 8 --
+0.567
+0.567
+0.567
+-- Iteration 9 --
+-0.00067
+-0.00067
+-0.00067
+-- Iteration 10 --
+-670
+-670
+-670
+-- Iteration 11 --
+670
+670
+670
+-- Iteration 12 --
+670
+670
+670
+-- Iteration 13 --
+-0.00410003
+-0.00410003
+-0.00410003
+-- Iteration 14 --
+-4100.03
+-4100.03
+-4100.03
+-- Iteration 15 --
+0.004100003
+0.004100003
+0.004100003
+-- Iteration 16 --
+4100.003
+4100.003
+4100.003
+-- Iteration 17 --
+100000
+100000
+100000
+-- Iteration 18 --
+-100000
+-100000
+-100000
+-- Iteration 19 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 20 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 21 --
+100000
+100000
+100000
+-- Iteration 22 --
+-100000
+-100000
+-100000
+-- Iteration 23 --
+100000
+100000
+100000
+-- Iteration 24 --
+-100000
+-100000
+-100000
+-- Iteration 25 --
+100000
+100000
+100000
+-- Iteration 26 --
+-100000
+-100000
+-100000
+-- Iteration 27 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 28 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 29 --
+-2147483649
+-2147483649
+-2147483649
+-- Iteration 30 --
+2147483649
+2147483649
+2147483649
+-- Iteration 31 --
+2147483649
+2147483649
+2147483649
+-- Iteration 32 --
+-2147483649
+-2147483649
+-2147483649
+*** Testing print_r() on string variables ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+-- Iteration 5 --
+0
+0
+0
+-- Iteration 6 --
+
+
+
+-- Iteration 7 --
+\0
+\0
+\0
+-- Iteration 8 --
+
+
+
+-- Iteration 9 --
+\t
+\t
+\t
+-- Iteration 10 --
+PHP
+PHP
+PHP
+-- Iteration 11 --
+PHP
+PHP
+PHP
+-- Iteration 12 --
+abcd
+abcd
+abcd
+-- Iteration 13 --
+abcd
+abcd
+abcd
+-- Iteration 14 --
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+*** Testing print_r() on boolean variables ***
+
+-- Iteration 1 --
+1
+1
+1
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+1
+1
+1
+-- Iteration 4 --
+
+
+bool(true)
+
+bool(true)
+
+*** Testing print_r() on array variables ***
+
+-- Iteration 1 --
+Array
+(
+)
+
+Array
+(
+)
+
+Array
+(
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+-- Iteration 8 --
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+-- Iteration 9 --
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+-- Iteration 10 --
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+-- Iteration 11 --
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+-- Iteration 12 --
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+-- Iteration 13 --
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+-- Iteration 14 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+-- Iteration 15 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+*** Testing print_r() on object variables ***
+
+-- Iteration 1 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 2 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 3 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 4 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 5 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 6 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 7 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 8 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 9 --
+
+
+
+** Testing print_r() on objects having circular reference **
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ *RECURSION*
+ )
+
+)
+
+*** Testing print_r() on resources ***
+
+-- Iteration 1 --
+Resource id #5
+Resource id #5
+Resource id #5
+-- Iteration 2 --
+Resource id #6
+Resource id #6
+Resource id #6
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
+
+-- Iteration 1 --
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+*** Testing print_r() on miscelleneous input arguments ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+*** Testing print_r() on anonymous functions ***
+New anonymous function:
+2 * 3 = 6
+
+*** Testing error conditions ***
+
+Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: value in %s on line %d
+string(0) ""
+Done
diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt
new file mode 100644
index 000000000..e0c5f7537
--- /dev/null
+++ b/ext/standard/tests/general_functions/print_r_64bit.phpt
@@ -0,0 +1,1737 @@
+--TEST--
+Test print_r() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+
+<?php
+/* Prototype: bool print_r ( mixed $expression [, bool $return] );
+ Description: Prints human-readable information about a variable
+*/
+
+/* Prototype: void check_printr( $variables )
+ Description: use print_r() to print variables */
+function check_printr( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "\n-- Iteration $counter --\n";
+ //default = false, prints output to screen
+ print_r($variable);
+ //$return=TRUE, print_r() will return its output, instead of printing it
+ $ret_string = print_r($variable, true); //$ret_string captures the output
+ echo "\n$ret_string\n";
+ //$return=false, print_r() prints the output; default behavior
+ print_r($variable, false);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing print_r() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_printr() to display contents of integer variables
+ using print_r() */
+check_printr($integers);
+
+echo "\n*** Testing print_r() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_printr() to display contents of float variables
+ using print_r() */
+check_printr($floats);
+
+echo "\n*** Testing print_r() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_printr() to display contents of strings using print_r() */
+check_printr($strings);
+
+echo "\n*** Testing print_r() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_printr() to display boolean variables using print_r() */
+check_printr($booleans);
+var_dump( reset($booleans) );
+echo "\n";
+var_dump( current($booleans) );
+
+echo "\n*** Testing print_r() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_printr() to display contents of $arrays */
+check_printr($arrays);
+
+echo "\n*** Testing print_r() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_printr() to display contents of the objects using print_r() */
+check_printr($objects);
+
+echo "\n** Testing print_r() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+print_r($recursion_obj2);
+
+echo "\n*** Testing print_r() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_printr() to display the resource content type
+ using print_r() */
+check_printr($resources);
+
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_printr() to display combinations of scalar and
+ non-scalar variables using print_r() */
+check_printr($variations);
+
+echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_printr() to display miscelleneous data using print_r() */
+check_printr($misc_values);
+
+/* checking print_r() on functions */
+echo "\n*** Testing print_r() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+print_r( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump( print_r() );
+
+//passing more than required no. of arguments
+var_dump( print_r(123, true, "abc") );
+
+// check when second arg is given other than boolean TRUE
+var_dump( print_r ($value, "string") );
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing print_r() on integer variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+83
+83
+83
+-- Iteration 3 --
+123000000
+123000000
+123000000
+-- Iteration 4 --
+-83
+-83
+-83
+-- Iteration 5 --
+-12300000
+-12300000
+-12300000
+-- Iteration 6 --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+-- Iteration 8 --
+2147483647
+2147483647
+2147483647
+-- Iteration 9 --
+2147483648
+2147483648
+2147483648
+-- Iteration 10 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 11 --
+-2147483647
+-2147483647
+-2147483647
+-- Iteration 12 --
+2147483647
+2147483647
+2147483647
+-- Iteration 13 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 14 --
+2147483647
+2147483647
+2147483647
+-- Iteration 15 --
+-2147483648
+-2147483648
+-2147483648
+*** Testing print_r() on float variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+0
+0
+0
+-- Iteration 3 --
+1.234
+1.234
+1.234
+-- Iteration 4 --
+-1.234
+-1.234
+-1.234
+-- Iteration 5 --
+-2
+-2
+-2
+-- Iteration 6 --
+2
+2
+2
+-- Iteration 7 --
+-0.5
+-0.5
+-0.5
+-- Iteration 8 --
+0.567
+0.567
+0.567
+-- Iteration 9 --
+-0.00067
+-0.00067
+-0.00067
+-- Iteration 10 --
+-670
+-670
+-670
+-- Iteration 11 --
+670
+670
+670
+-- Iteration 12 --
+670
+670
+670
+-- Iteration 13 --
+-0.00410003
+-0.00410003
+-0.00410003
+-- Iteration 14 --
+-4100.03
+-4100.03
+-4100.03
+-- Iteration 15 --
+0.004100003
+0.004100003
+0.004100003
+-- Iteration 16 --
+4100.003
+4100.003
+4100.003
+-- Iteration 17 --
+100000
+100000
+100000
+-- Iteration 18 --
+-100000
+-100000
+-100000
+-- Iteration 19 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 20 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 21 --
+100000
+100000
+100000
+-- Iteration 22 --
+-100000
+-100000
+-100000
+-- Iteration 23 --
+100000
+100000
+100000
+-- Iteration 24 --
+-100000
+-100000
+-100000
+-- Iteration 25 --
+100000
+100000
+100000
+-- Iteration 26 --
+-100000
+-100000
+-100000
+-- Iteration 27 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 28 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 29 --
+-2147483649
+-2147483649
+-2147483649
+-- Iteration 30 --
+2147483649
+2147483649
+2147483649
+-- Iteration 31 --
+2147483649
+2147483649
+2147483649
+-- Iteration 32 --
+-2147483649
+-2147483649
+-2147483649
+*** Testing print_r() on string variables ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+-- Iteration 5 --
+0
+0
+0
+-- Iteration 6 --
+
+
+
+-- Iteration 7 --
+\0
+\0
+\0
+-- Iteration 8 --
+
+
+
+-- Iteration 9 --
+\t
+\t
+\t
+-- Iteration 10 --
+PHP
+PHP
+PHP
+-- Iteration 11 --
+PHP
+PHP
+PHP
+-- Iteration 12 --
+abcd
+abcd
+abcd
+-- Iteration 13 --
+abcd
+abcd
+abcd
+-- Iteration 14 --
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+*** Testing print_r() on boolean variables ***
+
+-- Iteration 1 --
+1
+1
+1
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+1
+1
+1
+-- Iteration 4 --
+
+
+bool(true)
+
+bool(true)
+
+*** Testing print_r() on array variables ***
+
+-- Iteration 1 --
+Array
+(
+)
+
+Array
+(
+)
+
+Array
+(
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+-- Iteration 8 --
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+-- Iteration 9 --
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+-- Iteration 10 --
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+-- Iteration 11 --
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+-- Iteration 12 --
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+-- Iteration 13 --
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+-- Iteration 14 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+-- Iteration 15 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+*** Testing print_r() on object variables ***
+
+-- Iteration 1 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 2 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 3 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 4 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 5 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 6 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 7 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 8 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 9 --
+
+
+
+** Testing print_r() on objects having circular reference **
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:private] => 20
+ [private_var2:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ *RECURSION*
+ )
+
+)
+
+*** Testing print_r() on resources ***
+
+-- Iteration 1 --
+Resource id #5
+Resource id #5
+Resource id #5
+-- Iteration 2 --
+Resource id #6
+Resource id #6
+Resource id #6
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
+
+-- Iteration 1 --
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+*** Testing print_r() on miscelleneous input arguments ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+*** Testing print_r() on anonymous functions ***
+New anonymous function:
+2 * 3 = 6
+
+*** Testing error conditions ***
+
+Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: value in %s on line %d
+string(0) ""
+Done
diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt
new file mode 100644
index 000000000..8cf827303
--- /dev/null
+++ b/ext/standard/tests/general_functions/strval.phpt
@@ -0,0 +1,310 @@
+--TEST--
+Test strval() function
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string strval ( mixed $var );
+ * Description: Returns the string value of var
+ */
+
+echo "*** Testing str_val() with scalar values***\n";
+$heredoc_string = <<<EOD
+This is a multiline heredoc
+string. Numeric = 1232455.
+EOD;
+/* heredoc string with only numeric values */
+$heredoc_numeric_string = <<<EOD
+12345
+2345
+EOD;
+/* null heredoc string */
+$heredoc_empty_string = <<<EOD
+EOD;
+/* heredoc string with NULL */
+$heredoc_NULL_string = <<<EOD
+NULL
+EOD;
+
+// different valid scalar vlaues
+$scalars = array(
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+
+ /* floats */
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e-5,
+ .5e+7,
+ .6e-19,
+ .05E+44,
+ .0034E-30,
+
+ /* booleans */
+ true,
+ TRUE,
+ FALSE,
+ false,
+
+ /* strings */
+ "",
+ '',
+ " ",
+ ' ',
+ '0',
+ "0",
+ "testing",
+ "0x564",
+ "0123",
+ "new\n",
+ 'new\n',
+ "@#$$%^&&*()",
+ " ",
+ "null",
+ 'null',
+ 'true',
+ "true",
+ /*"\0123",
+ "\0x12FF",*/
+ $heredoc_string,
+ $heredoc_numeric_string,
+ $heredoc_empty_string
+);
+/* loop to check that strval() recognizes different
+ scalar values and retuns the string conversion of same */
+$loop_counter = 1;
+foreach ($scalars as $scalar ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( strval($scalar) );
+}
+
+echo "\n*** Testing strval() with non_scalar values ***\n";
+// get a resource type variable
+$fp = fopen(__FILE__, "r");
+$dfp = opendir( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+
+$not_scalars = array (
+ new foo, //object
+ $fp, // resource
+ $dfp,
+ array(), // arrays
+ array(NULL),
+ array(1,2,3,4),
+ array("string"),
+ NULL, // nulls
+ null,
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_scalars to see working of
+ strval() on objects, arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_scalars as $value ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( strval($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( strval() );
+
+//arguments more than expected
+var_dump( strval( $scalars[0], $scalars[1]) );
+
+echo "Done\n";
+?>
+
+--CLEAN--
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+--EXPECTF--
+*** Testing str_val() with scalar values***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(2) "-1"
+-- Iteration 4 --
+string(11) "-2147483648"
+-- Iteration 5 --
+string(11) "-2147483647"
+-- Iteration 6 --
+string(10) "2147483647"
+-- Iteration 7 --
+string(10) "2147483640"
+-- Iteration 8 --
+string(4) "4667"
+-- Iteration 9 --
+string(4) "4779"
+-- Iteration 10 --
+string(4) "4095"
+-- Iteration 11 --
+string(3) "250"
+-- Iteration 12 --
+string(11) "-2147483648"
+-- Iteration 13 --
+string(10) "2147483647"
+-- Iteration 14 --
+string(10) "2147483647"
+-- Iteration 15 --
+string(2) "83"
+-- Iteration 16 --
+string(1) "1"
+-- Iteration 17 --
+string(11) "-2147483648"
+-- Iteration 18 --
+string(10) "2147483647"
+-- Iteration 19 --
+string(11) "-2147483649"
+-- Iteration 20 --
+string(10) "2147483648"
+-- Iteration 21 --
+string(11) "-2147483649"
+-- Iteration 22 --
+string(11) "34359738369"
+-- Iteration 23 --
+string(10) "2147483649"
+-- Iteration 24 --
+string(11) "-2147483649"
+-- Iteration 25 --
+string(1) "0"
+-- Iteration 26 --
+string(4) "-0.1"
+-- Iteration 27 --
+string(2) "10"
+-- Iteration 28 --
+string(7) "1050000"
+-- Iteration 29 --
+string(6) "1.0E-5"
+-- Iteration 30 --
+string(7) "5000000"
+-- Iteration 31 --
+string(7) "6.0E-20"
+-- Iteration 32 --
+string(7) "5.0E+42"
+-- Iteration 33 --
+string(7) "3.4E-33"
+-- Iteration 34 --
+string(1) "1"
+-- Iteration 35 --
+string(1) "1"
+-- Iteration 36 --
+string(0) ""
+-- Iteration 37 --
+string(0) ""
+-- Iteration 38 --
+string(0) ""
+-- Iteration 39 --
+string(0) ""
+-- Iteration 40 --
+string(1) " "
+-- Iteration 41 --
+string(1) " "
+-- Iteration 42 --
+string(1) "0"
+-- Iteration 43 --
+string(1) "0"
+-- Iteration 44 --
+string(7) "testing"
+-- Iteration 45 --
+string(5) "0x564"
+-- Iteration 46 --
+string(4) "0123"
+-- Iteration 47 --
+string(4) "new
+"
+-- Iteration 48 --
+string(5) "new\n"
+-- Iteration 49 --
+string(11) "@#$$%^&&*()"
+-- Iteration 50 --
+string(8) " "
+-- Iteration 51 --
+string(4) "null"
+-- Iteration 52 --
+string(4) "null"
+-- Iteration 53 --
+string(4) "true"
+-- Iteration 54 --
+string(4) "true"
+-- Iteration 55 --
+string(54) "This is a multiline heredoc
+string. Numeric = 1232455."
+-- Iteration 56 --
+string(10) "12345
+2345"
+-- Iteration 57 --
+string(0) ""
+
+*** Testing strval() with non_scalar values ***
+-- Iteration 1 --
+string(6) "Object"
+-- Iteration 2 --
+string(14) "Resource id #5"
+-- Iteration 3 --
+string(14) "Resource id #6"
+-- Iteration 4 --
+string(5) "Array"
+-- Iteration 5 --
+string(5) "Array"
+-- Iteration 6 --
+string(5) "Array"
+-- Iteration 7 --
+string(5) "Array"
+-- Iteration 8 --
+string(0) ""
+-- Iteration 9 --
+string(0) ""
+-- Iteration 10 --
+string(0) ""
+-- Iteration 11 --
+string(0) ""
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for strval() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for strval() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt
new file mode 100644
index 000000000..55fb56e59
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_dump.phpt
@@ -0,0 +1,1911 @@
+--TEST--
+Test var_dump() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: void var_dump ( mixed $expression [, mixed $expression [, $...]] );
+ Description: Displays structured information about one or more expressions that includes its type and value.
+*/
+
+/* Prototype: void check_vardump( $variables );
+ Description: use var_dump() to display the variables */
+function check_vardump( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "-- Iteration $counter --\n";
+ var_dump($variable);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing var_dump() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_vardump() to display contents of integer variables
+ using var_dump() */
+check_vardump($integers);
+
+echo "\n*** Testing var_dump() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_vardump() to display contents of float variables
+ using var_dump() */
+check_vardump($floats);
+
+echo "\n*** Testing var_dump() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_vardump() to display contents of strings
+ using var_dump() */
+check_vardump($strings);
+
+echo "\n*** Testing var_dump() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_vardump() to display boolean variables
+ using var_dump() */
+check_vardump($booleans);
+
+echo "\n*** Testing var_dump() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_vardump() to display contents of an array
+ using var_dump() */
+check_vardump($arrays);
+
+echo "\n*** Testing var_dump() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_vardump() to display contents of the objects
+ using var_dump() */
+check_vardump($objects);
+
+echo "\n** Testing var_dump() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+var_dump($recursion_obj2);
+
+echo "\n*** Testing var_dump() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_vardump() to display the resource content type
+ using var_dump() */
+check_vardump($resources);
+
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_vardump() to display combinations of scalar and
+ non-scalar variables using var_dump() */
+check_vardump($variations);
+
+echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_vardump() to display miscelleneous data using var_dump() */
+check_vardump($misc_values);
+
+echo "\n*** Testing var_dump() on multiple arguments ***\n";
+var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
+ $objects, $misc_values, $variations );
+
+/* checking var_dump() on functions */
+echo "\n*** Testing var_dump() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+var_dump( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump();
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing var_dump() on integer variables ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(83)
+-- Iteration 3 --
+int(123000000)
+-- Iteration 4 --
+int(-83)
+-- Iteration 5 --
+int(-12300000)
+-- Iteration 6 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+-- Iteration 7 --
+array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+}
+-- Iteration 8 --
+int(2147483647)
+-- Iteration 9 --
+float(2147483648)
+-- Iteration 10 --
+float(-2147483648)
+-- Iteration 11 --
+int(-2147483647)
+-- Iteration 12 --
+int(2147483647)
+-- Iteration 13 --
+float(-2147483648)
+-- Iteration 14 --
+int(2147483647)
+-- Iteration 15 --
+float(-2147483648)
+
+*** Testing var_dump() on float variables ***
+-- Iteration 1 --
+float(0)
+-- Iteration 2 --
+float(0)
+-- Iteration 3 --
+float(1.234)
+-- Iteration 4 --
+float(-1.234)
+-- Iteration 5 --
+float(-2)
+-- Iteration 6 --
+float(2)
+-- Iteration 7 --
+float(-0.5)
+-- Iteration 8 --
+float(0.567)
+-- Iteration 9 --
+float(-0.00067)
+-- Iteration 10 --
+float(-670)
+-- Iteration 11 --
+float(670)
+-- Iteration 12 --
+float(670)
+-- Iteration 13 --
+float(-0.00410003)
+-- Iteration 14 --
+float(-4100.03)
+-- Iteration 15 --
+float(0.004100003)
+-- Iteration 16 --
+float(4100.003)
+-- Iteration 17 --
+float(100000)
+-- Iteration 18 --
+float(-100000)
+-- Iteration 19 --
+float(1.0E-5)
+-- Iteration 20 --
+float(-1.0E-5)
+-- Iteration 21 --
+float(100000)
+-- Iteration 22 --
+float(-100000)
+-- Iteration 23 --
+float(100000)
+-- Iteration 24 --
+float(-100000)
+-- Iteration 25 --
+float(100000)
+-- Iteration 26 --
+float(-100000)
+-- Iteration 27 --
+float(1.0E-5)
+-- Iteration 28 --
+float(-1.0E-5)
+-- Iteration 29 --
+float(-2147483649)
+-- Iteration 30 --
+float(2147483649)
+-- Iteration 31 --
+float(2147483649)
+-- Iteration 32 --
+float(-2147483649)
+
+*** Testing var_dump() on string variables ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(1) " "
+-- Iteration 4 --
+string(1) " "
+-- Iteration 5 --
+string(1) "0"
+-- Iteration 6 --
+string(1) "
+-- Iteration 7 --
+string(2) "\0"
+-- Iteration 8 --
+string(1) " "
+-- Iteration 9 --
+string(2) "\t"
+-- Iteration 10 --
+string(3) "PHP"
+-- Iteration 11 --
+string(3) "PHP"
+-- Iteration 12 --
+string(29) "abcd
+-- Iteration 13 --
+string(34) "abcd
+-- Iteration 14 --
+string(22) "1234
+5678
+ 9100 abcda"
+
+*** Testing var_dump() on boolean variables ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+
+*** Testing var_dump() on array variables ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+-- Iteration 9 --
+array(1) {
+ [1]=>
+ string(3) "One"
+}
+-- Iteration 10 --
+array(1) {
+ ["test"]=>
+ string(8) "is_array"
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ int(-1)
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+}
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+
+*** Testing var_dump() on object variables ***
+-- Iteration 1 --
+object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 2 --
+object(no_member_class)#%d (0) {
+}
+-- Iteration 3 --
+object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 4 --
+object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 5 --
+object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 6 --
+object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 7 --
+object(no_member_class)#%d (0) {
+}
+-- Iteration 8 --
+object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 9 --
+NULL
+
+** Testing var_dump() on objects having circular reference **
+object(object_class)#%d (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#%d (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#%d (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#%d (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ }
+}
+
+*** Testing var_dump() on resources ***
+-- Iteration 1 --
+resource(%d) of type (stream)
+-- Iteration 2 --
+resource(%d) of type (stream)
+
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ object(no_member_class)#%d (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+}
+
+*** Testing var_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL
+-- Iteration 2 --
+NULL
+-- Iteration 3 --
+NULL
+-- Iteration 4 --
+NULL
+
+*** Testing var_dump() on multiple arguments ***
+array(15) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(83)
+ [2]=>
+ int(123000000)
+ [3]=>
+ int(-83)
+ [4]=>
+ int(-12300000)
+ [5]=>
+ array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+ }
+ [6]=>
+ array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+ }
+ [7]=>
+ int(2147483647)
+ [8]=>
+ float(2147483648)
+ [9]=>
+ float(-2147483648)
+ [10]=>
+ int(-2147483647)
+ [11]=>
+ int(2147483647)
+ [12]=>
+ float(-2147483648)
+ [13]=>
+ int(2147483647)
+ [14]=>
+ float(-2147483648)
+}
+array(32) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(0)
+ [2]=>
+ float(1.234)
+ [3]=>
+ float(-1.234)
+ [4]=>
+ float(-2)
+ [5]=>
+ float(2)
+ [6]=>
+ float(-0.5)
+ [7]=>
+ float(0.567)
+ [8]=>
+ float(-0.00067)
+ [9]=>
+ float(-670)
+ [10]=>
+ float(670)
+ [11]=>
+ float(670)
+ [12]=>
+ float(-0.00410003)
+ [13]=>
+ float(-4100.03)
+ [14]=>
+ float(0.004100003)
+ [15]=>
+ float(4100.003)
+ [16]=>
+ float(100000)
+ [17]=>
+ float(-100000)
+ [18]=>
+ float(1.0E-5)
+ [19]=>
+ float(-1.0E-5)
+ [20]=>
+ float(100000)
+ [21]=>
+ float(-100000)
+ [22]=>
+ float(100000)
+ [23]=>
+ float(-100000)
+ [24]=>
+ float(100000)
+ [25]=>
+ float(-100000)
+ [26]=>
+ float(1.0E-5)
+ [27]=>
+ float(-1.0E-5)
+ [28]=>
+ float(-2147483649)
+ [29]=>
+ float(2147483649)
+ [30]=>
+ float(2147483649)
+ [31]=>
+ float(-2147483649)
+}
+array(14) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) " "
+ [4]=>
+ string(1) "0"
+ [5]=>
+ string(1) "
+ [6]=>
+ string(2) "\0"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(2) "\t"
+ [9]=>
+ string(3) "PHP"
+ [10]=>
+ string(3) "PHP"
+ [11]=>
+ string(29) "abcd
+ [12]=>
+ string(34) "abcd
+ [13]=>
+ string(22) "1234
+5678
+ 9100 abcda"
+}
+array(15) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ bool(true)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [5]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [6]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ }
+ [7]=>
+ array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ }
+ [8]=>
+ array(1) {
+ [1]=>
+ string(3) "One"
+ }
+ [9]=>
+ array(1) {
+ ["test"]=>
+ string(8) "is_array"
+ }
+ [10]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [11]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [12]=>
+ array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+ }
+ [13]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+ [14]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+array(2) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ resource(%d) of type (stream)
+}
+array(9) {
+ [0]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [1]=>
+ object(no_member_class)#%d (0) {
+ }
+ [2]=>
+ object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ }
+ [3]=>
+ object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#%d (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ }
+ [4]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [5]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [6]=>
+ object(no_member_class)#%d (0) {
+ }
+ [7]=>
+ object(object_class)#%d (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [8]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(6) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ object(no_member_class)#%d (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+ }
+ [3]=>
+ array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+ }
+ [4]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+ }
+ [5]=>
+ array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+ }
+}
+
+*** Testing var_dump() on anonymous functions ***
+New anonymous function:
+string(9) "2 * 3 = 6"
+string(9) "
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for var_dump() in %s on line %d
+Done
diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt
new file mode 100644
index 000000000..144d34bec
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt
@@ -0,0 +1,1911 @@
+--TEST--
+Test var_dump() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: void var_dump ( mixed $expression [, mixed $expression [, $...]] );
+ Description: Displays structured information about one or more expressions that includes its type and value.
+*/
+
+/* Prototype: void check_vardump( $variables );
+ Description: use var_dump() to display the variables */
+function check_vardump( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "-- Iteration $counter --\n";
+ var_dump($variable);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing var_dump() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_vardump() to display contents of integer variables
+ using var_dump() */
+check_vardump($integers);
+
+echo "\n*** Testing var_dump() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_vardump() to display contents of float variables
+ using var_dump() */
+check_vardump($floats);
+
+echo "\n*** Testing var_dump() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_vardump() to display contents of strings
+ using var_dump() */
+check_vardump($strings);
+
+echo "\n*** Testing var_dump() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_vardump() to display boolean variables
+ using var_dump() */
+check_vardump($booleans);
+
+echo "\n*** Testing var_dump() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_vardump() to display contents of an array
+ using var_dump() */
+check_vardump($arrays);
+
+echo "\n*** Testing var_dump() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_vardump() to display contents of the objects
+ using var_dump() */
+check_vardump($objects);
+
+echo "\n** Testing var_dump() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+var_dump($recursion_obj2);
+
+echo "\n*** Testing var_dump() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_vardump() to display the resource content type
+ using var_dump() */
+check_vardump($resources);
+
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_vardump() to display combinations of scalar and
+ non-scalar variables using var_dump() */
+check_vardump($variations);
+
+echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_vardump() to display miscelleneous data using var_dump() */
+check_vardump($misc_values);
+
+echo "\n*** Testing var_dump() on multiple arguments ***\n";
+var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
+ $objects, $misc_values, $variations );
+
+/* checking var_dump() on functions */
+echo "\n*** Testing var_dump() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+var_dump( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump();
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing var_dump() on integer variables ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(83)
+-- Iteration 3 --
+int(123000000)
+-- Iteration 4 --
+int(-83)
+-- Iteration 5 --
+int(-12300000)
+-- Iteration 6 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+-- Iteration 7 --
+array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+}
+-- Iteration 8 --
+int(2147483647)
+-- Iteration 9 --
+int(2147483648)
+-- Iteration 10 --
+int(-2147483648)
+-- Iteration 11 --
+int(-2147483647)
+-- Iteration 12 --
+int(2147483647)
+-- Iteration 13 --
+int(-2147483648)
+-- Iteration 14 --
+int(2147483647)
+-- Iteration 15 --
+int(-2147483648)
+
+*** Testing var_dump() on float variables ***
+-- Iteration 1 --
+float(0)
+-- Iteration 2 --
+float(0)
+-- Iteration 3 --
+float(1.234)
+-- Iteration 4 --
+float(-1.234)
+-- Iteration 5 --
+float(-2)
+-- Iteration 6 --
+float(2)
+-- Iteration 7 --
+float(-0.5)
+-- Iteration 8 --
+float(0.567)
+-- Iteration 9 --
+float(-0.00067)
+-- Iteration 10 --
+float(-670)
+-- Iteration 11 --
+float(670)
+-- Iteration 12 --
+float(670)
+-- Iteration 13 --
+float(-0.00410003)
+-- Iteration 14 --
+float(-4100.03)
+-- Iteration 15 --
+float(0.004100003)
+-- Iteration 16 --
+float(4100.003)
+-- Iteration 17 --
+float(100000)
+-- Iteration 18 --
+float(-100000)
+-- Iteration 19 --
+float(1.0E-5)
+-- Iteration 20 --
+float(-1.0E-5)
+-- Iteration 21 --
+float(100000)
+-- Iteration 22 --
+float(-100000)
+-- Iteration 23 --
+float(100000)
+-- Iteration 24 --
+float(-100000)
+-- Iteration 25 --
+float(100000)
+-- Iteration 26 --
+float(-100000)
+-- Iteration 27 --
+float(1.0E-5)
+-- Iteration 28 --
+float(-1.0E-5)
+-- Iteration 29 --
+int(-2147483649)
+-- Iteration 30 --
+int(2147483649)
+-- Iteration 31 --
+int(2147483649)
+-- Iteration 32 --
+int(-2147483649)
+
+*** Testing var_dump() on string variables ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(1) " "
+-- Iteration 4 --
+string(1) " "
+-- Iteration 5 --
+string(1) "0"
+-- Iteration 6 --
+string(1) "
+-- Iteration 7 --
+string(2) "\0"
+-- Iteration 8 --
+string(1) " "
+-- Iteration 9 --
+string(2) "\t"
+-- Iteration 10 --
+string(3) "PHP"
+-- Iteration 11 --
+string(3) "PHP"
+-- Iteration 12 --
+string(29) "abcd
+-- Iteration 13 --
+string(34) "abcd
+-- Iteration 14 --
+string(22) "1234
+5678
+ 9100 abcda"
+
+*** Testing var_dump() on boolean variables ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+
+*** Testing var_dump() on array variables ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+-- Iteration 9 --
+array(1) {
+ [1]=>
+ string(3) "One"
+}
+-- Iteration 10 --
+array(1) {
+ ["test"]=>
+ string(8) "is_array"
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ int(-1)
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+}
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+
+*** Testing var_dump() on object variables ***
+-- Iteration 1 --
+object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 2 --
+object(no_member_class)#7 (0) {
+}
+-- Iteration 3 --
+object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 4 --
+object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 5 --
+object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 6 --
+object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 7 --
+object(no_member_class)#4 (0) {
+}
+-- Iteration 8 --
+object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 9 --
+NULL
+
+** Testing var_dump() on objects having circular reference **
+object(object_class)#13 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#12 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#13 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#12 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ }
+}
+
+*** Testing var_dump() on resources ***
+-- Iteration 1 --
+resource(5) of type (stream)
+-- Iteration 2 --
+resource(6) of type (stream)
+
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+}
+
+*** Testing var_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL
+-- Iteration 2 --
+NULL
+-- Iteration 3 --
+NULL
+-- Iteration 4 --
+NULL
+
+*** Testing var_dump() on multiple arguments ***
+array(15) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(83)
+ [2]=>
+ int(123000000)
+ [3]=>
+ int(-83)
+ [4]=>
+ int(-12300000)
+ [5]=>
+ array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+ }
+ [6]=>
+ array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+ }
+ [7]=>
+ int(2147483647)
+ [8]=>
+ int(2147483648)
+ [9]=>
+ int(-2147483648)
+ [10]=>
+ int(-2147483647)
+ [11]=>
+ int(2147483647)
+ [12]=>
+ int(-2147483648)
+ [13]=>
+ int(2147483647)
+ [14]=>
+ int(-2147483648)
+}
+array(32) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(0)
+ [2]=>
+ float(1.234)
+ [3]=>
+ float(-1.234)
+ [4]=>
+ float(-2)
+ [5]=>
+ float(2)
+ [6]=>
+ float(-0.5)
+ [7]=>
+ float(0.567)
+ [8]=>
+ float(-0.00067)
+ [9]=>
+ float(-670)
+ [10]=>
+ float(670)
+ [11]=>
+ float(670)
+ [12]=>
+ float(-0.00410003)
+ [13]=>
+ float(-4100.03)
+ [14]=>
+ float(0.004100003)
+ [15]=>
+ float(4100.003)
+ [16]=>
+ float(100000)
+ [17]=>
+ float(-100000)
+ [18]=>
+ float(1.0E-5)
+ [19]=>
+ float(-1.0E-5)
+ [20]=>
+ float(100000)
+ [21]=>
+ float(-100000)
+ [22]=>
+ float(100000)
+ [23]=>
+ float(-100000)
+ [24]=>
+ float(100000)
+ [25]=>
+ float(-100000)
+ [26]=>
+ float(1.0E-5)
+ [27]=>
+ float(-1.0E-5)
+ [28]=>
+ int(-2147483649)
+ [29]=>
+ int(2147483649)
+ [30]=>
+ int(2147483649)
+ [31]=>
+ int(-2147483649)
+}
+array(14) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) " "
+ [4]=>
+ string(1) "0"
+ [5]=>
+ string(1) "
+ [6]=>
+ string(2) "\0"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(2) "\t"
+ [9]=>
+ string(3) "PHP"
+ [10]=>
+ string(3) "PHP"
+ [11]=>
+ string(29) "abcd
+ [12]=>
+ string(34) "abcd
+ [13]=>
+ string(22) "1234
+5678
+ 9100 abcda"
+}
+array(15) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ bool(true)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [5]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [6]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ }
+ [7]=>
+ array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ }
+ [8]=>
+ array(1) {
+ [1]=>
+ string(3) "One"
+ }
+ [9]=>
+ array(1) {
+ ["test"]=>
+ string(8) "is_array"
+ }
+ [10]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [11]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [12]=>
+ array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+ }
+ [13]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+ [14]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+array(2) {
+ [0]=>
+ resource(5) of type (stream)
+ [1]=>
+ resource(6) of type (stream)
+}
+array(9) {
+ [0]=>
+ object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [1]=>
+ object(no_member_class)#7 (0) {
+ }
+ [2]=>
+ object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ }
+ [3]=>
+ object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3:private"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4:protected"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ }
+ [4]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [5]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [6]=>
+ object(no_member_class)#4 (0) {
+ }
+ [7]=>
+ object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1:private"]=>
+ int(20)
+ ["private_var2:private"]=>
+ int(21)
+ ["protected_var1:protected"]=>
+ string(8) "string_1"
+ ["protected_var2:protected"]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [8]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(6) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+ }
+ [3]=>
+ array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+ }
+ [4]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+ }
+ [5]=>
+ array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+ }
+}
+
+*** Testing var_dump() on anonymous functions ***
+New anonymous function:
+string(9) "2 * 3 = 6"
+string(9) "
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for var_dump() in %s on line %d
+Done
diff --git a/ext/standard/tests/general_functions/var_export.phpt b/ext/standard/tests/general_functions/var_export.phpt
new file mode 100644
index 000000000..2a99c5bd8
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export.phpt
@@ -0,0 +1,1054 @@
+--TEST--
+Test var_export() function
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: mixed var_export( mixed expression [, bool return]);
+ * Description: Returns the variable representation when the return parameter is used and evaluates to TRUE. Otherwise, this function will return NULL.
+
+*/
+
+echo "*** Testing var_export() with integer values ***\n";
+// different integer vlaues
+$valid_ints = array(
+ '0',
+ '1',
+ '-1',
+ '-2147483648', // max negative integer value
+ '-2147483647',
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ '0x12ab',
+ '0Xfff',
+ '0XFA',
+ -0x80000000, // max negative integer as hexadecimal
+ '0x7fffffff', // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ '0123', // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ );
+$counter = 1;
+/* Loop to check for above integer values with var_export() */
+echo "\n*** Output for integer values ***\n";
+foreach($valid_ints as $int_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $int_value );
+echo "\n";
+var_export( $int_value, FALSE);
+echo "\n";
+var_dump( var_export( $int_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bool = array(
+ 1,
+ TRUE,
+ true,
+ 0,
+ FALSE,
+ false
+ );
+$counter = 1;
+/* Loop to check for above boolean values with var_export() */
+echo "\n*** Output for boolean values ***\n";
+foreach($valid_bool as $bool_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $bool_value );
+echo "\n";
+var_export( $bool_value, FALSE);
+echo "\n";
+var_dump( var_export( $bool_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid float values ***\n";
+// different valid float vlaues
+$valid_floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ 1e-5,
+ 1e+5,
+ 1E5,
+ 1E+5,
+ 1E-5,
+ .5e+7,
+ .6e-19,
+ .05E+44,
+ .0034E-30
+);
+$counter = 1;
+/* Loop to check for above float values with var_export() */
+echo "\n*** Output for float values ***\n";
+foreach($valid_bool as $float_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $float_value );
+echo "\n";
+var_export( $float_value, FALSE);
+echo "\n";
+var_dump( var_export( $float_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid strings ***\n";
+// different valid string
+$valid_strings = array(
+ "",
+ " ",
+ '',
+ ' ',
+ "string",
+ 'string',
+ "NULL",
+ 'null',
+ "FALSE",
+ 'false',
+ "\x0b",
+ "\0",
+ '\0',
+ '\060',
+ "\070"
+ );
+$counter = 1;
+/* Loop to check for above strings with var_export() */
+echo "\n*** Output for strings ***\n";
+foreach($valid_strings as $str) {
+echo "\nIteration ".$counter."\n";
+var_export( $str );
+echo "\n";
+var_export( $str, FALSE);
+echo "\n";
+var_dump( var_export( $str, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid arrays ***\n";
+// different valid arrays
+$valid_arrays = array(
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test')
+ );
+$counter = 1;
+/* Loop to check for above arrays with var_export() */
+echo "\n*** Output for arrays ***\n";
+foreach($valid_arrays as $arr) {
+echo "\nIteration ".$counter."\n";
+var_export( $arr );
+echo "\n";
+var_export( $arr, FALSE);
+echo "\n";
+var_dump( var_export( $arr, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface iValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+// implement the interface
+class Value implements iValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_export ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ new stdclass,
+ new foo,
+ new concreteClass,
+ new Value,
+ new myClass,
+ $myClass_object,
+ $myClass_object->foo_object,
+ $myClass_object->public_var1,
+ $foo_object,
+ $Value_object,
+ $concreteClass_object
+ );
+ $counter = 1;
+/* Loop to check for above objects with var_export() */
+echo "\n*** Output for objects ***\n";
+foreach($valid_objects as $obj) {
+echo "\nIteration ".$counter."\n";
+var_export( $obj );
+echo "\n";
+var_export( $obj, FALSE);
+echo "\n";
+var_dump( var_export( $obj, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid null values ***\n";
+// different valid null vlaues
+$unset_var = array();
+unset ($unset_var); // now a null
+$null_var = NULL;
+
+$valid_nulls = array(
+ NULL,
+ null,
+ $null_var,
+ );
+ $counter = 1;
+/* Loop to check for above null values with var_export() */
+echo "\n*** Output for null values ***\n";
+foreach($valid_nulls as $null_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $null_value );
+echo "\n";
+var_export( $null_value, FALSE);
+echo "\n";
+var_dump( var_export( $null_value, true) );
+echo "\n";
+$counter++;
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_export( var_export() );
+
+//arguments more than expected
+var_export( var_export(TRUE, FALSE, TRUE) );
+
+echo "\n\nDone";
+
+
+?>
+--EXPECTF--
+*** Testing var_export() with integer values ***
+
+*** Output for integer values ***
+
+Iteration 1
+'0'
+'0'
+string(3) "'0'"
+
+
+Iteration 2
+'1'
+'1'
+string(3) "'1'"
+
+
+Iteration 3
+'-1'
+'-1'
+string(4) "'-1'"
+
+
+Iteration 4
+'-2147483648'
+'-2147483648'
+string(13) "'-2147483648'"
+
+
+Iteration 5
+'-2147483647'
+'-2147483647'
+string(13) "'-2147483647'"
+
+
+Iteration 6
+2147483647
+2147483647
+string(10) "2147483647"
+
+
+Iteration 7
+2147483640
+2147483640
+string(10) "2147483640"
+
+
+Iteration 8
+4667
+4667
+string(4) "4667"
+
+
+Iteration 9
+'0x12ab'
+'0x12ab'
+string(8) "'0x12ab'"
+
+
+Iteration 10
+'0Xfff'
+'0Xfff'
+string(7) "'0Xfff'"
+
+
+Iteration 11
+'0XFA'
+'0XFA'
+string(6) "'0XFA'"
+
+
+Iteration 12
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+
+Iteration 13
+'0x7fffffff'
+'0x7fffffff'
+string(12) "'0x7fffffff'"
+
+
+Iteration 14
+2147483647
+2147483647
+string(10) "2147483647"
+
+
+Iteration 15
+'0123'
+'0123'
+string(6) "'0123'"
+
+
+Iteration 16
+1
+1
+string(1) "1"
+
+
+Iteration 17
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+
+Iteration 18
+2147483647
+2147483647
+string(10) "2147483647"
+
+*** Testing var_export() with valid boolean values ***
+
+*** Output for boolean values ***
+
+Iteration 1
+1
+1
+string(1) "1"
+
+
+Iteration 2
+true
+true
+string(4) "true"
+
+
+Iteration 3
+true
+true
+string(4) "true"
+
+
+Iteration 4
+0
+0
+string(1) "0"
+
+
+Iteration 5
+false
+false
+string(5) "false"
+
+
+Iteration 6
+false
+false
+string(5) "false"
+
+*** Testing var_export() with valid float values ***
+
+*** Output for float values ***
+
+Iteration 1
+1
+1
+string(1) "1"
+
+
+Iteration 2
+true
+true
+string(4) "true"
+
+
+Iteration 3
+true
+true
+string(4) "true"
+
+
+Iteration 4
+0
+0
+string(1) "0"
+
+
+Iteration 5
+false
+false
+string(5) "false"
+
+
+Iteration 6
+false
+false
+string(5) "false"
+
+*** Testing var_export() with valid strings ***
+
+*** Output for strings ***
+
+Iteration 1
+''
+''
+string(2) "''"
+
+
+Iteration 2
+' '
+' '
+string(3) "' '"
+
+
+Iteration 3
+''
+''
+string(2) "''"
+
+
+Iteration 4
+' '
+' '
+string(3) "' '"
+
+
+Iteration 5
+'string'
+'string'
+string(8) "'string'"
+
+
+Iteration 6
+'string'
+'string'
+string(8) "'string'"
+
+
+Iteration 7
+'NULL'
+'NULL'
+string(6) "'NULL'"
+
+
+Iteration 8
+'null'
+'null'
+string(6) "'null'"
+
+
+Iteration 9
+'FALSE'
+'FALSE'
+string(7) "'FALSE'"
+
+
+Iteration 10
+'false'
+'false'
+string(7) "'false'"
+
+
+Iteration 11
+' '
+' '
+string(3) "' '"
+
+
+Iteration 12
+'\000'
+'\000'
+string(6) "'\000'"
+
+
+Iteration 13
+'\\0'
+'\\0'
+string(5) "'\\0'"
+
+
+Iteration 14
+'\\060'
+'\\060'
+string(7) "'\\060'"
+
+
+Iteration 15
+'8'
+'8'
+string(3) "'8'"
+
+*** Testing var_export() with valid arrays ***
+
+*** Output for arrays ***
+
+Iteration 1
+array (
+)
+array (
+)
+string(9) "array (
+)"
+
+
+Iteration 2
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+Iteration 3
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+Iteration 4
+array (
+ 0 => true,
+)
+array (
+ 0 => true,
+)
+string(22) "array (
+ 0 => true,
+)"
+
+
+Iteration 5
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+Iteration 6
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+Iteration 7
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+string(55) "array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)"
+
+
+Iteration 8
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+string(107) "array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)"
+
+
+Iteration 9
+array (
+ 1 => 'One',
+)
+array (
+ 1 => 'One',
+)
+string(23) "array (
+ 1 => 'One',
+)"
+
+
+Iteration 10
+array (
+ 'test' => 'is_array',
+)
+array (
+ 'test' => 'is_array',
+)
+string(33) "array (
+ 'test' => 'is_array',
+)"
+
+
+Iteration 11
+array (
+ 0 => 0,
+)
+array (
+ 0 => 0,
+)
+string(19) "array (
+ 0 => 0,
+)"
+
+
+Iteration 12
+array (
+ 0 => -1,
+)
+array (
+ 0 => -1,
+)
+string(20) "array (
+ 0 => -1,
+)"
+
+
+Iteration 13
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+string(34) "array (
+ 0 => 10.5,
+ 1 => 5.6,
+)"
+
+
+Iteration 14
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+
+Iteration 15
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+*** Testing var_export() with valid objects ***
+
+*** Output for objects ***
+
+Iteration 1
+stdClass::__set_state(array(
+))
+stdClass::__set_state(array(
+))
+string(31) "stdClass::__set_state(array(
+))"
+
+
+Iteration 2
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 3
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+
+Iteration 4
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+Iteration 5
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+Iteration 6
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+Iteration 7
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 8
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 9
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 10
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+Iteration 11
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+*** Testing var_export() with valid null values ***
+
+*** Output for null values ***
+
+Iteration 1
+NULL
+NULL
+string(4) "NULL"
+
+
+Iteration 2
+NULL
+NULL
+string(4) "NULL"
+
+
+Iteration 3
+NULL
+NULL
+string(4) "NULL"
+
+
+*** Testing error conditions ***
+
+Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Done
diff --git a/ext/standard/tests/image/iptcembed_001.phpt b/ext/standard/tests/image/iptcembed_001.phpt
new file mode 100644
index 000000000..feadddea1
--- /dev/null
+++ b/ext/standard/tests/image/iptcembed_001.phpt
@@ -0,0 +1,18 @@
+--TEST--
+iptcembed() and wrong file
+--FILE--
+<?php
+
+$file = dirname(__FILE__).'/iptcembed_001.data';
+$fp = fopen($file, "w");
+fwrite($fp, "-1-1");
+fclose($fp);
+
+var_dump(iptcembed(-1, $file, -1));
+unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+Done
diff --git a/ext/standard/tests/math/bug25694.phpt b/ext/standard/tests/math/bug25694.phpt
index 165e1db08..d40d2b8cf 100644
--- a/ext/standard/tests/math/bug25694.phpt
+++ b/ext/standard/tests/math/bug25694.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #25694 (round() and number_format() inconsistency)
+--INI--
+precision=14
--FILE--
<?php
echo "round 0.045 = " . round(0.045, 2) . "\n";
diff --git a/ext/standard/tests/network/bug41347.phpt b/ext/standard/tests/network/bug41347.phpt
new file mode 100644
index 000000000..ef93a202b
--- /dev/null
+++ b/ext/standard/tests/network/bug41347.phpt
@@ -0,0 +1,19 @@
+--TEST--
+dns_check_record() segfault with empty host
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('No windows support');
+}
+?>
+--FILE--
+<?php
+var_dump(dns_check_record(''));
+var_dump(dns_check_record('', ''));
+?>
+--EXPECTF--
+Warning: dns_check_record(): Host cannot be empty in %s on line %d
+bool(false)
+
+Warning: dns_check_record(): Host and type cannot be empty in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/strings/005.phpt b/ext/standard/tests/strings/005.phpt
new file mode 100644
index 000000000..a69ff4942
--- /dev/null
+++ b/ext/standard/tests/strings/005.phpt
@@ -0,0 +1,24 @@
+--TEST--
+highlight_string(), output buffer and error level
+--INI--
+error_reporting=8192
+--FILE--
+<?php
+
+echo "hello\n";
+
+$string = str_repeat("A", 1024);
+
+var_dump(error_reporting());
+highlight_string($string, true);
+var_dump(ob_get_contents());
+var_dump(error_reporting());
+
+echo "Done\n";
+?>
+--EXPECTF--
+hello
+int(8192)
+bool(false)
+int(8192)
+Done
diff --git a/ext/standard/tests/strings/006.phpt b/ext/standard/tests/strings/006.phpt
new file mode 100644
index 000000000..f0156ccf6
--- /dev/null
+++ b/ext/standard/tests/strings/006.phpt
@@ -0,0 +1,19 @@
+--TEST--
+highlight_file() and output buffer
+--FILE--
+<?php
+
+$file = str_repeat("A", 1024);
+
+var_dump(highlight_file($file, true));
+var_dump(ob_get_contents());
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: highlight_file(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA in %s on line %d
+
+Warning: highlight_file(): Failed opening 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/007.phpt b/ext/standard/tests/strings/007.phpt
new file mode 100644
index 000000000..e0e516389
--- /dev/null
+++ b/ext/standard/tests/strings/007.phpt
@@ -0,0 +1,17 @@
+--TEST--
+php_strip_whitespace() and output buffer
+--FILE--
+<?php
+
+$file = str_repeat("A", 1024);
+
+var_dump(php_strip_whitespace($file));
+var_dump(ob_get_contents());
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: php_strip_whitespace(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA in %s on line %d
+string(0) ""
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/addcslashes.phpt b/ext/standard/tests/strings/addcslashes.phpt
new file mode 100644
index 000000000..2ff4c4024
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/basename_basic.phpt b/ext/standard/tests/strings/basename_basic.phpt
new file mode 100644
index 000000000..fa0d410e5
--- /dev/null
+++ b/ext/standard/tests/strings/basename_basic.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/basename_error.phpt b/ext/standard/tests/strings/basename_error.phpt
new file mode 100644
index 000000000..bd7741d0e
--- /dev/null
+++ b/ext/standard/tests/strings/basename_error.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test basename() function : error conditions
+--FILE--
+<?php
+/* Prototype: string basename ( string $path [, string $suffix] );
+ Description: Given a string containing a path to a file,
+ this function will return the base name of the file.
+ If the filename ends in suffix this will also be cut off.
+*/
+echo "*** Testing error conditions ***\n";
+// zero arguments
+var_dump( basename() );
+
+// more than expected no. of arguments
+var_dump( basename("/var/tmp/bar.gz", ".gz", ".gz") );
+
+// passing invalid type arguments
+$object = new stdclass;
+var_dump( basename( array("string/bar") ) );
+var_dump( basename( array("string/bar"), "bar" ) );
+var_dump( basename( "bar", array("string/bar") ) );
+var_dump( basename( $object, "bar" ) );
+var_dump( basename( $object ) );
+var_dump( basename( $object, $object ) );
+var_dump( basename( "bar", $object ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: basename() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: basename() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: basename() expects parameter 2 to be string, object given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/basename_variation.phpt b/ext/standard/tests/strings/basename_variation.phpt
new file mode 100644
index 000000000..2d74a389a
--- /dev/null
+++ b/ext/standard/tests/strings/basename_variation.phpt
@@ -0,0 +1,235 @@
+--TEST--
+Test basename() function : usage variations
+--FILE--
+<?php
+/* Prototype: string basename ( string $path [, string $suffix] );
+ Description: Given a string containing a path to a file,
+ this function will return the base name of the file.
+ If the filename ends in suffix this will also be cut off.
+*/
+$file_path_variations = array (
+ /* paths with shortcut home dir char, with suffix variation */
+ array("~/home/user/bar"),
+ array("~/home/user/bar", ""),
+ array("~/home/user/bar", NULL),
+ array("~/home/user/bar", ' '),
+ array("~/home/user/bar.tar", ".tar"),
+ array("~/home/user/bar.tar", "~"),
+ array("~/home/user/bar.tar/", "~"),
+ array("~/home/user/bar.tar/", ""),
+ array("~/home/user/bar.tar", NULL),
+ array("~/home/user/bar.tar", ''),
+ array("~/home/user/bar.tar", " "),
+
+ /* paths with hostname:dir notation, with suffix variation */
+ array("hostname:/home/usr/bar.tar"),
+ array("hostname:/home/user/bar.tar", "home"),
+ array("hostname:/home/user/tbar.gz", "bar.gz"),
+ array("hostname:/home/user/tbar.gz", "/bar.gz"),
+ array("hostname:/home/user/tbar.gz", "/bar.gz/"),
+ array("hostname:/home/user/tbar.gz/", "/bar.gz/"),
+ array("hostname:/home/user/tbar.gz/", "/bar.gz/"),
+ array("hostname:/home/user/My Pics.gz/", "/bar.gz/"),
+ array("hostname:/home/user/My Pics.gz/", "Pics.gz/"),
+ array("hostname:/home/user/My Pics.gz/", "Pics.gz"),
+ array("hostname:/home/user/My Pics.gz/", ".gz"),
+ array("hostname:/home/user/My Pics.gz/"),
+ array("hostname:/home/user/My Pics.gz/", NULL),
+ array("hostname:/home/user/My Pics.gz/", ' '),
+ array("hostname:/home/user/My Pics.gz/", ''),
+ array("hostname:/home/user/My Pics.gz/", "My Pics.gz"),
+
+ /* paths with numeirc strings */
+ array("10.5"),
+ array("10.5", ".5"),
+ array("10.5", "10.5"),
+ array("10"),
+ array("105", "5"),
+ array("/10.5"),
+ array("10.5/"),
+ array("10/10.gz"),
+ array("0"),
+ array('0'),
+
+ /* paths and suffix given as same */
+ array("bar.gz", "bar.gz"),
+ array("/bar.gz", "/bar.gz"),
+ array("/bar.gz/", "/bar.gz/"),
+ array(" ", " "),
+ array(' ', ' '),
+ array(NULL, NULL),
+
+ /* path with spaces */
+ array(" "),
+ array(' '),
+
+ /* empty paths */
+ array(""),
+ array(''),
+ array(NULL)
+);
+
+function check_basename( $path_arrays ) {
+ $loop_counter = 1;
+ foreach ($path_arrays as $path) {
+ echo "\n--Iteration $loop_counter--\n"; $loop_counter++;
+ if( 1 == count($path) ) { // no suffix provided
+ var_dump( basename($path[0]) );
+ } else { // path as well as suffix provided,
+ var_dump( basename($path[0], $path[1]) );
+ }
+ }
+}
+
+echo "*** Testing possible variations in path and suffix ***\n";
+check_basename( $file_path_variations );
+
+echo "Done\n";
+
+--EXPECTF--
+*** Testing possible variations in path and suffix ***
+
+--Iteration 1--
+string(3) "bar"
+
+--Iteration 2--
+string(3) "bar"
+
+--Iteration 3--
+string(3) "bar"
+
+--Iteration 4--
+string(3) "bar"
+
+--Iteration 5--
+string(3) "bar"
+
+--Iteration 6--
+string(7) "bar.tar"
+
+--Iteration 7--
+string(7) "bar.tar"
+
+--Iteration 8--
+string(7) "bar.tar"
+
+--Iteration 9--
+string(7) "bar.tar"
+
+--Iteration 10--
+string(7) "bar.tar"
+
+--Iteration 11--
+string(7) "bar.tar"
+
+--Iteration 12--
+string(7) "bar.tar"
+
+--Iteration 13--
+string(7) "bar.tar"
+
+--Iteration 14--
+string(1) "t"
+
+--Iteration 15--
+string(7) "tbar.gz"
+
+--Iteration 16--
+string(7) "tbar.gz"
+
+--Iteration 17--
+string(7) "tbar.gz"
+
+--Iteration 18--
+string(7) "tbar.gz"
+
+--Iteration 19--
+string(10) "My Pics.gz"
+
+--Iteration 20--
+string(10) "My Pics.gz"
+
+--Iteration 21--
+string(3) "My "
+
+--Iteration 22--
+string(7) "My Pics"
+
+--Iteration 23--
+string(10) "My Pics.gz"
+
+--Iteration 24--
+string(10) "My Pics.gz"
+
+--Iteration 25--
+string(10) "My Pics.gz"
+
+--Iteration 26--
+string(10) "My Pics.gz"
+
+--Iteration 27--
+string(10) "My Pics.gz"
+
+--Iteration 28--
+string(4) "10.5"
+
+--Iteration 29--
+string(2) "10"
+
+--Iteration 30--
+string(4) "10.5"
+
+--Iteration 31--
+string(2) "10"
+
+--Iteration 32--
+string(2) "10"
+
+--Iteration 33--
+string(4) "10.5"
+
+--Iteration 34--
+string(4) "10.5"
+
+--Iteration 35--
+string(5) "10.gz"
+
+--Iteration 36--
+string(1) "0"
+
+--Iteration 37--
+string(1) "0"
+
+--Iteration 38--
+string(6) "bar.gz"
+
+--Iteration 39--
+string(6) "bar.gz"
+
+--Iteration 40--
+string(6) "bar.gz"
+
+--Iteration 41--
+string(1) " "
+
+--Iteration 42--
+string(1) " "
+
+--Iteration 43--
+string(0) ""
+
+--Iteration 44--
+string(1) " "
+
+--Iteration 45--
+string(1) " "
+
+--Iteration 46--
+string(0) ""
+
+--Iteration 47--
+string(0) ""
+
+--Iteration 48--
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/bug36306.phpt b/ext/standard/tests/strings/bug36306.phpt
index ff6279a2d..2d8449aac 100644
--- a/ext/standard/tests/strings/bug36306.phpt
+++ b/ext/standard/tests/strings/bug36306.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #36306 crc32() 64bit
+Bug #36306 (crc32() 64bit)
--FILE--
<?php
diff --git a/ext/standard/tests/strings/chr_ord.phpt b/ext/standard/tests/strings/chr_ord.phpt
index 56cfef70a..8c91b4cba 100644
--- a/ext/standard/tests/strings/chr_ord.phpt
+++ b/ext/standard/tests/strings/chr_ord.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt
index b6bed3ab4..cfb817def 100644
--- a/ext/standard/tests/strings/chunk_split.phpt
+++ b/ext/standard/tests/strings/chunk_split.phpt
@@ -6,6 +6,12 @@ echo chunk_split('abc', 1, '-')."\n";
echo chunk_split('foooooooooooooooo', 5)."\n";
echo chunk_split(str_repeat('X', 2*76))."\n";
echo chunk_split("test", 10, "|end") . "\n";
+
+$a=str_repeat("B", 65535);
+$b=1;
+$c=str_repeat("B", 65535);
+var_dump(chunk_split($a,$b,$c));
+
?>
--EXPECT--
a-b-c-
@@ -18,3 +24,4 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
test|end
+bool(false)
diff --git a/ext/standard/tests/strings/dirname_basic.phpt b/ext/standard/tests/strings/dirname_basic.phpt
new file mode 100644
index 000000000..2b5e4d43d
--- /dev/null
+++ b/ext/standard/tests/strings/dirname_basic.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test dirname() function : basic funtionality
+--FILE--
+<?php
+/* Prototype: string dirname ( string $path );
+ Description: Returns directory name component of path.
+*/
+$file_paths = array (
+ /* simple paths */
+ "bar",
+ "/foo/bar",
+ "foo/bar",
+ "/bar",
+ "bar/",
+ "/bar/",
+ "/foo/bar/",
+ "foo/bar/",
+ "/bar/",
+
+ /* path with only files and trailing slashes*/
+ "/foo/bar.gz",
+ "foo/bar.gz",
+ "bar.gz",
+ "bar.gz/",
+ "/bar.gz",
+ "/bar.gz/",
+ "/foo/bar.gz/",
+ "foo/bar.gz/",
+ "/bar.gz/",
+
+ /* path with file extension and trailing slashes */
+ "/.gz",
+ ".gz",
+ "/foo/.gz",
+ ".gz/",
+ "/foo/.gz/",
+ "foo/.gz/",
+
+ /* paths with binary value to check if the function is binary safe*/
+ "foo".chr(0)."bar",
+ "/foo".chr(0)."bar/",
+ "/foo".chr(0)."bar",
+ "foo".chr(0)."bar/",
+ "/foo".chr(0)."bar/t.gz"
+);
+
+function check_dirname( $paths ) {
+ $loop_counter = 0;
+ $noOfPaths = count($paths);
+ for( ; $loop_counter < $noOfPaths; $loop_counter++ ) {
+ echo "\n--Iteration ";
+ echo $loop_counter + 1;
+ echo " --\n";
+ var_dump( dirname($paths[$loop_counter]) );
+ }
+}
+
+echo "*** Testing basic operations ***\n";
+check_dirname( $file_paths );
+
+echo "Done\n";
+?>
+
+--EXPECTREGEX--
+\*\*\* Testing basic operations \*\*\*
+
+--Iteration 1 --
+string\(1\) "."
+
+--Iteration 2 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 3 --
+string\(3\) "foo"
+
+--Iteration 4 --
+string\(1\) "(\\|\/)"
+
+--Iteration 5 --
+string\(1\) "."
+
+--Iteration 6 --
+string\(1\) "(\\|\/)"
+
+--Iteration 7 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 8 --
+string\(3\) "foo"
+
+--Iteration 9 --
+string\(1\) "(\\|\/)"
+
+--Iteration 10 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 11 --
+string\(3\) "foo"
+
+--Iteration 12 --
+string\(1\) "."
+
+--Iteration 13 --
+string\(1\) "."
+
+--Iteration 14 --
+string\(1\) "(\\|\/)"
+
+--Iteration 15 --
+string\(1\) "(\\|\/)"
+
+--Iteration 16 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 17 --
+string\(3\) "foo"
+
+--Iteration 18 --
+string\(1\) "(\\|\/)"
+
+--Iteration 19 --
+string\(1\) "(\\|\/)"
+
+--Iteration 20 --
+string\(1\) "."
+
+--Iteration 21 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 22 --
+string\(1\) "."
+
+--Iteration 23 --
+string\(4\) "(\\|\/)foo"
+
+--Iteration 24 --
+string\(3\) "foo"
+
+--Iteration 25 --
+string\(1\) "."
+
+--Iteration 26 --
+string\(1\) "(\\|\/)"
+
+--Iteration 27 --
+string\(1\) "(\\|\/)"
+
+--Iteration 28 --
+string\(1\) "."
+
+--Iteration 29 --
+string\(8\) "(\\|\/)foo\x00bar"
+Done
diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt
new file mode 100644
index 000000000..367169510
--- /dev/null
+++ b/ext/standard/tests/strings/dirname_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test dirname() function : error conditions
+--FILE--
+<?php
+/* Prototype: string dirname ( string $path );
+ Description: Returns directory name component of path.
+*/
+echo "*** Testing error conditions ***\n";
+// zero arguments
+var_dump( dirname() );
+
+// more than expected no. of arguments
+var_dump( dirname("/var/tmp/bar.gz", ".gz") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for dirname() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for dirname() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/dirname_variation.phpt b/ext/standard/tests/strings/dirname_variation.phpt
new file mode 100644
index 000000000..da66f0fc5
--- /dev/null
+++ b/ext/standard/tests/strings/dirname_variation.phpt
@@ -0,0 +1,143 @@
+--TEST--
+Test dirname() function : usage variations
+--FILE--
+<?php
+/* Prototype: string dirname ( string $path );
+ Description: Returns directory name component of path.
+*/
+class temp
+{
+ function __toString() {
+ return "Object";
+ }
+}
+
+$file_path_variations = array (
+ /* home dir shortcut char */
+ "~/home/user/bar",
+ "~/home/user/bar/",
+ "~/home/user/bar.tar",
+ "~/home/user/bar.tar/",
+
+ /* with hotname:dir notation */
+ "hostname:/home/user/bar.tar",
+ "hostname:/home/user/tbar.gz/",
+ "hostname:/home/user/My Pics.gz",
+ "hostname:/home/user/My Pics.gz/",
+ "hostname:/home/user/My Pics/",
+ "hostname:/home/user/My Pics",
+
+ /* path containing numeric string */
+ "10.5",
+ "/10.5",
+ "/10.5/",
+ "10.5/",
+ "10/10.gz",
+ '0',
+ "0",
+
+ /* object */
+ new temp,
+
+ /* path as spaces */
+ " ",
+ ' ',
+
+ /* empty path */
+ "",
+ '',
+ NULL,
+ null
+);
+
+function check_dirname( $paths ) {
+ $loop_counter = 0;
+ $noOfPaths = count($paths);
+ for( ; $loop_counter < $noOfPaths; $loop_counter++ ) {
+ echo "\n--Iteration ";
+ echo $loop_counter +1;
+ echo " --\n";
+ var_dump( dirname($paths[$loop_counter]) );
+ }
+}
+
+echo "*** Testing possible variations in path ***\n";
+check_dirname( $file_path_variations );
+
+echo "Done\n";
+?>
+--EXPECTREGEX--
+\*\*\* Testing possible variations in path \*\*\*
+
+--Iteration 1 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 2 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 3 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 4 --
+string\(11\) "~(\\|\/)home(\\|\/)user"
+
+--Iteration 5 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 6 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 7 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 8 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 9 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 10 --
+string\(19\) "hostname:(\\|\/)home(\\|\/)user"
+
+--Iteration 11 --
+string\(1\) "."
+
+--Iteration 12 --
+string\(1\) "(\\|\/)"
+
+--Iteration 13 --
+string\(1\) "(\\|\/)"
+
+--Iteration 14 --
+string\(1\) "."
+
+--Iteration 15 --
+string\(2\) "10"
+
+--Iteration 16 --
+string\(1\) "."
+
+--Iteration 17 --
+string\(1\) "."
+
+--Iteration 18 --
+string\(1\) "."
+
+--Iteration 19 --
+string\(1\) "."
+
+--Iteration 20 --
+string\(1\) "."
+
+--Iteration 21 --
+string\(0\) ""
+
+--Iteration 22 --
+string\(0\) ""
+
+--Iteration 23 --
+string\(0\) ""
+
+--Iteration 24 --
+string\(0\) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
new file mode 100644
index 000000000..27de79ae2
--- /dev/null
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -0,0 +1,509 @@
+--TEST--
+Test explode() function
+--INI--
+error_reporting=2047
+precision=14
+--FILE--
+<?php
+/* Prototype: array explode ( string $delimiter, string $string [, int $limit] );
+ Description: Returns an array of strings, each of which is a substring of string
+ formed by splitting it on boundaries formed by the string delimiter.
+ If limit is set, the returned array will contain a maximum of limit
+ elements with the last element containing the rest of string.
+*/
+
+echo "*** Testing explode() for basic operations ***\n";
+$delimiters = array (
+ "", // len=0
+ NULL,
+ "abcd", // string
+ 0, // zero
+ "0",
+ TRUE, // boolean value
+ FALSE,
+ -1, // negative integer
+ -11.23, // double
+ 4, // positive integer
+ "%",
+);
+$string = "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND";
+/* loop prints an array of strings, each of which is a substring of $string
+ formed by splitting it on boundaries formed by the string $delimiter.
+ */
+$counter = 1;
+foreach($delimiters as $delimiter) {
+ echo "-- Iteration $counter --\n";
+ var_dump( explode($delimiter, $string, -1) );
+ var_dump( explode($delimiter, $string, 0) );
+ var_dump( explode($delimiter, $string, 1) );
+ var_dump( explode($delimiter, $string, 2) );
+ $counter++;
+}
+
+echo "\n*** Testing explode() with miscelleneous input arguments ***\n";
+
+echo "\n-- Passing positive values of Limit to explode() --\n";
+/* LIMIT=2 */
+var_dump( explode("::", "mon::tues::wed::thurs::fri::sat::sun", 2) );
+
+/* checking for LIMIT =0,1 */
+echo "\n-- Passing limit values 0 and 1 to explode() --\n";
+var_dump( explode(":", "Name:Phone:Address:City:State", 0) );
+var_dump( explode(":", "Name:Phone:Address:City:State", 1) );
+
+/* to check the maximum limit of string that can be given with limit<=0,
+ default size is 50 but increases dynamically */
+echo "\n*** Testing explode() for maximum limit of string with Limit = -1 ***\n";
+var_dump( explode(":", "1:2:3:4:5:6:7:7:5:6:7:3:4:5:2:8:9:0:5:5:5:5:5:5:5:5:5:5:5:5:55:5:5:5%:%:%:%:5:5:5:%:%:5:5:5:5:5%:%:%:55:1:1", -1) );
+
+echo "\n*** Testing explode() with string variations as input argument ***\n";
+/* String with escape characters */
+echo "\n-- Testing string with escape characters --\n";
+var_dump( explode("\t\n", "1234\t\n5678\n\t9100") );
+var_dump( explode("\r", "1234\rabcd\r5678\rrstu") );
+
+/* String with embedded NULL */
+echo "\n-- Testing string with embedded NULL --\n";
+var_dump( explode("\x00", "abcd\x0n1234\x0005678\x0000efgh\xijkl") );
+var_dump( explode("\0", "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\000yz") );
+
+/* Checking OBJECTS type */
+echo "\n*** Testing explode() with objects ***\n";
+class string1 {
+ public function __toString() {
+ return "Object";
+ }
+}
+$obj = new string1;
+var_dump( explode("b", $obj) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for arguments <2 and >3 */
+var_dump( explode(":", "array1:array2:array3", -1, -33) );
+var_dump( explode(":") );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing explode() for basic operations ***
+-- Iteration 1 --
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(10) "1234NULL23"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(10) "1234NULL23"
+ [1]=>
+ string(43) "00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 4 --
+array(5) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(42) "0000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 5 --
+array(5) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(14) "1234NULL23abcd"
+ [1]=>
+ string(42) "0000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 6 --
+array(5) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(28) "234NULL23abcd00000TRUEFALSE-"
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(12) ".234444true-"
+ [4]=>
+ string(0) ""
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 7 --
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+
+Warning: explode(): Empty delimiter. in %s on line %d
+bool(false)
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+ [1]=>
+ string(12) "1.234444true"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+ [1]=>
+ string(27) "1.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(28) "1234NULL23abcd00000TRUEFALSE"
+ [1]=>
+ string(23) "4444true-11.24%PHP%ZEND"
+}
+-- Iteration 10 --
+array(6) {
+ [0]=>
+ string(3) "123"
+ [1]=>
+ string(30) "NULL23abcd00000TRUEFALSE-11.23"
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(9) "true-11.2"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(3) "123"
+ [1]=>
+ string(53) "NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ string(48) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24"
+ [1]=>
+ string(3) "PHP"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(1) {
+ [0]=>
+ string(57) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
+}
+array(2) {
+ [0]=>
+ string(48) "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24"
+ [1]=>
+ string(8) "PHP%ZEND"
+}
+
+*** Testing explode() with miscelleneous input arguments ***
+
+-- Passing positive values of Limit to explode() --
+array(2) {
+ [0]=>
+ string(3) "mon"
+ [1]=>
+ string(31) "tues::wed::thurs::fri::sat::sun"
+}
+
+-- Passing limit values 0 and 1 to explode() --
+array(1) {
+ [0]=>
+ string(29) "Name:Phone:Address:City:State"
+}
+array(1) {
+ [0]=>
+ string(29) "Name:Phone:Address:City:State"
+}
+
+*** Testing explode() for maximum limit of string with Limit = -1 ***
+array(51) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ [4]=>
+ string(1) "5"
+ [5]=>
+ string(1) "6"
+ [6]=>
+ string(1) "7"
+ [7]=>
+ string(1) "7"
+ [8]=>
+ string(1) "5"
+ [9]=>
+ string(1) "6"
+ [10]=>
+ string(1) "7"
+ [11]=>
+ string(1) "3"
+ [12]=>
+ string(1) "4"
+ [13]=>
+ string(1) "5"
+ [14]=>
+ string(1) "2"
+ [15]=>
+ string(1) "8"
+ [16]=>
+ string(1) "9"
+ [17]=>
+ string(1) "0"
+ [18]=>
+ string(1) "5"
+ [19]=>
+ string(1) "5"
+ [20]=>
+ string(1) "5"
+ [21]=>
+ string(1) "5"
+ [22]=>
+ string(1) "5"
+ [23]=>
+ string(1) "5"
+ [24]=>
+ string(1) "5"
+ [25]=>
+ string(1) "5"
+ [26]=>
+ string(1) "5"
+ [27]=>
+ string(1) "5"
+ [28]=>
+ string(1) "5"
+ [29]=>
+ string(1) "5"
+ [30]=>
+ string(2) "55"
+ [31]=>
+ string(1) "5"
+ [32]=>
+ string(1) "5"
+ [33]=>
+ string(2) "5%"
+ [34]=>
+ string(1) "%"
+ [35]=>
+ string(1) "%"
+ [36]=>
+ string(1) "%"
+ [37]=>
+ string(1) "5"
+ [38]=>
+ string(1) "5"
+ [39]=>
+ string(1) "5"
+ [40]=>
+ string(1) "%"
+ [41]=>
+ string(1) "%"
+ [42]=>
+ string(1) "5"
+ [43]=>
+ string(1) "5"
+ [44]=>
+ string(1) "5"
+ [45]=>
+ string(1) "5"
+ [46]=>
+ string(2) "5%"
+ [47]=>
+ string(1) "%"
+ [48]=>
+ string(1) "%"
+ [49]=>
+ string(2) "55"
+ [50]=>
+ string(1) "1"
+}
+
+*** Testing explode() with string variations as input argument ***
+
+-- Testing string with escape characters --
+array(2) {
+ [0]=>
+ string(4) "1234"
+ [1]=>
+ string(10) "5678
+ 9100"
+}
+array(4) {
+ [0]=>
+ string(4) "1234"
+ [1]=>
+ string(4) "abcd"
+ [2]=>
+ string(4) "5678"
+ [3]=>
+ string(4) "rstu"
+}
+
+-- Testing string with embedded NULL --
+array(4) {
+ [0]=>
+ string(4) "abcd"
+ [1]=>
+ string(5) "n1234"
+ [2]=>
+ string(5) "05678"
+ [3]=>
+ string(12) "00efgh\xijkl"
+}
+array(7) {
+ [0]=>
+ string(4) "abcd"
+ [1]=>
+ string(4) "efgh"
+ [2]=>
+ string(4) "ijkl"
+ [3]=>
+ string(4) "mnop"
+ [4]=>
+ string(5) "0qrst"
+ [5]=>
+ string(4) "uvwx"
+ [6]=>
+ string(2) "yz"
+}
+
+*** Testing explode() with objects ***
+array(2) {
+ [0]=>
+ string(1) "O"
+ [1]=>
+ string(4) "ject"
+}
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for explode() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for explode() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/htmlentities18.phpt b/ext/standard/tests/strings/htmlentities18.phpt
new file mode 100644
index 000000000..ab3df05da
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities18.phpt
@@ -0,0 +1,40 @@
+--TEST--
+htmlentities() / htmlspecialchars() "don't double encode" flag support
+--FILE--
+<?php
+$tests = array(
+ "abc",
+ "abc&amp;sfdsa",
+ "test&#043;s &amp; some more &#68;",
+ "&; &amp &#a; &9;",
+ "&kffjadfdhsjfhjasdhffasdfas;",
+ "&#8787978789",
+ "&",
+ "&&amp;&",
+ "&ab&amp;&",
+);
+
+foreach ($tests as $test) {
+ var_dump(htmlentities($test, ENT_QUOTES, NULL, FALSE));
+ var_dump(htmlspecialchars($test, ENT_QUOTES, NULL, FALSE));
+}
+?>
+--EXPECT--
+string(3) "abc"
+string(3) "abc"
+string(13) "abc&amp;sfdsa"
+string(13) "abc&amp;sfdsa"
+string(33) "test&#043;s &amp; some more &#68;"
+string(33) "test&#043;s &amp; some more &#68;"
+string(24) "&; &amp;amp &amp;#a; &9;"
+string(24) "&; &amp;amp &amp;#a; &9;"
+string(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
+string(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
+string(16) "&amp;#8787978789"
+string(16) "&amp;#8787978789"
+string(5) "&amp;"
+string(5) "&amp;"
+string(15) "&amp;&amp;&amp;"
+string(15) "&amp;&amp;&amp;"
+string(17) "&amp;ab&amp;&amp;"
+string(17) "&amp;ab&amp;&amp;"
diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt
index 1582c2516..2aaed8d05 100644
--- a/ext/standard/tests/strings/implode1.phpt
+++ b/ext/standard/tests/strings/implode1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt
new file mode 100644
index 000000000..c10d62044
--- /dev/null
+++ b/ext/standard/tests/strings/md5_file.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt
index 01ba34182..9d78d0c7a 100755
--- a/ext/standard/tests/strings/printf_64bit.phpt
+++ b/ext/standard/tests/strings/printf_64bit.phpt
@@ -6,6 +6,8 @@ if (!(PHP_INT_MAX > 2147483647)) {
die("skip 64bit test only");
}
?>
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/standard/tests/strings/sprintf_f_2.phpt b/ext/standard/tests/strings/sprintf_f_2.phpt
index d6006356f..a4b71bc46 100755
--- a/ext/standard/tests/strings/sprintf_f_2.phpt
+++ b/ext/standard/tests/strings/sprintf_f_2.phpt
@@ -1,5 +1,7 @@
--TEST--
sprintf %f #2
+--INI--
+precision=14
--FILE--
<?php
var_dump(sprintf("%.3F", 100.426));
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
index d6111b034..6eaff1514 100644
--- a/ext/standard/tests/strings/str_pad.phpt
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt
index f91bd31b6..858575d4c 100644
--- a/ext/standard/tests/strings/str_repeat.phpt
+++ b/ext/standard/tests/strings/str_repeat.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt
index 46d732a69..ae71aaaf5 100644
--- a/ext/standard/tests/strings/str_replace.phpt
+++ b/ext/standard/tests/strings/str_replace.phpt
@@ -1,40 +1,170 @@
--TEST--
-str_replace() tests
+Test str_replace() function
+--INI--
+precision=14
--FILE--
<?php
+/*
+ Prototype: mixed str_replace(mixed $search, mixed $replace,
+ mixed $subject [, int &$count]);
+ Description: Replace all occurrences of the search string with
+ the replacement string
+*/
-var_dump(str_replace("", "", ""));
+echo "\n*** Testing str_replace() on basic operations ***\n";
-var_dump(str_replace("e", "b", "test"));
+var_dump( str_replace("", "", "") );
-var_dump(str_replace("", "", "", $count));
-var_dump($count);
+var_dump( str_replace("e", "b", "test") );
-var_dump(str_replace("q", "q", "q", $count));
-var_dump($count);
+var_dump( str_replace("", "", "", $count) );
+var_dump( $count );
-var_dump(str_replace("long string here", "", "", $count));
-var_dump($count);
+var_dump( str_replace("q", "q", "q", $count) );
+var_dump( $count );
-var_dump(str_replace(chr(0), "a", "", $count));
-var_dump($count);
+var_dump( str_replace("long string here", "", "", $count) );
+var_dump( $count );
-var_dump(str_replace(chr(0), "a", chr(0), $count));
-var_dump($count);
+$fp = fopen( __FILE__, "r" );
+var_dump( str_replace($fp, $fp, $fp, $fp) );
+var_dump( $fp );
+
+echo "\n*** Testing str_replace() with various search values ***";
+$search_arr = array( TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL,
+ array(), "php", "");
+
+$i = 0;
+/* loop through to replace the matched elements in the array */
+foreach( $search_arr as $value ) {
+ echo "\n-- Iteration $i --\n";
+ /* replace the string in array */
+ var_dump( str_replace($value, "FOUND", $search_arr, $count) );
+ var_dump( $count );
+ $i++;
+}
+
+echo "\n*** Testing str_replace() with various subjects ***";
+$subject = "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE\000
+ \x000\xABCD\0abcd \xXYZ\tabcd $$@#%^&*!~,.:;?: !!Hello, World
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)";
+
+/* needles in an array to be compared in the string $string */
+$search_str = array (
+ "Hello, World",
+ 'Hello, World',
+ '!!Hello, World',
+ "??Hello, World",
+ "$@#%^&*!~,.:;?",
+ "123",
+ 123,
+ "-1.2345",
+ -1.2344,
+ "abcd",
+ 'XYZ',
+ NULL,
+ "NULL",
+ "0",
+ 0,
+ "",
+ " ",
+ "\0",
+ "\x000",
+ "\xABC",
+ "\0000",
+ ".3",
+ TRUE,
+ "TRUE",
+ "1",
+ 1,
+ FALSE,
+ "FALSE",
+ " ",
+ " ",
+ 'b',
+ '\t',
+ "\t",
+ chr(128).chr(234).chr(65).chr(255).chr(256),
+ $subject
+);
-var_dump(str_replace("multi", "a", "aaa", $count));
+/* loop through to get the $string */
+for( $i = 0; $i < count($search_str); $i++ ) {
+ echo "\n--- Iteration $i ---";
+ echo "\n-- String after replacing the search value is => --\n";
+ var_dump( str_replace($search_str[$i], "FOUND", $subject, $count) );
+ echo "-- search string has found '$count' times\n";
+}
+
+
+echo "\n*** Testing Miscelleneous input data ***\n";
+/* If replace has fewer values than search, then an empty
+ string is used for the rest of replacement values */
+var_dump( str_replace(array("a", "a", "b"),
+ array("q", "q"),
+ "aaabb", $count
+ )
+ );
+var_dump($count);
+var_dump( str_replace(array("a", "a", "b"),
+ array("q", "q"),
+ array("aaa", "bbb", "ccc"),
+ $count
+ )
+ );
var_dump($count);
-var_dump(str_replace("a", "multi", "aaa", $count));
+
+echo "\n-- Testing objects --\n";
+/* we get "Catchable fatal error: saying Object of class could not be converted
+ to string" by default, when an object is passed instead of string:
+The error can be avoided by chosing the __toString magix method as follows: */
+
+class subject
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_subject = new subject;
+
+class search
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_search = new search;
+
+class replace
+{
+ function __toString() {
+ return "Hello, world";
+ }
+}
+$obj_replace = new replace;
+
+var_dump(str_replace("$obj_search", "$obj_replace", "$obj_subject", $count));
var_dump($count);
+
+echo "\n-- Testing arrays --\n";
var_dump(str_replace(array("a", "a", "b"), "multi", "aaa", $count));
var_dump($count);
-var_dump(str_replace(array("a", "a", "b"), array("q", "q", "c"), "aaa", $count));
+var_dump(str_replace( array("a", "a", "b"),
+ array("q", "q", "c"),
+ "aaa", $count
+ )
+);
var_dump($count);
-var_dump(str_replace(array("a", "a", "b"), array("q", "q", "c"), array("aaa", "bbb"), $count));
+var_dump(str_replace( array("a", "a", "b"),
+ array("q", "q", "c"),
+ array("aaa", "bbb"),
+ $count
+ )
+);
var_dump($count);
var_dump(str_replace("a", array("q", "q", "c"), array("aaa", "bbb"), $count));
@@ -46,13 +176,70 @@ var_dump($count);
var_dump(str_replace(1, 3, array("aaa1", "2bbb"), $count));
var_dump($count);
-$fp = fopen(__FILE__, "r");
-var_dump(str_replace($fp, $fp, $fp, $fp));
-var_dump($fp);
+
+echo "\n-- Testing Resources --\n";
+$resource1 = fopen( __FILE__, "r" );
+$resource2 = opendir( "." );
+var_dump(str_replace("stream", "FOUND", $resource1, $count));
+var_dump($count);
+var_dump(str_replace("stream", "FOUND", $resource2, $count));
+var_dump($count);
+
+
+echo "\n-- Testing a longer and heredoc string --\n";
+$string = <<<EOD
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+EOD;
+
+var_dump( str_replace("abcdef", "FOUND", $string, $count) );
+var_dump( $count );
+
+echo "\n-- Testing a heredoc null string --\n";
+$str = <<<EOD
+EOD;
+var_dump( str_replace("", "FOUND", $str, $count) );
+var_dump( $count );
+
+
+echo "\n-- Testing simple and complex syntax strings --\n";
+$str = 'world';
+
+/* Simple syntax */
+var_dump( str_replace("world", "FOUND", "$str") );
+var_dump( str_replace("world'S", "FOUND", "$str'S") );
+var_dump( str_replace("worldS", "FOUND", "$strS") );
+
+/* String with curly braces, complex syntax */
+var_dump( str_replace("worldS", "FOUND", "${str}S") );
+var_dump( str_replace("worldS", "FOUND", "{$str}S") );
+
+
+echo "\n*** Testing error conditions ***";
+/* Invalid arguments */
+var_dump( str_replace() );
+var_dump( str_replace("") );
+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);
+
?>
--EXPECTF--
+*** Testing str_replace() on basic operations ***
string(0) ""
string(4) "tbst"
string(0) ""
@@ -61,14 +248,632 @@ string(1) "q"
int(1)
string(0) ""
int(0)
-string(0) ""
+string(14) "Resource id #5"
+int(1)
+
+*** Testing str_replace() with various search values ***
+-- Iteration 0 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 1 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 2 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 3 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "FOUND"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(5) "FOUND"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 4 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(5) "FOUND"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(5) "FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 5 --
+array(12) {
+ [0]=>
+ string(5) "FOUND"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(5) "FOUND"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(6) "-FOUND"
+ [5]=>
+ string(5) "FOUND"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(6) "-FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(5)
+
+-- Iteration 6 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(5) "FOUND"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(5) "FOUND"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 7 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(5) "FOUND"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(5) "FOUND"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(2)
+
+-- Iteration 8 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
int(0)
-string(1) "a"
+
+-- Iteration 9 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
+int(0)
+
+-- Iteration 10 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(5) "FOUND"
+ [11]=>
+ string(0) ""
+}
int(1)
-string(3) "aaa"
+
+-- Iteration 11 --
+array(12) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "0"
+ [4]=>
+ string(2) "-1"
+ [5]=>
+ string(1) "1"
+ [6]=>
+ string(1) "0"
+ [7]=>
+ string(2) "-1"
+ [8]=>
+ string(0) ""
+ [9]=>
+ array(0) {
+ }
+ [10]=>
+ string(3) "php"
+ [11]=>
+ string(0) ""
+}
int(0)
-string(15) "multimultimulti"
-int(3)
+
+*** Testing str_replace() with various subjects ***
+--- Iteration 0 ---
+-- String after replacing the search value is => --
+string(177) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 1 ---
+-- String after replacing the search value is => --
+string(177) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 2 ---
+-- String after replacing the search value is => --
+string(182) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 3 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 4 ---
+-- String after replacing the search value is => --
+string(182) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 5 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 6 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 7 ---
+-- String after replacing the search value is => --
+string(189) "Hello, world,0120333.3445FOUND67 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 8 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 9 ---
+-- String after replacing the search value is => --
+string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 10 ---
+-- String after replacing the search value is => --
+string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 11 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 12 ---
+-- String after replacing the search value is => --
+string(192) "Hello, world,0120333.3445-1.234567 FOUND TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 13 ---
+-- String after replacing the search value is => --
+string(207) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '4' times
+
+--- Iteration 14 ---
+-- String after replacing the search value is => --
+string(207) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '4' times
+
+--- Iteration 15 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 16 ---
+-- String after replacing the search value is => --
+string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
+FOUND FOUNDFOUNDFOUNDFOUND
+ FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '29' times
+
+--- Iteration 17 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSEFOUND
+ FOUND0«CDFOUNDabcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 18 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+ FOUND«CD
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 19 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 20 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+ FOUND«CD
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 21 ---
+-- String after replacing the search value is => --
+string(194) "Hello, world,0120333FOUND445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 22 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 23 ---
+-- String after replacing the search value is => --
+string(192) "Hello, world,0120333.3445-1.234567 NULL FOUND FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 24 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 25 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 26 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 27 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FOUND
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 28 ---
+-- String after replacing the search value is => --
+string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
+FOUND FOUNDFOUNDFOUNDFOUND
+ FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '29' times
+
+--- Iteration 29 ---
+-- String after replacing the search value is => --
+string(186) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '1' times
+
+--- Iteration 30 ---
+-- String after replacing the search value is => --
+string(199) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '2' times
+
+--- Iteration 31 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 32 ---
+-- String after replacing the search value is => --
+string(203) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+ FOUND
+FOUND ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '3' times
+
+--- Iteration 33 ---
+-- String after replacing the search value is => --
+string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
+
+ ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
+-- search string has found '0' times
+
+--- Iteration 34 ---
+-- String after replacing the search value is => --
+string(5) "FOUND"
+-- search string has found '1' times
+
+*** Testing Miscelleneous input data ***
+string(3) "qqq"
+int(5)
+array(3) {
+ [0]=>
+ string(3) "qqq"
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(3) "ccc"
+}
+int(6)
+
+-- Testing objects --
+string(12) "Hello, world"
+int(1)
+
+-- Testing arrays --
string(15) "multimultimulti"
int(3)
string(3) "qqq"
@@ -103,6 +908,51 @@ array(2) {
string(4) "2bbb"
}
int(1)
-string(%d) "Resource id #%d"
-int(1)
+
+-- Testing Resources --
+string(14) "Resource id #6"
+int(0)
+string(14) "Resource id #7"
+int(0)
+
+-- Testing a longer and heredoc string --
+string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
+@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
+FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789"
+int(16)
+
+-- Testing a heredoc null string --
+string(0) ""
+int(0)
+
+-- Testing simple and complex syntax strings --
+string(5) "FOUND"
+string(5) "FOUND"
+
+Notice: Undefined variable: strS in %s on line %d
+string(0) ""
+string(5) "FOUND"
+string(5) "FOUND"
+
+*** Testing error conditions ***
+Warning: Wrong parameter count for str_replace() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for str_replace() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for str_replace() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for str_replace() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for str_replace() in %s on line %d
+NULL
Done
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
index 4d30e9822..83dd20a59 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/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt
new file mode 100644
index 000000000..daa917e79
--- /dev/null
+++ b/ext/standard/tests/strings/strripos_offset.phpt
@@ -0,0 +1,45 @@
+--TEST--
+strripos() offset integer overflow
+--FILE--
+<?php
+
+var_dump(strripos("t", "t", PHP_INT_MAX+1));
+var_dump(strripos("tttt", "tt", PHP_INT_MAX+1));
+var_dump(strripos(100, 101, PHP_INT_MAX+1));
+var_dump(strripos(1024, 1024, PHP_INT_MAX+1));
+var_dump(strripos(array(), array(), PHP_INT_MAX+1));
+var_dump(strripos(1024, 1024, -PHP_INT_MAX));
+var_dump(strripos(1024, "te", -PHP_INT_MAX));
+var_dump(strripos(1024, 1024, -PHP_INT_MAX-1));
+var_dump(strripos(1024, "te", -PHP_INT_MAX-1));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Warning: strripos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
index 10ed33ddc..fc00ea098 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/substr.phpt b/ext/standard/tests/strings/substr.phpt
new file mode 100644
index 000000000..b43244e4c
--- /dev/null
+++ b/ext/standard/tests/strings/substr.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/substr_count.phpt b/ext/standard/tests/strings/substr_count.phpt
index 6aee36534..f15f42508 100644
--- a/ext/standard/tests/strings/substr_count.phpt
+++ b/ext/standard/tests/strings/substr_count.phpt
@@ -1,23 +1,99 @@
--TEST--
-substr_count() function
+Test substr_count() function
--FILE--
<?php
- var_dump(@substr_count("", ""));
- var_dump(@substr_count("a", ""));
- var_dump(@substr_count("", "a"));
- var_dump(@substr_count("", "a"));
- var_dump(@substr_count("", chr(0)));
+/* Prototype: int substr_count ( string $haystack, string $needle [, int $offset [, int $length]] );
+ * Description: substr_count() returns the number of times the needle substring occurs in the
+ * haystack string. Please note that needle is case sensitive
+ */
+
+/* Count the number of substring occurrences */
+echo "***Testing basic operations ***\n";
+var_dump(@substr_count("", ""));
+var_dump(@substr_count("a", ""));
+var_dump(@substr_count("", "a"));
+var_dump(@substr_count("", "a"));
+var_dump(@substr_count("", chr(0)));
+$a = str_repeat("abcacba", 100);
+var_dump(@substr_count($a, "bca"));
+$a = str_repeat("abcacbabca", 100);
+var_dump(@substr_count($a, "bca"));
+var_dump(substr_count($a, "bca", 200));
+var_dump(substr_count($a, "bca", 200, 50));
+
+echo "\n*** Testing possible variations ***\n";
+echo "-- 3rd or 4th arg as string --\n";
+$str = "this is a string";
+var_dump( substr_count($str, "t", "5") );
+var_dump( substr_count($str, "t", "5", "10") );
+var_dump( substr_count($str, "i", "5t") );
+var_dump( substr_count($str, "i", "5t", "10t") );
+
+echo "\n-- 3rd or 4th arg as NULL --\n";
+var_dump( substr_count($str, "t", "") );
+var_dump( substr_count($str, "T", "") );
+var_dump( substr_count($str, "t", "", 15) );
+var_dump( substr_count($str, "I", NULL) );
+var_dump( substr_count($str, "i", NULL, 10) );
+
+echo "\n-- overlapped substrings --\n";
+var_dump( substr_count("abcabcabcabcabc", "abca") );
+var_dump( substr_count("abcabcabcabcabc", "abca", 2) );
+
+echo "\n-- complex strings containing other than 7-bit chars --\n";
+$str = chr(128).chr(129).chr(128).chr(256).chr(255).chr(254).chr(255);
+var_dump(substr_count($str, chr(128)));
+var_dump(substr_count($str, chr(255)));
+var_dump(substr_count($str, chr(256)));
+
+echo "\n-- heredoc string --\n";
+$string = <<<EOD
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+acdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
+EOD;
+var_dump(substr_count($string, "abcd"));
+var_dump(substr_count($string, "1234"));
+
+echo "\n-- heredoc null string --\n";
+$str = <<<EOD
+EOD;
+var_dump(substr_count($str, "\0"));
+var_dump(substr_count($str, "\x000"));
+var_dump(substr_count($str, "0"));
+
+
+echo "\n*** Testing error conditions ***\n";
+/* Zero argument */
+var_dump( substr_count() );
+
+/* more than expected no. of args */
+var_dump( substr_count($str, "t", 0, 15, 30) );
- $a = str_repeat("abcacba", 100);
- var_dump(@substr_count($a, "bca"));
+/* offset as negative value */
+var_dump(substr_count($str, "t", -5));
+
+/* offset > size of the string */
+var_dump(substr_count($str, "t", 25));
+
+/* Using offset and length to go beyond the size of the string:
+ Warning message expected, as length+offset > length of string */
+var_dump( substr_count($str, "i", 5, 15) );
+
+/* length as Null */
+var_dump( substr_count($str, "t", "", "") );
+var_dump( substr_count($str, "i", NULL, NULL) );
- $a = str_repeat("abcacbabca", 100);
- var_dump(@substr_count($a, "bca"));
+echo "Done\n";
- var_dump(substr_count($a, "bca", 200));
- var_dump(substr_count($a, "bca", 200, 50));
?>
---EXPECT--
+--EXPECTF--
+***Testing basic operations ***
bool(false)
bool(false)
int(0)
@@ -27,3 +103,59 @@ int(100)
int(200)
int(160)
int(10)
+
+*** Testing possible variations ***
+-- 3rd or 4th arg as string --
+int(1)
+int(1)
+int(2)
+int(2)
+
+-- 3rd or 4th arg as NULL --
+int(2)
+int(0)
+int(2)
+int(0)
+int(2)
+
+-- overlapped substrings --
+int(2)
+int(2)
+
+-- complex strings containing other than 7-bit chars --
+int(2)
+int(2)
+int(1)
+
+-- heredoc string --
+int(14)
+int(16)
+
+-- heredoc null string --
+int(0)
+int(0)
+int(0)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for substr_count() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for substr_count() in %s on line %d
+NULL
+
+Warning: substr_count(): Offset should be greater than or equal to 0. in %s on line %d
+bool(false)
+
+Warning: substr_count(): Offset value 25 exceeds string length. in %s on line %d
+bool(false)
+
+Warning: substr_count(): Offset value 5 exceeds string length. in %s on line %d
+bool(false)
+
+Warning: substr_count(): Length should be greater than 0. in %s on line %d
+bool(false)
+
+Warning: substr_count(): Length should be greater than 0. in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt
new file mode 100644
index 000000000..4d89d0cf3
--- /dev/null
+++ b/ext/standard/tests/strings/trim1.phpt
Binary files differ
diff --git a/ext/sybase_ct/tests/bug22403.phpt b/ext/sybase_ct/tests/bug22403.phpt
index 349d90a17..5e0669e63 100644
--- a/ext/sybase_ct/tests/bug22403.phpt
+++ b/ext/sybase_ct/tests/bug22403.phpt
@@ -6,7 +6,7 @@ Sybase-CT bug #22403 (crash when executing a stored procedure without parameters
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: bug22403.phpt,v 1.2 2005/02/06 12:59:03 thekid Exp $
+ * $Id: bug22403.phpt,v 1.2.4.1 2007/05/22 11:35:47 thekid Exp $
*/
require('test.inc');
@@ -17,7 +17,7 @@ Sybase-CT bug #22403 (crash when executing a stored procedure without parameters
// Check if stored procedure already exists
$sp_name= 'phpt_bug22403';
- var_dump(sybase_select_db('tempdb', $db));
+ var_dump(sybase_select_db(TEMPDB, $db));
if (!sybase_select_single($db, 'select object_id("'.$sp_name.'")')) {
echo "Stored procedure {$sp_name} not found, creating\n";
var_dump(sybase_query('
@@ -63,7 +63,7 @@ bool(false)
<<< Return: boolean
bool(false)
>>> Query: exec does_not_exist
-*** Caught Sybase Server Message #2812 [Severity 16, state 4] at line 1
+*** Caught Sybase Server Message #2812 [Severity 16, state %d] at line 1
%s
<<< Return: boolean
bool(false)
diff --git a/ext/sybase_ct/tests/bug26407.phpt b/ext/sybase_ct/tests/bug26407.phpt
index 8d16d0d76..f5ea2e591 100644
--- a/ext/sybase_ct/tests/bug26407.phpt
+++ b/ext/sybase_ct/tests/bug26407.phpt
@@ -6,7 +6,7 @@ Sybase-CT bug #26407 (Result set fetching broken around transactions)
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: bug26407.phpt,v 1.2 2005/02/06 12:59:03 thekid Exp $
+ * $Id: bug26407.phpt,v 1.2.4.1 2007/05/22 11:33:36 thekid Exp $
*/
require('test.inc');
@@ -80,7 +80,7 @@ bool(true)
select "bar"
-Notice: sybase_query(): Sybase: Unexpected results, cancelling current in %s/test.inc on line %d
+Notice: sybase_query(): Sybase: Unexpected results, cancelling current in %stest.inc on line %d
<<< Return: resource
array(1) {
[0]=>
diff --git a/ext/sybase_ct/tests/bug27843.phpt b/ext/sybase_ct/tests/bug27843.phpt
index ac2f9a745..4705c5f01 100644
--- a/ext/sybase_ct/tests/bug27843.phpt
+++ b/ext/sybase_ct/tests/bug27843.phpt
@@ -6,7 +6,7 @@ Sybase-CT bug #27843 (notices when query is a stored procedure)
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: bug27843.phpt,v 1.3 2005/02/06 12:59:03 thekid Exp $
+ * $Id: bug27843.phpt,v 1.3.4.1 2007/05/22 11:35:47 thekid Exp $
*/
require('test.inc');
@@ -15,7 +15,7 @@ Sybase-CT bug #27843 (notices when query is a stored procedure)
// Check if stored procedure already exists
$sp_name= 'phpt_bug27843';
- var_dump(sybase_select_db('tempdb', $db));
+ var_dump(sybase_select_db(TEMPDB, $db));
if (!sybase_select_single($db, 'select object_id("'.$sp_name.'")')) {
echo "Stored procedure {$sp_name} not found, creating\n";
var_dump(sybase_query('
diff --git a/ext/sybase_ct/tests/bug28354.phpt b/ext/sybase_ct/tests/bug28354.phpt
index 949a38cca..08f3a53c7 100644
--- a/ext/sybase_ct/tests/bug28354.phpt
+++ b/ext/sybase_ct/tests/bug28354.phpt
@@ -6,7 +6,7 @@ Sybase-CT bug #28354 (sybase_free_result crash)
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: bug28354.phpt,v 1.3 2005/02/06 12:59:03 thekid Exp $
+ * $Id: bug28354.phpt,v 1.3.4.1 2007/05/22 11:35:47 thekid Exp $
*/
require('test.inc');
@@ -17,7 +17,7 @@ Sybase-CT bug #28354 (sybase_free_result crash)
// Check if stored procedure already exists
$sp_name= 'phpt_bug28354';
- var_dump(sybase_select_db('tempdb', $db));
+ var_dump(sybase_select_db(TEMPDB, $db));
if (!sybase_select_single($db, 'select object_id("'.$sp_name.'")')) {
echo "Stored procedure {$sp_name} not found, creating\n";
var_dump(sybase_query('
diff --git a/ext/sybase_ct/tests/test.inc b/ext/sybase_ct/tests/test.inc
index ebd399a25..f5e4465a6 100644
--- a/ext/sybase_ct/tests/test.inc
+++ b/ext/sybase_ct/tests/test.inc
@@ -1,13 +1,14 @@
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: test.inc,v 1.4.6.2 2007/03/11 12:56:44 tony2001 Exp $
+ * $Id: test.inc,v 1.4.6.3 2007/05/22 11:36:55 thekid Exp $
*/
// Change if needed
define('HOST', '****');
define('USER', '****');
define('PASSWORD', '****');
+ define('TEMPDB', 'tempdb');
// {{{ bool sybase_msg_handler(int msgnumber, int severity, int state, int line, string text)
// Handles server messages
diff --git a/ext/sybase_ct/tests/test_fetch_object.phpt b/ext/sybase_ct/tests/test_fetch_object.phpt
index a3255b33d..cd7c2c2e3 100644
--- a/ext/sybase_ct/tests/test_fetch_object.phpt
+++ b/ext/sybase_ct/tests/test_fetch_object.phpt
@@ -8,7 +8,7 @@ Sybase-CT sybase_fetch_object
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: test_fetch_object.phpt,v 1.1.6.1 2007/03/14 11:44:24 thekid Exp $
+ * $Id: test_fetch_object.phpt,v 1.1.6.2 2007/05/22 11:33:36 thekid Exp $
*/
require('test.inc');
@@ -65,7 +65,7 @@ article::__set_state(array(
'lastchange' => '%s',
))
-Notice: sybase_fetch_object(): Sybase: Class *** has not been declared in %s/test_fetch_object.php on line %d
+Notice: sybase_fetch_object(): Sybase: Class *** has not been declared in %stest_fetch_object.php on line %d
stdClass::__set_state(array(
'id' => 1,
'caption' => 'Hello',
diff --git a/ext/sybase_ct/tests/test_long.phpt b/ext/sybase_ct/tests/test_long.phpt
index 9806cc3b6..512202cd1 100644
--- a/ext/sybase_ct/tests/test_long.phpt
+++ b/ext/sybase_ct/tests/test_long.phpt
@@ -6,7 +6,7 @@ Sybase-CT select LONG_MAX / LONG_MIN
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: test_long.phpt,v 1.1 2004/05/16 20:28:31 thekid Exp $
+ * $Id: test_long.phpt,v 1.1.6.1 2007/05/22 12:16:32 thekid Exp $
*/
require('test.inc');
@@ -15,7 +15,7 @@ Sybase-CT select LONG_MAX / LONG_MIN
define('LONG_MIN', -LONG_MAX - 1);
$db= sybase_connect_ex();
- var_dump(sybase_select_db('tempdb', $db));
+ var_dump(sybase_select_db(TEMPDB, $db));
// Create table and insert some values
var_dump(sybase_query('create table test_long (value numeric(20, 0))'));
diff --git a/ext/sybase_ct/tests/test_msghandler.phpt b/ext/sybase_ct/tests/test_msghandler.phpt
index 8f0012ecf..fcbcb71f3 100644
--- a/ext/sybase_ct/tests/test_msghandler.phpt
+++ b/ext/sybase_ct/tests/test_msghandler.phpt
@@ -6,7 +6,7 @@ Sybase-CT server message handler
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: test_msghandler.phpt,v 1.2 2004/01/25 20:04:08 thekid Exp $
+ * $Id: test_msghandler.phpt,v 1.2.6.1 2007/05/22 11:33:36 thekid Exp $
*/
require('test.inc');
@@ -26,14 +26,14 @@ Sybase-CT server message handler
?>
--EXPECTF--
Nonexistant:
-Warning: sybase_set_message_handler(): First argumented is expected to be a valid callback, 'function_does_not_exist' was given in %s/test.inc on line %d
+Warning: sybase_set_message_handler(): First argumented is expected to be a valid callback, 'function_does_not_exist' was given in %stest.inc on line %d
bool(false)
Static method: bool(true)
Instance method: bool(true)
Lambda function: bool(true)
Unset: bool(true)
Incorrect type:
-Warning: sybase_set_message_handler(): First argumented is expected to be either NULL, an array or string, integer given in %s/test.inc on line %d
+Warning: sybase_set_message_handler(): First argumented is expected to be either NULL, an array or string, integer given in %stest.inc on line %d
bool(false)
Function: bool(true)
>>> Query: select getdate(NULL)
diff --git a/ext/sybase_ct/tests/test_msghandler_handled.phpt b/ext/sybase_ct/tests/test_msghandler_handled.phpt
index 70aa75d14..67eced430 100644
--- a/ext/sybase_ct/tests/test_msghandler_handled.phpt
+++ b/ext/sybase_ct/tests/test_msghandler_handled.phpt
@@ -6,7 +6,7 @@ Sybase-CT server message handler
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: test_msghandler_handled.phpt,v 1.1.6.1 2007/03/14 11:57:45 thekid Exp $
+ * $Id: test_msghandler_handled.phpt,v 1.1.6.2 2007/05/22 11:38:57 thekid Exp $
*/
require('test.inc');
@@ -65,6 +65,5 @@ Cannot handle message #249
Warning: sybase_query(): Sybase: Server message: Syntax error during explicit conversion of VARCHAR value 'notadate' to a DATETIME field.
(severity 16, procedure N/A) in %s on line %d
-<<< Return: resource
-array(0) {
-}
+<<< Return: boolean
+bool(false)
diff --git a/ext/sybase_ct/tests/test_unbuffered_query.phpt b/ext/sybase_ct/tests/test_unbuffered_query.phpt
index 1bda5198a..1270081e0 100644
--- a/ext/sybase_ct/tests/test_unbuffered_query.phpt
+++ b/ext/sybase_ct/tests/test_unbuffered_query.phpt
@@ -6,7 +6,7 @@ Sybase-CT unbuffered query
<?php
/* This file is part of PHP test framework for ext/sybase_ct
*
- * $Id: test_unbuffered_query.phpt,v 1.3 2004/05/21 21:01:21 thekid Exp $
+ * $Id: test_unbuffered_query.phpt,v 1.3.6.1 2007/05/22 11:33:36 thekid Exp $
*/
require('test.inc');
@@ -49,7 +49,7 @@ bool(true)
resource(%d) of type (sybase-ct result)
resource(%d) of type (Unknown)
-Warning: sybase_num_rows(): %d is not a valid Sybase result resource in %s/test_unbuffered_query.php on line %d
+Warning: sybase_num_rows(): %d is not a valid Sybase result resource in %stest_unbuffered_query.php on line %d
bool(true)
resource(%d) of type (sybase-ct result)
int(%d)
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index 878d73fb3..d9a96529e 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sysvsem.c,v 1.51.2.3.2.1 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: sysvsem.c,v 1.51.2.3.2.2 2007/05/11 15:46:38 tony2001 Exp $ */
/* Latest update build anc tested on Linux 2.2.14
*
@@ -134,7 +134,6 @@ static void release_sysvsem_sem(zend_rsrc_list_entry *rsrc TSRMLS_DC)
/* Release the semaphore if it has been acquired but not released. */
if (sem_ptr->count) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Releasing SysV semaphore id %d key 0x%x in request cleanup", sem_ptr->id, sem_ptr->key);
sop[1].sem_num = SYSVSEM_SEM;
sop[1].sem_op = sem_ptr->count;
@@ -142,10 +141,8 @@ static void release_sysvsem_sem(zend_rsrc_list_entry *rsrc TSRMLS_DC)
opcount++;
}
- if (semop(sem_ptr->semid, sop, opcount) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed in release_sysvsem_sem for key 0x%x: %s", sem_ptr->key, strerror(errno));
- }
+ semop(sem_ptr->semid, sop, opcount);
efree(sem_ptr);
}
/* }}} */
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 3d39eaee9..8621a461e 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tidy.c,v 1.66.2.8.2.22 2007/02/11 16:07:30 nlopess Exp $ */
+/* $Id: tidy.c,v 1.66.2.8.2.23 2007/05/04 17:11:05 nlopess Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -517,7 +517,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil
tidyBufInit(&output);
tidySaveBuffer (doc, &output);
- RETVAL_STRINGL(output.bp, output.size ? output.size-1 : 0, 1);
+ RETVAL_STRINGL((char*)output.bp, output.size ? output.size-1 : 0, 1);
tidyBufFree(&output);
} else {
RETVAL_FALSE;
@@ -685,7 +685,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type TSRMLS_DC)
obj = (PHPTidyObj *)zend_object_store_get_object(in TSRMLS_CC);
tidyBufInit(&output);
tidySaveBuffer (obj->ptdoc->doc, &output);
- ZVAL_STRINGL(out, output.bp, output.size ? output.size-1 : 0, TRUE);
+ ZVAL_STRINGL(out, (char*)output.bp, output.size ? output.size-1 : 0, TRUE);
tidyBufFree(&output);
break;
@@ -720,7 +720,7 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type TSRMLS_DC)
if (obj->ptdoc) {
tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf);
}
- ZVAL_STRINGL(out, buf.bp, buf.size ? buf.size-1 : 0, TRUE);
+ ZVAL_STRINGL(out, (char*)buf.bp, buf.size ? buf.size-1 : 0, TRUE);
tidyBufFree(&buf);
break;
@@ -742,7 +742,7 @@ static void tidy_doc_update_properties(PHPTidyObj *obj TSRMLS_DC)
if (output.size) {
MAKE_STD_ZVAL(temp);
- ZVAL_STRINGL(temp, output.bp, output.size-1, TRUE);
+ ZVAL_STRINGL(temp, (char*)output.bp, output.size-1, TRUE);
zend_hash_update(obj->std.properties, "value", sizeof("value"), (void *)&temp, sizeof(zval *), NULL);
}
@@ -750,7 +750,7 @@ static void tidy_doc_update_properties(PHPTidyObj *obj TSRMLS_DC)
if (obj->ptdoc->errbuf->size) {
MAKE_STD_ZVAL(temp);
- ZVAL_STRINGL(temp, obj->ptdoc->errbuf->bp, obj->ptdoc->errbuf->size-1, TRUE);
+ ZVAL_STRINGL(temp, (char*)obj->ptdoc->errbuf->bp, obj->ptdoc->errbuf->size-1, TRUE);
zend_hash_update(obj->std.properties, "errorBuffer", sizeof("errorBuffer"), (void *)&temp, sizeof(zval *), NULL);
}
}
@@ -992,7 +992,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.22 2007/02/11 16:07:30 nlopess Exp $)");
+ php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.8.2.23 2007/05/04 17:11:05 nlopess Exp $)");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -1039,7 +1039,7 @@ static PHP_FUNCTION(ob_tidyhandler)
tidyBufInit(&output);
tidySaveBuffer(doc, &output);
- RETVAL_STRINGL(output.bp, output.size ? output.size-1 : 0, 1);
+ RETVAL_STRINGL((char*)output.bp, output.size ? output.size-1 : 0, 1);
tidyBufFree(&output);
}
@@ -1088,7 +1088,7 @@ static PHP_FUNCTION(tidy_get_error_buffer)
TIDY_FETCH_OBJECT;
if (obj->ptdoc->errbuf && obj->ptdoc->errbuf->bp) {
- RETURN_STRINGL(obj->ptdoc->errbuf->bp, obj->ptdoc->errbuf->size-1, 1);
+ RETURN_STRINGL((char*)obj->ptdoc->errbuf->bp, obj->ptdoc->errbuf->size-1, 1);
} else {
RETURN_FALSE;
}
@@ -1105,7 +1105,7 @@ static PHP_FUNCTION(tidy_get_output)
tidyBufInit(&output);
tidySaveBuffer(obj->ptdoc->doc, &output);
- RETVAL_STRINGL(output.bp, output.size ? output.size-1 : 0, 1);
+ RETVAL_STRINGL((char*)output.bp, output.size ? output.size-1 : 0, 1);
tidyBufFree(&output);
}
diff --git a/ext/tokenizer/Makefile.frag b/ext/tokenizer/Makefile.frag
index eaca6e7f4..6802d40e9 100644
--- a/ext/tokenizer/Makefile.frag
+++ b/ext/tokenizer/Makefile.frag
@@ -1,2 +1,2 @@
-Zend/zend_language_parser.h:
-$(builddir)/tokenizer.lo: Zend/zend_language_parser.h
+$(top_srcdir)/Zend/zend_language_parser.h:
+$(builddir)/tokenizer.lo: $(top_srcdir)/Zend/zend_language_parser.h
diff --git a/ext/tokenizer/php_tokenizer.h b/ext/tokenizer/php_tokenizer.h
index 94c614a92..bd0eedeae 100644
--- a/ext/tokenizer/php_tokenizer.h
+++ b/ext/tokenizer/php_tokenizer.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_tokenizer.h,v 1.9.2.1.2.2 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: php_tokenizer.h,v 1.9.2.1.2.3 2007/05/28 12:19:41 bjori Exp $ */
#ifndef PHP_TOKENIZER_H
#define PHP_TOKENIZER_H
@@ -37,7 +37,6 @@ extern zend_module_entry tokenizer_module_entry;
PHP_MINIT_FUNCTION(tokenizer);
PHP_MINFO_FUNCTION(tokenizer);
-PHP_FUNCTION(confirm_tokenizer_compiled); /* For testing, remove later. */
PHP_FUNCTION(token_get_all);
PHP_FUNCTION(token_name);
diff --git a/ext/tokenizer/tests/001.phpt b/ext/tokenizer/tests/001.phpt
index 36ed2696f..203e3c7dd 100644
--- a/ext/tokenizer/tests/001.phpt
+++ b/ext/tokenizer/tests/001.phpt
@@ -57,8 +57,6 @@ echo token_name(T_STRING_VARNAME), "\n";
echo token_name(T_VARIABLE), "\n";
echo token_name(T_NUM_STRING), "\n";
echo token_name(T_INLINE_HTML), "\n";
-echo token_name(T_CHARACTER), "\n";
-echo token_name(T_BAD_CHARACTER), "\n";
echo token_name(T_ENCAPSED_AND_WHITESPACE), "\n";
echo token_name(T_CONSTANT_ENCAPSED_STRING), "\n";
echo token_name(T_ECHO), "\n";
@@ -185,8 +183,6 @@ T_STRING_VARNAME
T_VARIABLE
T_NUM_STRING
T_INLINE_HTML
-T_CHARACTER
-T_BAD_CHARACTER
T_ENCAPSED_AND_WHITESPACE
T_CONSTANT_ENCAPSED_STRING
T_ECHO
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index dc5f1eba6..c94159e51 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tokenizer.c,v 1.31.2.5.2.5 2007/04/08 00:18:38 johannes Exp $ */
+/* $Id: tokenizer.c,v 1.31.2.5.2.6 2007/05/18 13:12:04 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -280,14 +280,15 @@ static void tokenize(zval *return_value TSRMLS_DC)
while ((token_type = lex_scan(&token TSRMLS_CC))) {
destroy = 1;
switch (token_type) {
- case EOF:
- zendleng--; /* don't count EOF */
+ case T_CLOSE_TAG:
+ if (zendtext[zendleng - 1] != '>') {
+ CG(zend_lineno)++;
+ }
case T_OPEN_TAG:
case T_OPEN_TAG_WITH_ECHO:
case T_WHITESPACE:
case T_COMMENT:
case T_DOC_COMMENT:
- case T_CLOSE_TAG:
destroy = 0;
break;
}
@@ -297,6 +298,10 @@ static void tokenize(zval *return_value TSRMLS_DC)
array_init(keyword);
add_next_index_long(keyword, token_type);
if (token_type == T_END_HEREDOC) {
+ if (CG(increment_lineno)) {
+ token_line = ++CG(zend_lineno);
+ CG(increment_lineno) = 0;
+ }
add_next_index_stringl(keyword, Z_STRVAL(token), Z_STRLEN(token), 1);
efree(Z_STRVAL(token));
} else {
@@ -372,8 +377,6 @@ get_token_type_name(int token_type)
case T_VARIABLE: return "T_VARIABLE";
case T_NUM_STRING: return "T_NUM_STRING";
case T_INLINE_HTML: return "T_INLINE_HTML";
- case T_CHARACTER: return "T_CHARACTER";
- case T_BAD_CHARACTER: return "T_BAD_CHARACTER";
case T_ENCAPSED_AND_WHITESPACE: return "T_ENCAPSED_AND_WHITESPACE";
case T_CONSTANT_ENCAPSED_STRING: return "T_CONSTANT_ENCAPSED_STRING";
case T_ECHO: return "T_ECHO";
diff --git a/ext/wddx/tests/001.phpt b/ext/wddx/tests/001.phpt
index ffca63cd9..3efc0f4b0 100644
--- a/ext/wddx/tests/001.phpt
+++ b/ext/wddx/tests/001.phpt
@@ -2,6 +2,8 @@
wddx deserialization test
--SKIPIF--
<?php if (!extension_loaded("wddx")) print "skip"; ?>
+--INI--
+precision=14
--FILE--
<?php
$path = dirname(__FILE__);
diff --git a/ext/wddx/tests/bug41283.phpt b/ext/wddx/tests/bug41283.phpt
new file mode 100644
index 000000000..241101f2a
--- /dev/null
+++ b/ext/wddx/tests/bug41283.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #41283 (Bug with serializing array key that are doubles or floats)
+--SKIPIF--
+<?php if (!extension_loaded("wddx")) print "skip"; ?>
+--FILE--
+<?php
+$data = array(
+ 'somearray' => array('1.1' => 'One 1','1.2' => 'One 2', '1.0' => 'Three')
+);
+
+var_dump(wddx_deserialize(wddx_serialize_vars('data')));
+?>
+--EXPECT--
+array(1) {
+ ["data"]=>
+ array(1) {
+ ["somearray"]=>
+ array(3) {
+ ["1.1"]=>
+ string(5) "One 1"
+ ["1.2"]=>
+ string(5) "One 2"
+ [1]=>
+ string(5) "Three"
+ }
+ }
+}
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 0e4201ff0..4ee1e91db 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: wddx.c,v 1.119.2.10.2.15 2007/03/04 04:38:43 stas Exp $ */
+/* $Id: wddx.c,v 1.119.2.10.2.16 2007/05/05 15:14:56 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -984,6 +984,9 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
goto bigint;
}
l = (long) d;
+ if (l != d) {
+ goto bigint;
+ }
case IS_LONG:
zend_hash_index_update(target_hash, l, &ent1->data, sizeof(zval *), NULL);
break;
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
index 7f63febc3..b99a0afec 100644
--- a/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
+++ b/ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c
@@ -31,13 +31,13 @@
*/
-static const char rcsid[] = "#(@) $Id: xml_to_xmlrpc.c,v 1.5.6.2 2007/03/04 18:24:49 iliaa Exp $";
+static const char rcsid[] = "#(@) $Id: xml_to_xmlrpc.c,v 1.5.6.3 2007/05/03 04:16:32 edink Exp $";
+#include "php.h"
+#include "main/snprintf.h"
#ifdef _WIN32
#include "xmlrpc_win32.h"
#endif
-#include "php.h"
-#include "main/snprintf.h"
#include <string.h>
#include <stdlib.h>
#include "xml_to_xmlrpc.h"
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 56a696801..f90ffa7d7 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlwriter.c,v 1.20.2.12.2.12 2007/01/06 18:03:43 rrichards Exp $ */
+/* $Id: php_xmlwriter.c,v 1.20.2.12.2.15 2007/05/14 09:23:49 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -566,7 +566,7 @@ static PHP_FUNCTION(xmlwriter_start_attribute_ns)
zval *this = getThis();
if (this) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss!",
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
return;
}
@@ -574,7 +574,7 @@ static PHP_FUNCTION(xmlwriter_start_attribute_ns)
} else
#endif
{
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &pind,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss!", &pind,
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
return;
}
@@ -656,7 +656,7 @@ static PHP_FUNCTION(xmlwriter_write_attribute_ns)
zval *this = getThis();
if (this) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss!s",
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
return;
}
@@ -664,7 +664,7 @@ static PHP_FUNCTION(xmlwriter_write_attribute_ns)
} else
#endif
{
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssss", &pind,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss!s", &pind,
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
return;
}
@@ -695,7 +695,6 @@ static PHP_FUNCTION(xmlwriter_start_element)
}
/* }}} */
-
/* {{{ proto bool xmlwriter_start_element_ns(resource xmlwriter, string prefix, string name, string uri)
Create start namespaced element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_element_ns)
@@ -709,7 +708,7 @@ static PHP_FUNCTION(xmlwriter_start_element_ns)
zval *this = getThis();
if (this) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!ss!",
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
return;
}
@@ -717,7 +716,7 @@ static PHP_FUNCTION(xmlwriter_start_element_ns)
} else
#endif
{
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ss", &pind,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ss!", &pind,
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
return;
}
@@ -756,20 +755,21 @@ static PHP_FUNCTION(xmlwriter_full_end_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_element(resource xmlwriter, string name, string content)
+/* {{{ proto bool xmlwriter_write_element(resource xmlwriter, string name[, string content])
Write full element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_element)
{
zval *pind;
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
- char *name, *content;
+ char *name, *content = NULL;
int name_len, content_len, retval;
+
#ifdef ZEND_ENGINE_2
zval *this = getThis();
if (this) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!",
&name, &name_len, &content, &content_len) == FAILURE) {
return;
}
@@ -777,7 +777,7 @@ static PHP_FUNCTION(xmlwriter_write_element)
} else
#endif
{
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pind,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s!", &pind,
&name, &name_len, &content, &content_len) == FAILURE) {
return;
}
@@ -789,7 +789,18 @@ static PHP_FUNCTION(xmlwriter_write_element)
ptr = intern->ptr;
if (ptr) {
- retval = xmlTextWriterWriteElement(ptr, (xmlChar *)name, (xmlChar *)content);
+ if (!content) {
+ retval = xmlTextWriterStartElement(ptr, (xmlChar *)name);
+ if (retval == -1) {
+ RETURN_FALSE;
+ }
+ xmlTextWriterEndElement(ptr);
+ if (retval == -1) {
+ RETURN_FALSE;
+ }
+ } else {
+ retval = xmlTextWriterWriteElement(ptr, (xmlChar *)name, (xmlChar *)content);
+ }
if (retval != -1) {
RETURN_TRUE;
}
@@ -799,21 +810,21 @@ static PHP_FUNCTION(xmlwriter_write_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_element_ns(resource xmlwriter, string prefix, string name, string uri, string content)
+/* {{{ proto bool xmlwriter_write_element_ns(resource xmlwriter, string prefix, string name, string uri[, string content])
Write full namesapced element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_element_ns)
{
zval *pind;
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
- char *name, *prefix, *uri, *content;
+ char *name, *prefix, *uri, *content = NULL;
int name_len, prefix_len, uri_len, content_len, retval;
#ifdef ZEND_ENGINE_2
zval *this = getThis();
if (this) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!ss!|s!",
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
return;
}
@@ -821,7 +832,7 @@ static PHP_FUNCTION(xmlwriter_write_element_ns)
} else
#endif
{
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!sss", &pind,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ss!|s!", &pind,
&prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
return;
}
@@ -833,7 +844,18 @@ static PHP_FUNCTION(xmlwriter_write_element_ns)
ptr = intern->ptr;
if (ptr) {
- retval = xmlTextWriterWriteElementNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri, (xmlChar *)content);
+ if (!content) {
+ retval = xmlTextWriterStartElementNS(ptr,(xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri);
+ if (retval == -1) {
+ RETURN_FALSE;
+ }
+ retval = xmlTextWriterEndElement(ptr);
+ if (retval == -1) {
+ RETURN_FALSE;
+ }
+ } else {
+ retval = xmlTextWriterWriteElementNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri, (xmlChar *)content);
+ }
if (retval != -1) {
RETURN_TRUE;
}
diff --git a/ext/xmlwriter/tests/bug41287.phpt b/ext/xmlwriter/tests/bug41287.phpt
new file mode 100644
index 000000000..106ac3a3e
--- /dev/null
+++ b/ext/xmlwriter/tests/bug41287.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Bug #41287 (Namespace functions don't allow xmlns defintion to be optional)
+--FILE--
+<?php
+
+$xw = xmlwriter_open_memory();
+xmlwriter_set_indent($xw, true);
+xmlwriter_start_document($xw);
+xmlwriter_start_element_ns($xw, 'test', 'test', 'urn:x-test:');
+xmlwriter_write_element_ns($xw, 'test', 'foo', null, '');
+xmlwriter_write_element_ns($xw, null, 'bar', 'urn:x-test:', '');
+xmlwriter_write_element_ns($xw, null, 'bar', '', '');
+xmlwriter_end_element($xw);
+xmlwriter_end_document($xw);
+print xmlwriter_flush($xw, true);
+print "\n";
+
+$xw = new XMLWriter();
+$xw->openMemory();
+$xw->setIndent(true);
+$xw->startDocument();
+$xw->startElementNS('test', 'test', 'urn:x-test:');
+$xw->writeElementNS('test', 'foo', null, '');
+$xw->writeElementNS(null, 'bar', 'urn:x-test:', '');
+$xw->writeElementNS(null, 'bar', '', '');
+$xw->endElement();
+$xw->endDocument();
+print $xw->flush(true);
+?>
+--EXPECTF--
+<?xml version="1.0"?>
+<test:test xmlns:test="urn:x-test:">
+ <test:foo></test:foo>
+ <bar xmlns="urn:x-test:"></bar>
+ <bar xmlns=""></bar>
+</test:test>
+
+<?xml version="1.0"?>
+<test:test xmlns:test="urn:x-test:">
+ <test:foo></test:foo>
+ <bar xmlns="urn:x-test:"></bar>
+ <bar xmlns=""></bar>
+</test:test>
diff --git a/ext/xmlwriter/tests/bug41326.phpt b/ext/xmlwriter/tests/bug41326.phpt
new file mode 100644
index 000000000..d7054c81b
--- /dev/null
+++ b/ext/xmlwriter/tests/bug41326.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Bug #41287 (Writing empty tags with Xmlwriter::WriteElement[ns])
+--FILE--
+<?php
+$xml = new XmlWriter();
+$xml->openMemory();
+$xml->setIndent(true);
+$xml->startDocument();
+$xml->startElement('test');
+$xml->writeElement('foo', null);
+$xml->writeElement('foo2', "");
+$xml->writeElement('foo3');
+$xml->startElement('bar');
+$xml->endElement('bar');
+$xml->endElement();
+print $xml->flush(true);
+
+print "\n";
+
+$xw = new XMLWriter();
+$xw->openMemory();
+$xw->setIndent(true);
+$xw->startDocument();
+$xw->startElementNS('test', 'test', 'urn:x-test:');
+$xw->writeElementNS('test', 'foo', null, '');
+$xw->writeElementNS(null, 'bar', 'urn:x-test:', '');
+$xw->writeElementNS(null, 'bar', 'urn:x-test:', NULL);
+$xw->writeElementNS(null, 'bar', 'urn:x-test:');
+$xw->writeElementNS(null, 'bar', '', '');
+$xw->endElement();
+$xw->endDocument();
+print $xw->flush(true);
+?>
+--EXPECTF--
+<?xml version="1.0"?>
+<test>
+ <foo/>
+ <foo2></foo2>
+ <foo3/>
+ <bar/>
+</test>
+
+<?xml version="1.0"?>
+<test:test xmlns:test="urn:x-test:">
+ <test:foo></test:foo>
+ <bar xmlns="urn:x-test:"></bar>
+ <bar xmlns="urn:x-test:"/>
+ <bar xmlns="urn:x-test:"/>
+ <bar xmlns=""></bar>
+</test:test>
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 0ddf9501b..a3fd1dd73 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zip.c,v 1.1.2.31 2007/03/14 15:02:20 iliaa Exp $ */
+/* $Id: php_zip.c,v 1.1.2.33 2007/05/19 22:25:11 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -62,7 +62,7 @@ static int le_zip_entry;
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string as entry name"); \
RETURN_FALSE; \
} \
- if (zip_stat(za, path, flags, &sb)) { \
+ if (zip_stat(za, path, flags, &sb) != 0) { \
RETURN_FALSE; \
}
/* }}} */
@@ -103,7 +103,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
size_t file_basename_len;
int is_dir_only = 0;
- if (file_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb)) {
+ if (file_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
return 0;
}
@@ -1699,7 +1699,6 @@ static ZIPARCHIVE_METHOD(extractTo)
zval **zval_file = NULL;
php_stream_statbuf ssb;
char *pathto;
- char *file;
int pathto_len;
int ret, i;
@@ -1713,24 +1712,22 @@ static ZIPARCHIVE_METHOD(extractTo)
return;
}
- if (pathto_len<1) {
+ if (pathto_len < 1) {
RETURN_FALSE;
}
- if (php_stream_stat_path(pathto, &ssb) < 0) {
- ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL);
- if (!ret) {
- efree(pathto);
- RETURN_FALSE;
- }
- }
+ if (php_stream_stat_path(pathto, &ssb) < 0) {
+ ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL);
+ if (!ret) {
+ RETURN_FALSE;
+ }
+ }
ZIP_FROM_OBJECT(intern, this);
if (zval_files) {
switch (Z_TYPE_P(zval_files)) {
case IS_STRING:
- file = Z_STRVAL_P(zval_files);
- if (!php_zip_extract_file(intern, pathto, file, Z_STRLEN_P(zval_files) TSRMLS_CC)) {
+ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) {
RETURN_FALSE;
}
break;
@@ -1745,8 +1742,7 @@ static ZIPARCHIVE_METHOD(extractTo)
case IS_LONG:
break;
case IS_STRING:
- file = Z_STRVAL_PP(zval_file);
- if (!php_zip_extract_file(intern, pathto, file, Z_STRLEN_PP(zval_file) TSRMLS_CC)) {
+ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file) TSRMLS_CC)) {
RETURN_FALSE;
}
break;
@@ -1760,22 +1756,21 @@ static ZIPARCHIVE_METHOD(extractTo)
break;
}
} else {
- /* Extract all files */
- int filecount = zip_get_num_files(intern);
-
- if (filecount == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal archive");
- RETURN_FALSE;
- }
-
- for (i = 0; i < filecount; i++) {
- file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
- if (!php_zip_extract_file(intern, pathto, file, strlen(file) TSRMLS_CC)) {
- RETURN_FALSE;
- }
- }
- }
+ /* Extract all files */
+ int filecount = zip_get_num_files(intern);
+
+ if (filecount == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal archive");
+ RETURN_FALSE;
+ }
+ for (i = 0; i < filecount; i++) {
+ char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+ if (!php_zip_extract_file(intern, pathto, file, strlen(file) TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ }
+ }
RETURN_TRUE;
}
/* }}} */
@@ -1884,7 +1879,7 @@ static ZIPARCHIVE_METHOD(getStream)
return;
}
- if (zip_stat(intern, filename, 0, &sb)) {
+ if (zip_stat(intern, filename, 0, &sb) != 0) {
RETURN_FALSE;
}
@@ -2027,7 +2022,7 @@ 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.31 2007/03/14 15:02:20 iliaa Exp $");
+ php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.33 2007/05/19 22:25:11 pajoye Exp $");
php_info_print_table_row(2, "Zip version", "2.0.0");
php_info_print_table_row(2, "Libzip version", "0.7.1");
diff --git a/ext/zip/tests/bug7214.phpt b/ext/zip/tests/bug7214.phpt
index 6f728f5aa..10271e36a 100644
--- a/ext/zip/tests/bug7214.phpt
+++ b/ext/zip/tests/bug7214.phpt
@@ -1,8 +1,8 @@
--TEST--
-bug #7214, zip_entry_read() binary safe
+Bug #7214 (zip_entry_read() binary safe)
--SKIPIF--
<?php
-/* $Id: bug7214.phpt,v 1.1 2006/07/24 16:58:58 pajoye Exp $ */
+/* $Id: bug7214.phpt,v 1.1.2.1 2007/05/07 18:03:00 tony2001 Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
@@ -20,4 +20,4 @@ if (strlen($contents) == zip_entry_filesize($entry)) {
?>
--EXPECT--
-Ok \ No newline at end of file
+Ok
diff --git a/ext/zip/tests/bug7658.phpt b/ext/zip/tests/bug7658.phpt
index 1c9fb37ee..743761097 100644
--- a/ext/zip/tests/bug7658.phpt
+++ b/ext/zip/tests/bug7658.phpt
@@ -1,8 +1,8 @@
--TEST--
-bug #7658, modify archive with general bit flag 3 set
+Bug #7658 (modify archive with general bit flag 3 set)
--SKIPIF--
<?php
-/* $Id: bug7658.phpt,v 1.1.2.1 2006/10/02 14:31:04 tony2001 Exp $ */
+/* $Id: bug7658.phpt,v 1.1.2.2 2007/05/07 18:03:00 tony2001 Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
diff --git a/ext/zip/tests/bug8009.phpt b/ext/zip/tests/bug8009.phpt
index dd396ebb9..1887c50b2 100644
--- a/ext/zip/tests/bug8009.phpt
+++ b/ext/zip/tests/bug8009.phpt
@@ -1,8 +1,8 @@
--TEST--
-bug #8009, cannot add again same entry to an archive
+Bug #8009 (cannot add again same entry to an archive)
--SKIPIF--
<?php
-/* $Id: bug8009.phpt,v 1.1 2006/07/24 16:58:58 pajoye Exp $ */
+/* $Id: bug8009.phpt,v 1.1.2.1 2007/05/07 18:03:00 tony2001 Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
diff --git a/ext/zip/tests/bug8700.phpt b/ext/zip/tests/bug8700.phpt
index 2749404ce..c04f32ab5 100644
--- a/ext/zip/tests/bug8700.phpt
+++ b/ext/zip/tests/bug8700.phpt
@@ -1,8 +1,8 @@
--TEST--
-bug #8700, getFromIndex(0) fails
+Bug #8700 (getFromIndex(0) fails)
--SKIPIF--
<?php
-/* $Id: bug8700.phpt,v 1.1.2.2 2006/09/15 12:12:25 pajoye Exp $ */
+/* $Id: bug8700.phpt,v 1.1.2.3 2007/05/07 18:03:00 tony2001 Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index 1864e9d32..e1153ece3 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib_fopen_wrapper.c,v 1.46.2.1.2.3 2007/04/26 12:52:58 dmitry Exp $ */
+/* $Id: zlib_fopen_wrapper.c,v 1.46.2.1.2.4 2007/05/08 12:08:17 dmitry Exp $ */
#define _GNU_SOURCE
@@ -76,7 +76,7 @@ static int php_gziop_close(php_stream *stream, int close_handle TSRMLS_DC)
self->gz_file = NULL;
}
if (self->stream) {
- php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PRESERVE_HANDLE);
+ php_stream_close(self->stream);
self->stream = NULL;
}
}
@@ -130,7 +130,7 @@ php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mod
int fd;
if (SUCCESS == php_stream_cast(innerstream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
- self->gz_file = gzdopen(fd, mode);
+ self->gz_file = gzdopen(dup(fd), mode);
self->stream = innerstream;
if (self->gz_file) {
stream = php_stream_alloc_rel(&php_stream_gzio_ops, self, 0, mode);